Bash 5 reference · Text and System Tools

cut (Linux command)

Extract columns from each line by delimiter and field number, or by character positions.

Bash 5

Create a free account to save this page, take notes and track your progress. Sign in

Syntax

cut -d DELIM -f FIELDS [FILE]   cut -c RANGE [FILE]

Parameters

ParameterDescription
-d , Delimiter (one character).
-f 1,3 / -f 2- Fields to keep.
-c 1-8 Character positions.

Examples

Fields
echo 'ana,DE,31' | cut -d, -f1,3
echo 'ana,DE,31' | cut -d, -f2-

Output

ana,31
DE,31

Run this on your computer — see “Get Started” for setup.

Characters
echo '2026-01-15T10:00:00Z' | cut -c1-10

Output

2026-01-15

Run this on your computer — see “Get Started” for setup.

Was this page helpful?