-
-
Notifications
You must be signed in to change notification settings - Fork 2
Linux cut Guide
Mattscreative edited this page Dec 5, 2025
·
2 revisions
Complete beginner-friendly guide to cut on Linux, covering Arch Linux, CachyOS, and other distributions including text extraction, field selection, and data processing.
cut extracts columns from text.
Uses:
- Extract fields: Get specific columns
- Text processing: Process structured data
- Data extraction: Extract from files
- CSV processing: Handle CSV files
Why it matters:
- Data processing: Extract specific data
- Text manipulation: Process text files
- Scripting: Useful in scripts
Basic usage:
# Extract columns
cut -c 1-10 file.txt
# Extract characters 1-10By delimiter:
# Extract field
cut -d',' -f1 file.csv
# -d: Delimiter
# -f: Field numberOne field:
# Extract first field
cut -d',' -f1 file.csv
# Extract second field
cut -d',' -f2 file.csvSeveral fields:
# Extract multiple fields
cut -d',' -f1,3,5 file.csv
# Fields 1, 3, and 5Range of fields:
# Extract range
cut -d',' -f1-5 file.csv
# Fields 1 through 5Different separators:
# Comma
cut -d',' -f1 file.csv
# Tab (default)
cut -f1 file.txt
# Colon
cut -d':' -f1 /etc/passwd
# Space
cut -d' ' -f1 file.txtCheck format:
# Verify delimiter
head -1 file.csv
# Check field count
awk -F',' '{print NF}' file.csvThis guide covered cut usage, field extraction, and text processing for Arch Linux, CachyOS, and other distributions.
- sed and awk Guide - Text processing
- Grep Command Guide - Text searching
-
cut Documentation:
man cut
This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.