How to list all users and human users in Ubuntu terminal

You do not have to use a GUI application to see all the users on your system. You can do this using the command line application in your terminal. You can use the following command to list all system-generated, human-created, or regular Linux users. There are many options. Try all the commands in the terminal and find the difference. If you have other options available, please let us know in the comments.

List all Ubuntu users.

cat /etc/passwd
getent passwd
less /etc/passwd
more /etc/passwd

The following command shows only the user name.

compgen -u
cut -d: -f1 /etc/passwd
awk -F':' '{ print $1}' /etc/passwd

List all Human or Normal users on Ubuntu.

cut -d: -f1,3 /etc/passwd | egrep ':[0-9]{4}$' | cut -d: -f1
awk -F'[/:]' '{if ($3 >= 1000 && $3 != 65534) print $1}' /etc/passwd

The following hack is not the right method, but it works in most situations.

getent passwd $(ls /home) | grep -o '^[^:]*'
ls /home

If you like this article, please subscribe to us Youtube channel.. You can also stay connected with us twitter And Facebook..

Recommended Recommendation: How to Install RawTherapee on Ubuntu-Raw Image Editing Tool
It’s a sequel.
..

Sidebar