linux使用者登入查詢與對話

來源:互聯網
上載者:User

[轉]

 

查詢當前登入系統的使用者 who
[root@lyy ~]# who
root     tty1         2010-12-09 19:16
root     pts/0        2010-12-09 19:29 (192.168.197.1)
第一列 登入的使用者
第二列終端名
第三列 登入時間
查詢每個使用者最近登入時間 lastlog
[root@lyy ~]# lastlog
使用者名稱         連接埠     來自             最後登陸時間
root             pts/0    192.168.197.1    四 12月 9 19:29:15 +0800 2010
bin                                        **從未登入過**
daemon                                     **從未登入過**
pcca             tty1                      二 12月 7 22:09:21 +0800 2010
pcca1            tty1                      二 12月 7 22:09:26 +0800 2010
pcca2                                      **從未登入過**
lastlog會從/var/log/lastlog檔案中把資料讀取出來
使用者之間對話 write
格式:write 使用者 終端介面
例:使用者pc 發送資訊給使用者 pcca
1.在pc終端上查看pcca終端的介面
[pc@lyy ~]$ who
root     tty1         2010-12-09 19:16
pcca     pts/0        2010-12-09 19:34 (192.168.197.1)       # pcca終端介面為pts/0
pc       pts/1        2010-12-09 19:37 (192.168.197.1)
2.利用write發送資訊 hello world
[pc@lyy ~]$ write pcca  pts/0
hello world!!!
[pc@lyy ~]$
輸入完成後按 Ctrl+d 來結束。
3.看pcca終端的情況
[pcca@lyy ~]$
Message from pc@lyy on pts/1 at 19:42 ...
hello world!!!
EOF
如果不想接受資訊可以用 mesg n 來關閉,除root外的資訊不接收。
對所有登入的使用者發送廣播資訊 wall
[pc@lyy ~]$ wall "I will shutdown my linux server."
Broadcast message from pc (pts/1) (Thu Dec  9 19:47:35 2010):
I will shutdown my linux server.
這樣所有的人都可以收到了。

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.