cut -d: -f1,3 /etc/passwd

Category: Administration

cut -d: -f1,3 /etc/passwd

Extract specific fields from a file

cut -d: sets the delimiter to a colon and -f1,3 keeps only the first and third fields, so /etc/passwd yields username and UID pairs. Field lists accept ranges such as 2-5 and commas mixed with ranges. Pair with sort or uniq to analyze columnar data.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.