Linux last命令詳解 Linux last命令怎麼用

來源:互聯網
上載者:User

使用許可權:所有使用者。

文法

shell>> last [options]

參數說明:

  • -R 省略 hostname 的欄位
  • -num 展示前 num 個
  • username 展示 username 的登入訊息
  • tty 限制登入訊息包含終端機代號

執行個體

shell>> last -R -2

johnney pts/1 Mon Aug 14 20:42 still logged in

johnney pts/0 Mon Aug 14 19:59 still logged in

wtmp begins Tue Aug 1 09:01:10 2000 ### /var/log/wtmp

shell>> last -2 minery

minery pts/0 140.119.217.115 Mon Aug 14 18:37 - 18:40 (00:03)

minery pts/0 140.119.217.115 Mon Aug 14 17:22 - 17:24 (00:02)

wtmp begins Tue Aug 1 09:01:10 2000

一般顯示方法

# last

簡略顯示,並指定顯示的個數

# last -n 5 -R

root pts/4 Thu May 13 17:25 still logged in

root pts/2 Thu May 13 17:23 - 17:25 (00:02)

root pts/1 Thu May 13 16:46 still logged in

root pts/7 Thu May 13 15:36 still logged in

root pts/9 Thu May 13 15:35 still logged in

wtmp begins Thu May 13 18:55:40 2014

顯示最後一列顯示主機IP地址

# last -n 5 -a -i

root pts/4 Thu May 13 17:25 still logged in 192.168.1.10

root pts/2 Thu May 13 17:23 - 17:25 (00:02) 192.168.1.10

root pts/1 Thu May 13 16:46 still logged in 192.168.1.10

root pts/7 Thu May 13 15:36 still logged in 192.168.1.10

root pts/9 Thu May 13 15:35 still logged in 192.168.1.10

wtmp begins Thu May 13 18:55:40 2014

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.