From 8bf41a11355741d6d93be2a752ad396ce1aa69a6 Mon Sep 17 00:00:00 2001 From: deinonychus Date: Tue, 23 Jul 2024 10:06:02 +0200 Subject: [PATCH] find / -name [FILE] 2>&1 | grep -v 'Permission denied' Signed-off-by: deinonychus --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index b1babb4..e2617ac 100644 --- a/README.md +++ b/README.md @@ -1034,6 +1034,16 @@ find . -type f -empty -delete find . -type f | wc -l ``` +##### List all files with name [FILE] under / +```bash +find / -name [FILE] 2>&1 | grep -v 'Permission denied' + +# 2>&1 redirects STDERR outputs to STDOUT which is piped +# to the grep inverse filter (-v) filter command. +# Thus, any errors are surpressed, mainly due to access attempts +# on priviliged directories. +``` + ## Condition and loop [[back to top](#handy-bash-one-liners)]