Linux command: tail -f --- switch pages when viewing real-time log and exit

Use tail -f to see the log information is constantly updated,

tail -f xxx.log

However, real-time monitoring of log information, how to make information constantly refresh the page to switch? How to exit to the command line it? Pause need to see how the output of the details of it?

First, tail command itself does not provide a pause function.

If there is a need to output to a log file to go, and then use more / less command to view

If you are switching to running in the background, using the Ctrl+z
then fg command tail command to the foreground to continue viewing.

[root@localhost ~]#fg %工作号

Note that, when using this command,% can be omitted, but if all omitted% job number, this command will work with a + sign is restored to the foreground. Further, the process of this command, the optional%.

Here Insert Picture Description

[1]+ Stopped top
[2]- ./xxxxx( Stopped tar-zcf etc.tar.gz/etc)
[root@localhost ~]# fg
#恢复“+”标志的工作,也就是tar命令
[root@localhost ~]# fg %1
#恢复1号工作,也就是top命令

The top command is not performed in the background, so if you want to abort the top command, or revert top command to the front, and then gracefully exit; or find the top command of the PID, use the kill command

kill -9 pid

Kill the process.

ctrl + c drop out

Published 79 original articles · won praise 7 · views 30000 +

Guess you like

Origin blog.csdn.net/weixin_44037416/article/details/104812450