3
2

More than 5 years have passed since last update.

linux > ファイルの追記をチェックする > tail -f

Last updated at Posted at 2015-01-09

動作環境: CentOS 6.5 + bash

tail -f log.txtとするとlog.txtに追記されるたびにその内容がターミナルに表示される。

使い道としては、あるファイルに定期的に追記する処理が走っている時にtail -f log.txtしておいてその追記分を確認するという感じ。



動作確認としては、1つのターミナルでtail -f log.txtしておいて、別のターミナルでecho "test" >> log.txtすると、tail -f側のターミナルでtestが表示される。

ただし、tail -fは既存ファイルに対して実行でき、ファイルがない場合はエラーとなる。

3
2
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
3
2