首页

last

last
功能说明:列出目前与过去登入系统的用户相关信息。
语  法:last [-adRx][-f <记录文件>][-n <显示列数>][帐号名称...][终端机编号...]
补充说明:单独执行last指令,它会读取位于/var/log目录下,名称为wtmp的文件,并把该给文件的内容记录的登入系统的用户名单全部显示出来。
参  数:
 -a  把从何处登入系统的主机名称或IP地址,显示在最后一行。 
 -d  将IP地址转换成主机名称。 
 -f <记录文件>  指定记录文件。 
 -n <显示列数>或-<显示列数>  设置列出名单的显示列数。 
 -R  不显示登入系统的主机名称或IP地址。 
 -x  显示系统关机,重新开机,以及执行等级的改变等信息。

last

last [options] [username] [ttynumber]

Display a list of the most recent logins, taken from the file /var/log/wtmp by default. If you specify a tty number or username, the output will display only the logins for that user or terminal.

Options

-n number, -number

Choose how many lines of logins to display. Thus, last -7 or last -n 7 displays seven lines.

-R

Do not show the hostname from which logins originated.

-a

Display the hostname from which logins originated.

-d

Display both IP address and hostname.

-f filename

Get the list of logins from a file you choose. The default source is /var/log/wtmp.

-i

Display IP address and hostname. Display the IP address in the numbers-and-dots notation.

-o

Read an old-style (libc5 application) wtmp file. Not likely to be useful on newer systems.

-x

Display shutdown messages and runlevel messages.