60
45

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Linux / Unix | 標準エラー出力を捨てる

Last updated at Posted at 2016-03-08

次でOK。

[command] 2>/dev/null

この場合。

標準エラー出力 だけを捨てるので。
標準出力 はそのまま使える。

たとえば特定のファイルを探したい場合。

普通にコマンドを打つと。
権限がないディレクトリに対して、たくさん警告される。

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

標準エラー出力を捨てれば、欲しい結果だけを得られる。

find / -name example.txt 2>/dev/null

/tmp/example.txt
/var/example.txt

参考

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

メンター受付

60
45
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
60
45

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?