The Unix system has several commands that enable the user to determine the other users of the system. These commands help keep track of individuals who use the system and their activities.
The first set of commands lists down all users who are presently logged in. These commands can be used to identify the ones whom the user can work and interact with in the system.
The “w” command shows the number of users and the load average in the system. This is useful for those who want to have as much detail about the other users as possible.
The “who” command is a more concise version of the “w” command. The “who” command drops the column headers and shows data about the users only.
The “users” command lists down only the names of users who are logged in.
Apart from these, Unix also has commands for listing down all Unix users. These commands will even show the ones who are not logged in. Through the following set of commands, one can track the history of all users who have handled the Unix system for reference purposes.
To list down all the users, one can enter the following command:
This command will access the system’s password file, which contains the information about all Unix users. The “cat /etc/passwd” command will list down the user names and real names of Unix users.
Finally, to see only one field from the file, you can use the “cut” command. For example, this will show only the user names:
cat /etc/passwd | cut -d: -f1