background
|
|
Computer

bonsai
The Element
A small area for Bonsai related material.
More icon
|
|
Up Image
Navigation
Search this Site
Enter your search terms

Site Breadcrumb - You are here
|
Reference   Unix Guide

Combining Commands

Most Unix commands are fairly simple and only have a handful of options. The beauty of Unix is that these commands can be combined to do more complex tasks. You can send the output of one command to another command for further processing by separating the commands with a pipe (|).

If you want to follow a file as it grows (tail -f) and search for a regular expression (grep), you can combine commands to achieve this. If you are searching for files in a growing error log that contains the word supermonkey you would type this:

 tail -f errorlog | grep ".*supermonkey.*" 
This tails the errorlog and then greps for the regular expression "supermonkey." The . and * are called meta-characters. The .* in this example matches any number of any character.

Back to the index.