find /path/to/dir -name "search-patter" 2>&1 | grep -v "Permission denied" > output-file find /etc -name "x*.conf" 2>&1 | grep -v "Permission denied" > output.txt