Toggling off verbosity in the find command

I’m trying to toggle off the verbosity of the find command while writing the results to a text file and sending the process to the background.

I’m using this command:

find / -ctime 7 1> /home/user1/Changed_Last7Days.txt &

Tried to redirect the error-free output (used 1> according to POSIX) but it still printing out the errors in the terminal session.

I don’t understand how or if I can combine /dev/null/ redirection with this one liner.

I tried to be as clear as I can.


Asked By: pashosh


1> only redirects file descriptor number 1, standard output. It doesn’t change where the errors go. (1>file is same as just >file) To get rid of any errors, add another redirection to send them to /dev/null. They are written to file descriptor 2.

find / -ctime 7 1> /home/user1/Changed_Last7Days.txt  2>/dev/null &

Or, if you wanted to redirect both stdout and stderr to the same place, use:

find / -ctime 7 1> /home/user1/Changed_Last7Days.txt  2>&1 &
Answered By: icarus
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.