1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Linuxでログイン中のユーザーを調べる

Posted at

はじめに

Linuxでログイン中,ログイン状態にあるユーザーについて調べるコマンドを紹介します

調べ方

w コマンド

w
出力
11:23:25 up 20 days, 22:02,  4 users,  load average: 1.66, 2.02, 2.03
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
AAA    pts/44   tmux(468300).%0  1610月24  5days  8days  8days /AAA/XXX.py
BBB    pts/113  192.XXX.XXX.XXX  月14    3:32   0.02s  0.02s -bash

who コマンド

who
出力
AAA    pts/44       2024-10-16 21:05 (tmux(468300).%0)
BBB    pts/113      2024-10-28 14:58 (192.XXX.XXX.XXX)

users コマンド

users
出力
AAA BBB

last コマンド

last | grep "still logged in"
出力
BBB    pts/113      192.XXX.XXX.XXX  Mon Oct 28 14:58   still logged in
AAA    pts/44       tmux(468300).%0  Wed Oct 16 21:05   still logged in

finger コマンド

インストールしていないので未検証ですが,fingerコマンドというコマンドもあるようです.

finger

おまけ

現在自分がログインしているユーザーを確認する方法

whoami
who -m
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?