find / -name [FILE] 2>&1 | grep -v 'Permission denied'

Signed-off-by: deinonychus <deinonychus@users.noreply.github.com>
This commit is contained in:
deinonychus 2024-07-23 10:06:02 +02:00 committed by GitHub
parent de6733d5a9
commit 8bf41a1135
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1034,6 +1034,16 @@ find . -type f -empty -delete
find . -type f | wc -l 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 ## Condition and loop
[[back to top](#handy-bash-one-liners)] [[back to top](#handy-bash-one-liners)]