Ubuntu – list all local/system users

Reading Time: 1 minute
$ cut -d: -f1 /etc/passwd

Explanation

cut OPTION... [FILE]... – print selected parts of lines from each FILE to standard output. With no FILE, or when FILE is -, read standard input. Arguments:

  • -d, --delimiter=DELIM – use DELIM instead of TAB for field delimiter. In our case the delimiter is :.
  • -f, --fields=LIST – select only these fields; also print any line that contains no delimiter character, unless the -s option is specified. In our case the field list contains only one field, 1, meaning that the cut command will print the first field resulted after splitting the line by the delimiter. If we need more fields printed we just list them all separated by comma e.g. cut -d: -f1,5,6 /etc/passwd.

We transform challenges into digital experiences

Get in touch to let us know what you’re looking for. Our policy includes 14 days risk-free!

Free project consultation