linux-查看最后登陆last和history历史记录操做

history

查看

historyweb

[root@docker229 ~]# history
    1  history
    2  history -r
    3  history
    4  last

查看最近的n条历史记录

history n
n为查看的记录数docker

[root@docker229 ~]# history 2
    7  history
    8  history 2

清楚全部历史记录

history -c

查看最后操做记录

Linux下清理删除last登陆日志 http://www.noobyard.com/article/p-khpzanox-cc.htmlapache

last

[root@docker229 ~]# last
root     pts/1        192.168.57.40    Sat Mar 16 17:20   still logged in   
root     pts/0        192.168.57.40    Sat Mar 16 17:19   still logged in   
root     pts/0        192.168.57.40    Thu Mar 14 23:39 - 01:24  (01:44)    
root     tty1                          Thu Mar 14 23:36   still logged in   
reboot   system boot  3.10.0-327.el7.x Thu Mar 14 23:36 - 17:28 (1+17:51)   

wtmp begins Thu Mar 14 23:36:32 2019

lastb

[root@docker229 ~]# lastb
root     ssh:notty    192.168.57.40    Sat Mar 16 17:19 - 17:19  (00:00)    
root     ssh:notty    192.168.57.40    Thu Mar 14 23:39 - 23:39  (00:00)    

btmp begins Thu Mar 14 23:39:39 2019

lastlog

[root@docker229 ~]# lastlog
用户名           端口     来自             最后登录时间
root             pts/1    192.168.57.40    六 3月 16 17:20:19 +0800 2019
bin                                        **从未登陆过**
daemon                                     **从未登陆过**
adm                                        **从未登陆过**
lp                                         **从未登陆过**
sync                                       **从未登陆过**
shutdown                                   **从未登陆过**
halt                                       **从未登陆过**
mail                                       **从未登陆过**
operator                                   **从未登陆过**
games                                      **从未登陆过**
ftp                                        **从未登陆过**
nobody                                     **从未登陆过**
avahi-autoipd                              **从未登陆过**
systemd-bus-proxy                           **从未登陆过**
systemd-network                            **从未登陆过**
dbus                                       **从未登陆过**
polkitd                                    **从未登陆过**
apache                                     **从未登陆过**
abrt                                       **从未登陆过**
libstoragemgmt                             **从未登陆过**
tss                                        **从未登陆过**
postfix                                    **从未登陆过**
chrony                                     **从未登陆过**
sshd                                       **从未登陆过**
ntp                                        **从未登陆过**
tcpdump                                    **从未登陆过**