The Unix operating system introduced the idea of a toolkit.
That is, rather than having a few generalized and complex utilities
programs, the system contains a toolkit of small and simple
programs which the user combines to perform sophisticated tasks and
to create custom programs. For example, suppose we want to count how
many users with group id 20 are listed in the /etc/passwd file. The
fourth field in the /etc/passwd file is the group id:
larke:WsvQ64KOjG94w:350:20:Ed Larke:/u/larke:/bin/ksh
To count the number of lines which have 20 in the fourth column, we use
cut to grab the fourth column, egrep to extract those
lines with 20, and then wc to count the number of words. While
we will explain some of these basic Unix utilities later, the point
here is that a single command line is all we need to complete the
task:
% cut -f4 -d':' /etc/passwd |egrep 20 |wc -l 54 Output from command. % Prompt, i.e. done.
Because Unix treats files, commands, and devices all pretty much as files, and since most of these tools will take their input either from files or from other commands (or standard input if no file name is given), this juxtaposition of tools is general and powerful.