Chimu
1
Trying to run find command on Linux
find /dir1 -name "*.bak" -print
Getting Permission denied messages:
find: ‘/dir1/lobby.conf’: Permission denied
find: ‘/dir1/images’: Permission denied
find: ‘/dir1/nginx.conf’: Permission denied
Is there is a way to find and grep permission. I just need to hide Permission denied messages but show all other errors on screen.
Chimu
2
Never mind, I found solution. It was pretty simple:
### find grep permission denied ###
find /dir1 -name "*.bak" -print 2>&1 | grep -v "Permission denied"
find /dir1 -name "*.bak" -print 2>&1 | grep -v "Permission denied" > list.txt
vi list.txt
more list.txt
Source
https://www.cyberciti.biz/faq/bash-find-exclude-all-permission-denied-messages/