cut takes selected fields or characters out of every line. Learn when to use `-d` with `-f` and when to cut by character position with `-c`, by running the commands in a real terminal in your browser.
Updated: 2026-09-06
cut -d separator -f fields file
cut -c positions file
It keeps the part of each line you asked for.
Pull the name column out of a CSV.
$ cat users.csv
id,name,team,email
1,ada,web,ada@example.com
2,linus,infra,linus@example.com
3,grace,infra,grace@example.com
$ cut -d, -f2 users.csv
name
ada
linus
grace
-d is the separator and -f is which field.
List several with commas.
$ cut -d, -f1,3 users.csv
id,team
1,web
2,infra
3,infra
2- means from there to the end.
$ cut -d, -f2- users.csv
name,team,email
ada,web,ada@example.com
linus,infra,linus@example.com
grace,infra,grace@example.com
When the columns line up, use -c.
If the first ten characters are the date:
$ cat logs/access.log
2026-09-06 10:12:33 200 /index
2026-09-06 10:12:41 404 /missing
2026-09-06 10:13:02 200 /index
2026-09-07 09:01:15 500 /boom
2026-09-07 09:02:44 200 /index
$ cut -c1-10 logs/access.log
2026-09-06
2026-09-06
2026-09-06
2026-09-07
2026-09-07
-c ignores separators entirely and counts characters.
cut usually appears just before a count.
Take the status column and tally it.
$ cut -d' ' -f3 logs/access.log
200
404
200
500
200
$ cut -d' ' -f3 logs/access.log | sort | uniq -c
3 200
1 404
1 500
Leave out -d and the separator is a tab.
$ cut -f2 report.tsv
status
200
404
For colon-separated files, -d:.
Names and login shells out of /etc/passwd is the example you will meet most often.
$ cut -d: -f1,7 /etc/passwd
root:/bin/bash
user:/bin/zsh
deploy:/bin/bash
cut is what you type to narrow a line down before passing it on.
| Situation | What to type |
|---|---|
| Read one column of a CSV | cut -d, -f2 users.csv |
| Take the date off a log line | cut -c1-10 access.log |
| Count status codes | cut -d' ' -f3 access.log | sort | uniq -c |
| List the user names on a machine | cut -d: -f1 /etc/passwd |
| Read a column of a TSV | cut -f2 report.tsv |
Fields cannot be reordered.
cut -d, -f3,1 still prints 1 before 3.
Reordering, calculating, or filtering by a condition are all awk territory.
-c and -f are mutually exclusive.
$ cut -c1 -f1 users.csv
cut: only one type of list may be specified
-d only means something with -f.
$ cut -c1-4 -d, users.csv
cut: an input delimiter may be specified only when operating on fields
One of them is required.
$ cut users.csv
cut: you must specify a list of bytes, characters, or fieldswebterm.appthis site
Terminal Fundamentals
Learn commonly used commands
learn.webterm.appa separate site

Commands stick when they show up in a real sequence of work, not one at a time. There is a course that builds them up in order.
See the course