The UNIX System gives you many commands that can be used singly or in combination to perform a wide variety of tasks, and to solve a wide range of problems. They can be thought of as software tools. This chapter has surveyed a number of the most useful tools in the UNIX System toolkit, including tools for finding patterns in files; working with compressed files, modifying structured files; comparing files; and performing numerical computations.
These tools can be used on the command line, as shown in many of these examples, or invoked from scripts. In fact, many of these tools are extremely useful when writing scripts to automate complex tasks. Shell scripting will be discussed in the next chapter. Two very powerful tools for scripting, awk and sed, are discussed in the chapter after that.
Table 19–7 summarizes the commands that were discussed in this chapter.
Commands | Use | Commands | Use |
---|---|---|---|
grep fgrep egrep | Search for text in a file | cmp comm diff dircmp | Compare files or directories |
pack compress gzip bzip2 | Compress a file See section on compressing files for related commands, such as gunzip and zcat | od strings | View files with unusual characters |
tar | Package/extract a set of files | tac | Print a file backward |
wc | Count words or lines | pr font | Add simple formatting |
nl | Add line numbers | tr | Translate certain characters |
cut colrm | Get certain columns or fields | tee | Fork output to a file and to standard output |
paste join | Combine files formatted with columns or fields | script | Record all text on the screen |
sort | Sort lines | | Send mail |
uniq | Remove duplicate lines | date | Display the date and time |
patch | Update a file to a new version | touch | Update the date on a file |
spell ispell | Check spelling | bc dc | Perform calculations |