8. Finding Things

note

teaching: 15 minutes

exercises: 10 minutes

questions:

  • How can I find files?
  • How can I find things in files?
  • Once I’ve found things, how can I replace/edit them?

objectives:

  • Use grep to select lines from text files that match simple patterns.
  • Use find to find files and directories whose names match simple patterns.
  • Use sed to replace data in files when a pattern match occurs.
  • Use the output of one command as the command-line argument(s) to another command.
  • Explain what is meant by ’text’ and ‘binary’ files, and why many common tools don’t handle the latter well.