Friday, November 6, 2009

The power of the command line

This is a short version not so fancy of the article published by Martin Streicher at ibm.com in the Speaking Unix Series

One of the better features of UNIX is the command line. With just a few keystrokes you can do magic.

For example to find the list of unique filenames in the folder hierarchy rooted at the current working directory you can type the following

find . -type f -print | sort | uniq

Combining three commands...

find - To find all the files starting from "." "here" and print them as a list
sort - To sort them in alphabetical order (default)
uniq - To remove any duplicate value in the list

Data in, data out, data all about

A typical UNIX command-line utility reads from stdin and writes to stdout


 Some utilities read data from system resources and write results to stdout





UNIX commands emit errors to a special channel, standard error



 A conceptual model of three utilities linked by pipes



 Redirecting standard input to read from a file
 

 Combining the standard output and standard error devices




No comments:

Post a Comment

Note: Only a member of this blog may post a comment.