head 用于显示文件前面的部分,默认情况下它输出前 10 行。你可以使用 -n 标志来指定显示的行数:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
tecmint@TecMint ~ $ head /var/log/auth.log Jan210:45:01 TecMint CRON[3383]: pam_unix(cron:session): session opened for user root by (uid=0) Jan210:45:01 TecMint CRON[3383]: pam_unix(cron:session): session closed for user root Jan210:51:34 TecMint sudo: tecmint : TTY=unknown ; PWD=/home/tecmint ; USER=root ; COMMAND=/usr/lib/linuxmint/mintUpdate/checkAPT.py Jan210:51:34 TecMint sudo: pam_unix(sudo:session): session opened for user root by (uid=0) Jan210:51:39 TecMint sudo: pam_unix(sudo:session): session closed for user root Jan210:55:01 TecMint CRON[4099]: pam_unix(cron:session): session opened for user root by (uid=0) Jan210:55:01 TecMint CRON[4099]: pam_unix(cron:session): session closed for user root Jan211:05:01 TecMint CRON[4138]: pam_unix(cron:session): session opened for user root by (uid=0) Jan211:05:01 TecMint CRON[4138]: pam_unix(cron:session): session closed for user root Jan211:09:01 TecMint CRON[4146]: pam_unix(cron:session): session opened for user root by (uid=0) tecmint@TecMint ~ $ head -n 5 /var/log/auth.log Jan210:45:01 TecMint CRON[3383]: pam_unix(cron:session): session opened for user root by (uid=0) Jan210:45:01 TecMint CRON[3383]: pam_unix(cron:session): session closed for user root Jan210:51:34 TecMint sudo: tecmint : TTY=unknown ; PWD=/home/tecmint ; USER=root ; COMMAND=/usr/lib/linuxmint/mintUpdate/checkAPT.py Jan210:51:34 TecMint sudo: pam_unix(sudo:session): session opened for user root by (uid=0) Jan210:51:39 TecMint sudo: pam_unix(sudo:session): session closed for user root
tecmint@TecMint ~ $ tail -n 5 /var/log/auth.log Jan613:01:27 TecMint sshd[1269]: Server listening on0.0.0.0 port 22. Jan613:01:27 TecMint sshd[1269]: Server listening on :: port 22. Jan613:01:27 TecMint sshd[1269]: Received SIGHUP; restarting. Jan613:01:27 TecMint sshd[1269]: Server listening on0.0.0.0 port 22. Jan613:01:27 TecMint sshd[1269]: Server listening on :: port 22.
tecmint@TecMint ~ $ tail -f /var/log/auth.log Jan612:58:01 TecMint sshd[1269]: Server listening on :: port 22. Jan612:58:11 TecMint sshd[1269]: Received SIGHUP; restarting. Jan612:58:12 TecMint sshd[1269]: Server listening on0.0.0.0 port 22. Jan612:58:12 TecMint sshd[1269]: Server listening on :: port 22. Jan613:01:27 TecMint sshd[1269]: Received SIGHUP; restarting. Jan613:01:27 TecMint sshd[1269]: Server listening on0.0.0.0 port 22. Jan613:01:27 TecMint sshd[1269]: Server listening on :: port 22. Jan613:01:27 TecMint sshd[1269]: Received SIGHUP; restarting. Jan613:01:27 TecMint sshd[1269]: Server listening on0.0.0.0 port 22. Jan613:01:27 TecMint sshd[1269]: Server listening on :: port 22.
tecmint@TecMint ~ $ dpkg -l | pr --columns 3 -l 20 2017-01-0613:19 Page 1 Desired=Unknown/Install ii adduser ii apg | Status=Not/Inst/Conf- ii adwaita-icon-theme ii app-install-data |/ Err?=(none)/Reinst-r ii adwaita-icon-theme- ii apparmor ||/ Name ii alsa-base ii apt +++-=================== ii alsa-utils ii apt-clone ii accountsservice ii anacron ii apt-transport-https ii acl ii apache2 ii apt-utils ii acpi-support ii apache2-bin ii apt-xapian-index ii acpid ii apache2-data ii aptdaemon ii add-apt-key ii apache2-utils ii aptdaemon-data 2017-01-0613:19 Page 2 ii aptitude ii avahi-daemon ii bind9-host ii aptitude-common ii avahi-utils ii binfmt-support ii apturl ii aview ii binutils ii apturl-common ii banshee ii bison ii archdetect-deb ii baobab ii blt ii aspell ii base-files ii blueberry ii aspell-en ii base-passwd ii bluetooth ii at-spi2-core ii bash ii bluez ii attr ii bash-completion ii bluez-cups ii avahi-autoipd ii bc ii bluez-obexd .....