Text processing is a very important skill for a Linux sysadmin.

On Linux /etc/passwd is a configuration file that contains user information. It has several fields defined.

Maybe you want to get a list of all users from the /etc/passwd file. Here is the command that can do it.

cut -d : -f 1 /etc/passwd
Filtering Specific Fields with cut

And here is the output of that command:

root
daemon
bin
sys
sync
games
man
lp
mail
news
uucp
proxy
www-data
backup
list
irc
gnats
nobody
systemd-network
systemd-resolve
syslog
messagebus
_apt
lxd
uuidd
dnsmasq
landscape
sshd
pollinate
johndoe
mysql
nginx
Output of the cut command

You can pipe it to sort to get a nice alphabetical order, like this:

cut -f 1 -d : /etc/passwd | sort

The awk command can also be used.

awk -F : '{print $1}' /etc/passwd

That's it. As always, there is a bazillion of ways to do this on the Linux command line. I like this cut way. I still don't know where this might be useful in practice but at least it's good to know how to do it.