CUT(1)
β¨ CUT(1) β the girlies' guide to slicing up lines β¨
okay so bestie, cut lives in the General Commands Manual and it's literally the moment you've been waiting for: it pulls little sections out of every single line of your files π
π NAME π
cut β extract sections from each line of files. periodt.
πΈ SYNOPSIS πΈ
cut OPTION... [FILE]...
π¦ DESCRIPTION π¦
Extract sections from each line of files. that's it, that's the whole vibe. you feed it lines, you tell it which bits you want, it gives you the bits. iconic behavior fr fr π
π OPTIONS π
-b,--bytes<LIST>β extract the bytes listed in LIST π-c,--characters<LIST>β extract the characters listed in LIST π-d,--delimiter<DELIM>β use DELIM as the field separator (default:Tab) β¨-w,--whitespace-delimited[=<trimmed>]β use any whitespace (Space/Tab) as the delimiter; ignore leading and trailing blanks with'trimmed'π§- Possible values:
trimmed
- Possible values:
-f,--fields<LIST>β extract the fields listed in LIST πΈ-F<LIST>β like-f, but merge adjacent delimiters; the delimiter defaults to whitespace and the output delimiter to a space π«Ά--complementβ invert the selection: print all columns except the specified ones π-s,--only-delimitedβ suppress lines that do not contain the delimiter π-z,--zero-terminatedβ useNULL(\0) instead of newline as the line terminator β-O,--output-delimiter<NEW_DELIM>β replace the input delimiter with NEW_DELIM in the output π-n,--no-partialβ with-b, do not output partial multi-byte characters π₯-h,--helpβ Print help π-V,--versionβ Print version π
π EXTRA π
If no FILE is specified, it reads from stdin. Use '-' as a FILE argument to include stdin. so cozy, so flexible, main character energy honestly π¦
LIST is a comma-separated list of numbers or ranges:
N only column N
N- columns N through the end of the line
N-M columns N through M
-M columns 1 through M
Examples:
cut -f 2,5-7 file.txt extract fields 2, 5, 6, and 7
cut -f 3- file.txt extract field 3 to the end of the line
cut --complement -f 4-6 file.txt extract all fields except 4, 5, and 6
cut -d',' -f1 file.csv extract first field from a CSV
π VERSION π
v(uutils coreutils) 0.12.0
π EXAMPLES π
Print the fifth character on each line:
command | cut [-c|--characters] 5
Print the fifth to tenth character of each line of the specified file:
cut [-c|--characters] 5-10 path/to/file
Split each line in a file by a delimiter into fields and print fields two and six (default delimiter is TAB):
cut [-f|--fields] 2,6 path/to/file
Split each line by the specified delimiter and print all from the second field onward:
command | cut [-d|--delimiter] "delimiter" [-f|--fields] 2-
Use space as a delimiter and print only the first 3 fields:
command | cut [-d|--delimiter] " " [-f|--fields] -3
Only print lines that contain the delimiter:
command | cut [-d|--delimiter] ":" [-f|--fields] 1 [-s|--only-delimited]
Print specific fields of lines that use NUL to terminate lines instead of newlines:
find . -print0 | cut [-z|--zero-terminated] [-d|--delimiter] "/" [-f|--fields] 2
The examples are provided by the tldr-pages project <https://tldr.sh> under the CC BY 4.0 License. Please note that, as uutils is a work in progress, some examples might fail. π
okay that's the whole page bestie, you're officially a cut girlie now πβ¨ this version is from v(uutils coreutils) 0.12.0, dated 2026-09-25 β go slice some lines, you ate π
π
π¦ where this page comes from
- ubuntu stonking: rust-coreutils 0.12.0-1ubuntu2 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms