Linux Commands Guidebook

Transforming Text

1. sed

Stream editor for text substitution.

sed 's/foo/bar/g' file.txt

2. tr

Translate or delete characters.

tr 'a-z' 'A-Z'

3. cut

Extract columns from text.

cut -d',' -f1 data.csv

4. paste

Merge lines of files.

paste file1 file2

▼ Advanced

5. awk

Pattern scanning and processing.

awk '{print $1, $3}' file.txt

6. column

Align output into columns.

column -t data.txt

7. dos2unix

Convert Windows line endings.

dos2unix script.sh

Comparing & Analyzing Text

1. diff

Compare files line by line.

diff old.txt new.txt

2. sort

Sort lines of text.

sort names.txt

3. uniq

Filter duplicate lines.

sort file | uniq

4. wc

Count lines, words, characters.

wc -l file.txt

▼ Advanced

5. comm

Compare two sorted files.

comm file1 file2

6. sha256sum

Verify file integrity.

sha256sum file.txt

7. cksum

Checksum and byte count.

cksum file.txt