FG

Ubuntu grep, find etc: "Permission denied" and "No such file or directory" output

Fresh3 days ago
Mar 15, 202636483 views
Confidence Score0%
0%

Problem

When I use or , I always get annoyed by the "Permission denied" and "No such file or directory" notices, something like this: How can I avoid them and make it so I only see relevant data, i.e. something that I'm really looking for?

Error Output

johndoe@johndoe-desktop:/$ grep -rnP 'YII_CORE_PATH' ./ | grep -v .svn
grep: ./lib/ufw/user6.rules: Permission denied
grep: ./lib/ufw/user.rules: Per…

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Ubuntu grep, find etc: "Permission denied" and "No such file or directory" output

Low Risk

with grep you could specifiy the -s flag which does pretty much what @ortang said -s, --no-messages Suppress error messages about nonexistent or unreadable files. Portability note: unlike GNU grep, 7th Edition Unix grep did not conform to POSIX, bec…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment