OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

Filters

Pipelines are often used to perform complex operations on data. It is possible to put sev- eral commands together into a pipeline. Frequently, the commands used this way are re- ferred to as filters. Filters take input, change it somehow and then output it. The first one we will try is sort. Imagine we wanted to make a combined list of all of the executable programs in /bin and /usr/bin, put them in sorted order and view it:


[me@linuxbox ~]$ ls /bin /usr/bin | sort | less

[me@linuxbox ~]$ ls /bin /usr/bin | sort | less


Since we specified two directories (/bin and /usr/bin), the output of ls would have consisted of two sorted lists, one for each directory. By including sort in our pipeline, we changed the data to produce a single, sorted list.


Top OS Cloud Computing at OnWorks: