I'm trying to find a directory with this command:
find /users/dan/ -name 'Prams' -type d
I see a huge amount of 'No such file or directory' output. Is there a way to make find shut up if it doesn't find anything?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityI'm trying to find a directory with this command:
find /users/dan/ -name 'Prams' -type d
I see a huge amount of 'No such file or directory' output. Is there a way to make find shut up if it doesn't find anything?
Try this:
find /users/dan/ -name 'Prams' -type d 2>/dev/null
You can suppress the STDERR output:
find /users/dan/ -name 'Prams' -type d 2> /dev/null
Or you can use find to show all directories and filter its output with grep:
find /users/dan -type d | grep "Prams"
The find command won't print "no such file or directory" if the search path (/users/dan, in this case) exists, even if there are no matches. Are you sure this directory exists?
His syntax is correct if indeed /users/dan/ < exists in the first place!
There should be no 'No such file or directory' outputs in the first place.
find $HOME -name 'Prams' -type d