файл эха к stdout?

У меня есть процесс, который регистрирует вывод к log.txt. Если я хочу видеть состояние процесса в режиме реального времени, есть ли способ повторить тот вывод к stdout вместо того, чтобы открыть журнал в текстовом редакторе и постоянно перезагрузить?

1
задан 26.09.2010, 21:59

3 ответа

Для действительно простого решения на Терминале:

% tail -f log_file.log

От хвоста mainfile (т.е. man tail):

 -f      The -f option causes tail to not stop when end of file is reached,
         but rather to wait for additional data to be appended to the input.
         The -f option is ignored if the standard input is a pipe, but not if
         it is a FIFO.

 -F      The -F option implies the -f option, but tail will also check to see
         if the file being followed has been renamed or rotated.  The file is
         closed and reopened when tail detects that the filename being read
         from has a new inode number.  The -F option is ignored if reading
         from standard input rather than a file.
7
ответ дан 12.12.2019, 07:42

использовать tail -f отобразить конец файла и "следовать" за ним, когда это растет.

2
ответ дан 12.12.2019, 07:42

Использование:

tail -f log.txt

или в другой разновидности:

watch tail log.txt
2
ответ дан 12.12.2019, 07:42

Теги

Похожие вопросы