How to list all the users in Ubuntu

One of the easiest ways to list all the users in Ubuntu or linux is to read the passwd file. The following command will output the passwd file and list all the users in the system.

cat /etc/passwd

You will of course need to be root or need sudo privileges.