Linux command
w 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Show who is logged in
w
Show without header
w -h
Show for specific user
w [username]
Short format
w -s
Show IP addresses
w -i
说明
w displays information about currently logged-in users and their processes. The first line shows current time, system uptime, number of users, and load averages (same as uptime output). Each subsequent line shows one logged-in user with their terminal, login time, idle time, CPU usage, and current activity. This gives a quick overview of system usage and user activity. The "WHAT" column shows the current foreground process for each user, useful for seeing what people are running. Idle time shows how long since the user's last terminal activity—useful for identifying inactive sessions.
参数
- -h, --no-header
- Don't print the header line
- -s, --short
- Short format; don't print login time, JCPU, or PCPU
- -f, --from
- Toggle printing the FROM (remote host) field
- -i, --ip-addr
- Display IP addresses instead of hostnames
- -o, --old-style
- Old style output (space-separated)
- -u, --no-current
- Ignore username while calculating current process times
FAQ
What is the w command used for?
w displays information about currently logged-in users and their processes. The first line shows current time, system uptime, number of users, and load averages (same as uptime output). Each subsequent line shows one logged-in user with their terminal, login time, idle time, CPU usage, and current activity. This gives a quick overview of system usage and user activity. The "WHAT" column shows the current foreground process for each user, useful for seeing what people are running. Idle time shows how long since the user's last terminal activity—useful for identifying inactive sessions.
How do I run a basic w example?
Run `w` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -h, --no-header do in w?
Don't print the header line