cut
pick out columnscut keeps part of every line and discards the rest. Tell it the separator with -d and the fields wanted with -f, and a file with columns is reduced to just the ones you asked for.
-d names the separator, -f names the fields. Fields count from 1.
At the terminal
Read the session first, then the notes: each numbered line in the output is answered by the note with the same number.
What the numbered lines are telling you
/etc/passwd separates its fields with colons, and the first is the account name. This lists every user.
Fields 1 and 7: the name and the login shell. The colon between them is preserved in the output.
2-3 means the second to the third. With -d, the same works on a CSV file.
Switches
A switch changes how the command behaves. These are the ones used day to day; man cut lists the rest. Single-letter switches can usually be joined, so -l -a may be written -la.
-d CHAR- Use this character as the field separator instead of a tab.
-f LIST- Select these fields: 1,3 or 2-4 or 3-.
-c LIST- Select these character positions.
-s- Skip lines that do not contain the separator.
--complement- Print everything except the selected fields.
Variations worth knowing
The same tool, pointed at a narrower question. These four cover most of what it is reached for day to day.
cut -c 1-80 long.txtKeeps the first 80 characters of each line.
cut -d" " -f1 access.logTakes the first space-separated field: the client address.
cut -f2 data.tsvWith no -d, fields are separated by tabs.
echo $PATH | cut -d: -f1Shows the first directory in PATH.
In cybersecurity
Reducing a log to one column is what makes it countable.
cut -d: -f1,7 /etc/passwd shows each account with its shell. Accounts with a real shell that should not have one are worth questioning.
Most log analysis begins by cutting out the field of interest — address, user, URL — and handing it to sort and uniq.
cut cannot handle repeated spaces or quoted commas, and will quietly take the wrong column. Use awk for those.