How to view all users in Linux

In Linux, you can use the following command to view all users:

  1. display the content of the file /etc/passwd
cat /etc/passwd
  1. Extract the first field from the /etc/passwd file using a delimiter of “:”.
cut -d: -f1 /etc/passwd
  1. Retrieve user information
getent passwd
  1. Extract the first field from the /etc/passwd file using the delimiter “:”
awk -F: '{print $1}' /etc/passwd

These commands can be executed in the terminal to view information of all users in the system.

Leave a Reply 0

Your email address will not be published. Required fields are marked *