🖥
Linux / Unix | Discard standard error
OK next.
[command] 2>/dev/null
in this case.
Because only the standard error output is discarded. Standard output can be used as it is.
Example
For example, if you want to find a specific file.
If you type a command normally. You will be warned a lot about directories that you don't have permission to.
find / -name example.txt find: `/etc/directory1': Permission denied find: `/etc/directory2': Permission denied find: `/etc/directory3': Permission denied find: `/etc/directory4': Permission denied find: `/etc/directory5': Permission denied
If you discard the standard error output, you get only the results you want.
find / -name example.txt 2>/dev/null /tmp/example.txt /var/example.txt
reference
Original by
About
チャットメンバー募集
何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。
公開日時
2019-04-16
Discussion