linux系统日志和screen

linux系统日志

系统重要日志

  • /var/log/messages :系统内核 重启 yum安装

  • /var/log/wtmp : 用户登录历史

    ,命令 last 查看

  • /var/log/btmp : 无效,失败的登录历史

    ,lastb 查看

  • /var/log/maillog : 邮件日志

  • /var/log/secure : 验证相关日志

  • /var/log/dmesg : 系统启动过程中硬件日志

    ,而命令dmesg :获取硬件错误信息

  • /etc/logrotate.conf 日志切割配置文件

参考:https://my.oschina.net/u/2000675/blog/908189

linux screen 工具

screen 是linux下的虚拟终端,它可以用于linux命令任务的长时间执行而不会意外中断。

我们也可以使用nohup command &

[root@localhost ~]# rm -fr nohup.out 
[root@localhost ~]# 
[root@localhost ~]# nohup ping www.baidu.com -w 1 &
[1] 1919
[root@localhost ~]# nohup: 忽略输入并把输出追加到"nohup.out"

[1]+  完成                  nohup ping www.baidu.com -w 1
[root@localhost ~]# cat nohup.out 
PING www.a.shifen.com (115.239.210.27) 56(84) bytes of data.
64 bytes from 115.239.210.27 (115.239.210.27): icmp_seq=1 ttl=128 time=14.1 ms

--- www.a.shifen.com ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 14.149/14.149/14.149/0.000 ms
[root@localhost ~]#

使用screen: yum install -y screen

  • screen 直接回车就进入了虚拟终端

    ,ctrl + a组合键再按d退出虚拟终端,但不是结束

  • screen -ls 查看虚拟终端列表

  • screen -r id 进入指定的终端

  • screen -S test :指定终端名称

  • screen -r test :进入指定终端

最后更新于

这有帮助吗?