How to view the list of users on Linux

The following command can be used in a Linux system to view a list of users,

  1. Use the cat command to view the /etc/passwd file, which contains information about all users.
  2. Display the contents of the passwd file.
  3. View the username column in the /etc/passwd file using the cut command with a delimiter.
  4. Extract the first field using a colon as the delimiter from the file /etc/passwd.
  5. Use the awk command with a delimiter to view the username column in the /etc/passwd file.
  6. Print the first field from /etc/passwd using awk with “:” as the delimiter.
  7. Use the getent command to view the list of users currently in the system.
  8. Retrieve user account information.

All the above commands require administrator privileges (such as sudo) to be executed.

bannerAds