file echo su stdout?


0

Ho un processo che registra l'output in log.txt. Se voglio vedere lo stato del processo in tempo reale, c'è un modo per echeggiare l'output su stdout invece di aprire il registro in un editor di testo e ricaricarlo costantemente?

Risposte:


7

Per una soluzione davvero semplice al Terminal:

% tail -f log_file.log

Dal file di coda (cioè 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.

2

utilizzare tail -fper visualizzare la fine di un file e "seguirlo" man mano che cresce.


2

Uso:

tail -f log.txt

o in un sapore diverso:

watch tail log.txt
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.