Grep - Search Text

Search for pattern in files.

grep "pattern" file.txt
grep -i "pattern" file.txt
grep -r "pattern" dir/
grep -n "pattern" file.txt
grep -v "pattern" file.txt

Sed - Stream Editor

Find and replace text.

sed 's/old/new/' file.txt
sed 's/old/new/g' file.txt
sed -i 's/old/new/g' file.txt
sed '/pattern/d' file.txt

Awk - Text Processing

Process text by fields.

awk '{print $1}' file.txt
awk -F":" '{print $1}' /etc/passwd
awk '/pattern/ {print $0}' file.txt

Cut - Extract Columns

Extract fields from text.

cut -d":" -f1 /etc/passwd
cut -c1-10 file.txt

Sort

Sort text lines.

sort file.txt
sort -r file.txt
sort -n file.txt

Uniq

Remove duplicates.

sort file.txt | uniq
uniq -c file.txt

Common mistakes / Errores comunes

  • People often copy a command or pattern without adapting placeholders, which can break production workflows unexpectedly.
  • It is easy to forget environment-specific differences, so always verify behavior in your shell, runtime, or API gateway before shipping.
  • Many errors come from skipping small validation steps, so test with realistic sample input before relying on the result.
Last updated: February 2026