List all users in Ubuntu 20.04


Published on 02 March 2022


List all users in Ubuntu 20.04

Users are basic in any Linux system since with them we log in and we can perform tasks based on the permissions that have been assigned (administration, reading, writing) and based on this, these users will have certain authority in the system.
It is important to know the users that we have registered within a team, especially if we want to unsubscribe those that are not operational. Also on a personal level it is important to know how many users we have created to remove those who are not performing any function in the system.
In the file /etc/passwd is all the information of the users. We will use the cat command inside the Ubuntu terminal to know the content of this file:

sudo cat /etc/passwd

The content of this file gives us information in each line of each user, where each field explained below is separated by a colon:

  1. Current username
  2. Encrypted password (the letter x indicates that the password is stored in the /etc/shadow file)
  3. User Identification Number (UID)
  4. User Group Identification Number (GID)
  5. Full user name (GECOS)
  6. User home directory
  7. Login shell (defaults to /bin/bash)

In case we do not want to access so many details but only see the username, the cut command shows only the first field (username) as follows:

cut -d: -f1 /etc/passwd

Below we show an image with a list of users in Ubuntu, each one separated by a line and with their fields separated by colons:

List users Ubuntu


Tips on SEO and Online Business

Next Articles

Previous Articles