Problem

While using the wget with cron job saved the downloaded files under home directory. Due to this a large number of junk files get created in your system.

Solution

Use -O option with wget command to write the result file (data) to specific file and location. Next select /dev/null device file as target file. This will discard anything written to it. In result, no junk files will be created in your home directory. For example, the original cron job command is: Update above command to: Here:

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

That’s it. Hope this tutorial helps you to avoid unwanted files on root generated by wget cron jobs.


title: " Solved Cron Job Wget Writing Files To Root Directory Tecadmin" ShowToc: true date: “2022-11-18” author: “Christine Recher”

Problem

While using the wget with cron job saved the downloaded files under home directory. Due to this a large number of junk files get created in your system.

Solution

Use -O option with wget command to write the result file (data) to specific file and location. Next select /dev/null device file as target file. This will discard anything written to it. In result, no junk files will be created in your home directory. For example, the original cron job command is: Update above command to: Here:

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

That’s it. Hope this tutorial helps you to avoid unwanted files on root generated by wget cron jobs.