How to get list of users in Linux

The /etc/passwd file is used to keep track of every registered user that has access to a system. Sometimes, we want to know the list of local users. If we want to get list of users in terminal, run below command.

cut -d: -f1 /etc/passwd

If we want to save this output in file, then run following command on terminal.

cut -d: -f1 /etc/passwd > userslist.txt

You can also use following commands. But, above will give us only names of users.
cat /etc/passwd
getent passwd
more /etc/passwd
less /etc/passwd

For complete Linux Tutorials, visit Linux Tutorials

Related Posts

Responses are currently closed, but you can trackback from your own site.

Comments are closed.

Powered by k2schools
%d bloggers like this: