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

來源:互聯網
上載者:User

Linux who命令用於顯示系統中有哪些使用者正在上面,顯示的資料包含了使用者 ID、使用的終端機、從哪邊連上來的、上線時間、獃滯時間、CPU 使用量、動作等等。

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

文法

who - [husfV] [user]

參數說明:

  • -h : 不要顯示標題列
  • -u : 不要顯示使用者的動作/工作
  • -s : 使用簡短的格式來顯示
  • -f : 不要顯示使用者的上線位置
  • -V : 顯示程式版本

執行個體

顯示當前登入系統的使用者

# who //顯示當前登入系統的使用者

root tty7 2014-05-13 12:12 (:0)

root pts/0 2014-05-14 17:09 (:0.0)

root pts/1 2014-05-14 18:51 (192.168.1.17)

root pts/2 2014-05-14 19:48 (192.168.1.17)

顯示標題列

# who -H

NAME     LINE              TIME                             COMMENT

root         tty7            2014-05-13 12:12               (:0)

root         pts/0         2014-05-14 17:09             (:0.0)

root         pts/1         2014-05-14 18:51         (192.168.1.17)

root         pts/2         2014-05-14 19:48         (192.168.1.17)

顯示使用者登入來源

# who -l -H

NAME    LINE          TIME           IDLE     PID   COMMENT

LOGIN    tty4       2014-05-13   12:11    852      id=4

LOGIN    tty5       2014-05-13   12:11    855      id=5

LOGIN    tty2       2014-05-13   12:11    862      id=2

LOGIN    tty3       2014-05-13   12:11    864      id=3

LOGIN    tty6       2014-05-13   12:11    867      id=6

LOGIN    tty1       2014-05-13   12:11    1021    id=1

顯示終端屬性

# who -T -H

NAME     LINE        TIME                       COMMENT

root        + tty7      2014-05-13 12:12        (:0)

root        +pts/0    2014-05-14 17:09       (:0.0)

root        -pts/1     2014-05-14 18:51   (192.168.1.17)

root        -pts/2     2014-05-14 19:48   (192.168.1.17)

只顯示目前使用者

# who -m -H

NAME    LINE        TIME                        COMMENT

root        pts/1    2014-05-14 18:51   (192.168.1.17)

精簡模式顯示

# who -q

root root root root

# users=4

聯繫我們

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