LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Exclude "Permission denied" files for "ls -al" (https://www.linuxquestions.org/questions/linux-newbie-8/exclude-permission-denied-files-for-ls-al-847471/)

grob115 11-30-2010 10:07 AM

Exclude "Permission denied" files for "ls -al"
 
Sometimes when I do "ls -al" I am given a list of files with Permission Denied messages. If I do "ls -al | grep -v 'Permission'" it'd still list them on the screen. Is there anyway to stop this?

I want to be able to do this ultimately but not when it keeps giving me these Permission Denied file names.
find . -user 'username' -exec rm -rf '{}'\;

GrapefruiTgirl 11-30-2010 10:09 AM

Maybe dump the error messages to /dev/null (outer space!):
Code:

la -al 2>/dev/null
Of course, this will hide errors that you may be interested in too (it will toss all errors in the trash).

grail 11-30-2010 10:10 AM

Well the question you have to ask yourself is where are the error messages being delivered to, remembering that a pipe by default delivers stdout to the stdin of the next command.

grob115 12-03-2010 09:45 AM

Ah thanks thought the pipe command sends everything (both stdout and error) to the next command.


All times are GMT -5. The time now is 08:41 AM.