cut — cut fields out of lines
cheat sheet · Ubuntu 24.04 · GNU coreutils 9.4 https://lab.dimsanych.ru/en/wiki/cut/Cheat sheet
-
cut -d: -f1 /etc/passwdfirst field, ":" delimiter -
cut -d: -f1,7 /etc/passwdfields 1 and 7 -
cut -d, -f2- data.csvfrom field 2 to the end -
cut -d' ' -f1 access.logthe first word of each line -
cut -c1-8 file.txtpositions 1 through 8 -
cut -f2 table.tsvfield 2, TAB delimiter -
cut -d: -f1,6 --output-delimiter=' ' /etc/passwd
Options
-f, -c and -b are three ways to pick part of a line; a single call needs exactly
one of them. The full list is in man cut.