Search and extract

CommandUseExample
awkComplex text processing, often used for structured dataawk
grepSearch for specific data, can use Regexgrep -i "fail" /var/log/auth.log
cutTrim and extract parts of a document, such as sections of columnscut -d':' -f1 /etc/passwd

Modify and replace

CommandUseExample
sedModify and replace text in filessed "s/hello/hi/g" ./my_textfile.txt
trTranslate or delete characters in texttr 'A-Z' 'a-z' < input.txt > output.txt

Sort and count

CommandUseExample
wcCounts lines, words, charswc -l /var/log/syslog
sortArranges in logical ordersort -t: -k,3 -n -r /etc/passwd
uniqFilters duplicatessort /var/log/auth.log | uniq -c
xargsBuilds and executes further commands, used to process output from other commands in bulkfind /home/logs | xargs -I {} -n 1 -p -t cp {} /backup/logs

View and navigate

CommandUseExample
headDisplays the beginning of a filehead -n 50 /etc/apache2/httpd.conf
tailShow the end of a file, often to monitor in real timetail -n 20 -f /var/log/syslog
moreView a long file one page at a timecat /var/log/syslog | more
lessLike more but includes a few other optionscat /etc/passwd | less

Output and redirect

CommandUseExample
echoDisplays whatever is specified as output or to a fileecho "$(date):System update completed >> /var/log/update.log
catReads and merges filescat log1.txt log2.txt log3.txt > full_log.txt
teeTakes input and writes it a file and displays output to screemping -c 4 google.com | tee -a network_log.txt

Math and format

CommandUseExample
printfPrint formatted; allows for format specifiersprintf "var1: %s\tvar2: %s\n" "$VAR1" "$VAR2"
bcBasic calculator, particularly good for floating pointecho '5 / 3' | bc

System and scripts

CommandUseExample
unameUsed to retrieve system informationecho "System Info: $(uname -a)" >> /var/log/update.log
sourceUsed to execute scripts in the current shell sessionsource /path/to/file