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.
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.
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:
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
- -q Turn off wget command output
/dev/nullWrite downloaded content (file) to
That’s it. Now the junk files will not be created anymore.
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.