5. Working with Text

Processing plain text files is a big strength of Linux. The commands presented in this chapter allow you to display particular parts of files (e.g. head, tail), reorder their contents (e.g. sort), carry out search/replace operations (e.g. grep, sed), and much more.

Contents of this chapter:

  • cat (concatenate and output files)
  • cut (output columns from files)
  • diff (show differences between files)
  • grep (print lines matching a pattern)
  • head (output the first part of files)
  • less (view file by pages)
  • pdftk (manipulate PDF files)
  • sed (search and replace text)
  • sort (sort lines of text files)
  • tail (output the last part of files)
  • wc (count lines, words and characters)