15
5
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?
15
5
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?
21
Try this:
find /users/dan/ -name 'Prams' -type d 2>/dev/null
it says: find:paths must precede expression. I am running linux 2.6.9-67.0.7 – nulltorpedo – 2012-02-25T01:32:29.773
which flavor: can you run uname -a
– Book Of Zeus – 2012-02-25T01:38:03.470
Linux machine-3 2.6.9-67.0.7.ELsmp #1 SMP Wed Feb 27 04:47:23 EST 2008 x86_64 x86_64 x86_64 GNU/Linux – nulltorpedo – 2012-02-25T01:40:32.260
this worked for me: find /users/dan/ -name 'Prams' -type d | tee log – nulltorpedo – 2012-02-25T01:40:47.767
interesting, this didn't work for me – Book Of Zeus – 2012-02-25T01:42:45.290
I am at a work machine. could be a lot of custom tools/distros, so i am not surprised – nulltorpedo – 2012-02-25T01:46:53.343
probably, I am using Ubuntu which is probably different from yours – Book Of Zeus – 2012-02-25T01:51:08.777
2
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?
0
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
this worked for me: find /users/dan/ -name 'Prams' -type d | tee log – nulltorpedo – 2012-02-25T01:41:58.263
1the pipe without ampersand only outputs std output. If it was |& log, it will print those errors as well. – nulltorpedo – 2012-02-25T01:42:32.883