Where to start First steps track · 15 stages
Linux Labs

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/passwd first field, ":" delimiter
  • cut -d: -f1,7 /etc/passwd fields 1 and 7
  • cut -d, -f2- data.csv from field 2 to the end
  • cut -d' ' -f1 access.log the first word of each line
  • cut -c1-8 file.txt positions 1 through 8
  • cut -f2 table.tsv field 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.

Loading…