tail 命令可用于查看文件的内容,有一个常用的参数 -f 常用于查阅正在改变的日志文件。
详细请查看 Linux tail 命令 | 菜鸟教程 命令说明。
wangyetao@wangyetao-Lenovo-G510:~$ cat .bash_history | tail
#1606323153
gedit .profile
#1606323246
export HISTTIMEFORMAT="%F %T `whoami` "
#1606323252
history | tail
#1606323266
export HISTTIMEFORMAT="%F %T `whoami` "
#1606323268
history | tail
wangyetao@wangyetao-Lenovo-G510:~$ cat .bash_history | tail -n 11
source .profile
#1606323153
gedit .profile
#1606323246
export HISTTIMEFORMAT="%F %T `whoami` "
#1606323252
history | tail
#1606323266
export HISTTIMEFORMAT="%F %T `whoami` "
#1606323268
history | tail
wangyetao@wangyetao-Lenovo-G510:~$
tail -n 100 /etc/cron #显示最后100行数据
tail -n -100 /etc/cron #除了前99行不显示外,显示第100行到末尾行