Linux who
Command – Check Logged-in Users
The who
command in Linux is used to display information about users who are currently logged into the system. It provides details such as usernames, terminal sessions, login times, and IP addresses.
Syntax
By default, running who
without options lists all logged-in users.
Example Usage
1. List All Logged-in Users
Example output:
john
is logged in on the local terminal (tty1
).alice
is connected via SSH (pts/0
) from IP192.168.1.100
.- The third column shows the login time.
2. Display User Count
To see the number of users currently logged in:
Example output:
This shows two active users.
3. Show Login Details with Headers
To display a detailed view with column headers:
Example output:
4. Show Last System Boot Time
To check when the system was last booted:
Example output:
5. Display Active Processes Started by Users
To see user processes:
Example output:
- The last column shows the process ID (PID) of the user session.
6. Check Current Runlevel
To display the current system runlevel:
Example output:
This indicates the system is running in graphical mode (runlevel 5
).
7. Check Dead Processes
To view processes that have died:
Difference Between who
, whoami
, and w
Command | Description |
---|---|
who | Lists all logged-in users with session details. |
whoami | Displays the current user's username. |
w | Shows logged-in users along with their active processes and system load. |
Conclusion
The who
command is useful for monitoring logged-in users, system uptime, and session details. It is commonly used by system administrators for security auditing and session tracking.
Would you like additional details or modifications for SEO optimization? 🚀