English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The tail command can be used to view the content of a file, with a commonly used parameter -f is commonly used to view changing log files.
tail -f filename will display the latest content of the file filename at the bottom of the screen and refresh continuously as long as the filename is updated.
Command Format:
tail [parameters] [file]
Parameters:
-f Cyclic reading
-q Do not display processing information
-v Display detailed processing information
-c<number> Display the number of bytes
-n<line number> Display the last n lines of the file content
--pid=PID and-fused, indicating that the process will end after the process ID, PID, dies
-q, --quiet, --silent Never outputs the prefix of the file name
-s, --sleep-interval=S and-fused, indicating that the process will sleep for S seconds at each repeated interval
Example
To display the last 10 lines, please enter the following command:
tail notes.log
To track the growth of the file named notes.log, please enter the following command:
tail -f notes.log
) this command displays the last 10 ) combination key to stop the display. When certain lines are added to the notes.log file, the tail command will continue to display these lines. The display will continue until you press (Ctrl-Press the (Ctrl
Display the content of the file notes.log, starting from the 20 lines to the end of the file:
tail -n +20 notes.log
Display the last 10 Characters:
tail -c 10 notes.log