How to use W command in Linux ?
Linux
The W command in Linux is a command line utility that is used to display information about users who are currently logged into the system. It displays the username, login time, idle time, JCPU and PCPU times, and the host from which the user is logged in. This command is useful for monitoring user activity on a system, and can also be used to troubleshoot user issues or to ensure system security.
Here at Fixwebnode , we will look at how to use the W command in Linux with practical examples.
Table of contents [Show]
What is the syntax of W Command ?
The basic syntax of the W command is as follows:
$ w
This command will display a list of all the users currently logged into the system, along with their login time, idle time, JCPU and PCPU times, and the host from which the user is logged in.
When using the W command, there are several options that can be used to customize the output.
These options include:
- -u: Displays information about the currently logged in users.
- -s: Displays system load averages.
- -h: Display the help page.
Example of using W Command
The W command can be used to view detailed information about a particular user. To do this, you need to pass the username as an argument to the command.
$ w username
username pts/0 2023-03-20 09:17:49 - 0:00 1:00.41 0.44s 192.168.1.7
The W command can also be used to view information about the processes that a user is running. To do this, you need to pass the -p option to the command.
$ w -p username
username pts/0 2023-03-20 09:17:49 - 0:00 1:00.41 0.44s 192.168.1.7 bash
The W command can be used to view the system uptime. To do this, you need to pass the -s option to the command.
$ w -s
up 5 days, 3:41, 0 users, load average: 0.00, 0.00, 0.00
The W command can be used to view all the information about a user, including their login time, idle time, JCPU and PCPU times, and the host from which they are logged in. To do this, you need to pass the -a option to the command.
$ w -a username
username pts/0 2019-03-20 09:17:49 - 0:00 1:00.41 0.44s 192.168.1.7 bash 0.00s 0.00s
The W command can be used to view all the users that are logged in from a specific host. To do this, you need to pass the hostname as an argument to the command.
$ w hostname
username pts/0 2019-03-20 09:17:49 - 0:00 1:00.41 0.44s 192.168.1.7
[Need Technical Support ? We are available . ]