Linux Tutorial

Text Processing and Pipes

Use cat, less, head, tail, grep, cut, sort, uniq and pipelines.

Concept

Unix-style tools are designed to do focused work and compose through pipes. A pipe sends standard output from one command to standard input of the next.

Text tools become much more powerful when combined. Start with readable pipelines and then optimize only when needed.

Example

printf "java\npython\njava\nsql\n" > skills.txt
sort skills.txt | uniq -c
grep -i "python" skills.txt
Type the example yourself and change at least one value. Small experiments reveal syntax and behavior faster than passive reading.

Practice Tasks

  1. Count duplicate lines in a file.
  2. Search recursively for a word with grep.
  3. Use head and tail on a log file.

Key Takeaways

  • Pipes compose commands.
  • grep searches text.
  • sort and uniq are useful together for frequency work.