Text Processing Command Cheat Sheet

Text Processing Commands are a set of built-in commands that are used to manipulate text. These commands allow users to quickly and efficiently search, modify, and extract data from text files.

Command Description Examples
cat Concatenate and display files cat file1.txt file2.txt
sort Sort lines of text files sort file.txt
uniq Remove duplicate lines from a sorted file sort file.txt | uniq
grep Search for patterns in files grep "pattern" file.txt
cut Extract columns of text from files cut -f1,3 file.txt
sed Stream editor for filtering and transforming text sed 's/old/new/' file.txt
awk Pattern scanning and processing language awk '{print $1, $3}' file.txt
tr Translate or delete characters tr 'a-z' 'A-Z' < file.txt
wc Count lines, words, and characters in a file wc file.txt
diff Compare two files and show differences diff file1.txt file2.txt
patch Apply a diff file to a file or directory patch file.txt patch.diff
nl Number lines in a file nl file.txt
head Display the first few lines of a file head file.txt
tail Display the last few lines of a file tail file.txt
tee Redirect output to a file and to the terminal ls | tee output.txt
fmt Format text files for printing fmt file.txt
pr Convert text files for printing pr file.txt
iconv Convert character encoding of a file iconv -f utf-8 -t iso-8859-1 file.txt
dos2unix Convert DOS line endings to UNIX line endings dos2unix file.txt
rev Reverse lines of a file rev file.txt
fold Wrap lines of text to a specified width fold -w 80 file.txt
join Join lines from two files based on a common field join file1.txt file2.txt


About John Gomez

John Britto Founder & Cheif-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 10+ years of experience in Linux and Open Source technologies.

View all posts by John Gomez →

Leave a Reply

Your email address will not be published.