• Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate
TecNStuff
Menu
  • Home
  • Linux
  • Ubuntu
  • Debian
  • CentOS
  • Linux Commands
  • About Us
  • Donate

[Resolved] Cron job wget writing files to root directory

Written by Admin, Updated On June 15, 2021
cron, cronjob, wget
[Resolved] Cron job wget writing files to root directory

Wget is command line utility for downloading files in Linux from web. Using wget utility you can trigger server side scripts using cron job. It also can be used to download files with FPT, HTTP, HTTPS protocols.

Problem#

When you use wget with cron job it will save the downloaded files under home directory. So it will create large number of junk files on your system.

Solution#

You should use the option -O with wget command to write the result file to specific file and location. After that select /dev/null device file as target file. It will ignore everything written to it. As a result, no junk files will be created in your home directory.

For example, below is the basic wget command:

wget http://releases.ubuntu.com/18.04/ubuntu-18.04.2-desktop-amd64.iso

You should change in above command to:

wget -q -O /dev/null http://releases.ubuntu.com/18.04/ubuntu-18.04.2-desktop-amd64.iso

Here:

  • -q Turn off wget command output
  • -O /dev/null Write downloaded content (file) to /dev/null device.

That’s it. Now the junk files will not be created anymore.

Conclusion#

Hope this tutorial helps you to avoid unwanted files on root generated by wget cron jobs. You can learn more about Wget visit the GNU wget Manual page.

If our content helps you, please consider buying us a coffee

Thank you for your support.

Share On
Share on Facebook
Share on Twitter
Share on Reddit
Share on Tumblr
 Previous Article [Solved] Unknown collation: utf8mb4_0900_ai_ci
Next Article   What is 503 Service Unavailable Error

Related Posts

  • How to List Cron Jobs in Linux

    How to List Cron Jobs in Linux

    October 9, 2020
  • How to Run Cron Jobs Every 5, 10 or 15 Minutes

    How to Run Cron Job Every 5, 10 or 15 Minutes

    September 21, 2020
  • Setup Cron Jobs in Ubuntu 18.04

    How to Setup Cron Job on Ubuntu 18.04

    June 1, 2019

Leave a Reply Cancel reply

DigitalOcean Referral Badge

Popular Posts

  • How to Install SSH Keys on Ubuntu 22.04
    How to Set up SSH Keys on Ubuntu 22.04 January 7, 2023
  • How to Install Mongodb on Debian 11
    How to Install MongoDB on Debian 11 Linux January 11, 2023
  • How to Install Puppet Agent on Ubuntu 22.04
    How to Install Puppet Agent on Ubuntu 22.04 January 22, 2023
  • How to Install Jenkins on Debian 11
    How to Install Jenkins on Debian 11 January 5, 2023
  • How to Change-Hostname Ubuntu 22.04
    How to Change Hostname on Ubuntu 22.04 January 19, 2023
© 2020 TecNStuff All rights reserved. This website is using and storing cookies on your browser. By using this website you agree our Privacy Policy.  Follow us -  Twitter | Facebook