$ tail -5 a 16 17 18 19 20 $ tail -n3 a 18 19 20 # 显示文件后3行并且显示文件名 $ tail -vn3 a b ==> a <== 18 19 20
==> b <== 18 19 20
# 实时显示文件新增内容 $ tail -f /var/log/messages Feb 8 15:00:01 centos7 systemd: Started Session 18 of user root. Feb 8 15:00:21 centos7 systemd: Time has been changed Feb 8 15:01:03 centos7 systemd: Started Session 19 of user root. Feb 8 15:01:27 centos7 systemd: Time has been changed Feb 8 15:02:33 centos7 systemd: Time has been changed
$ tailf /var/log/messages Feb 8 15:07:58 centos7 systemd: Time has been changed Feb 8 15:09:02 centos7 systemd: Time has been changed Feb 8 15:10:01 centos7 systemd: Started Session 20 of user root. Feb 8 15:10:05 centos7 systemd: Time has been changed