Posts

Showing posts from May, 2013

I/O Redirection in Linux

Three types of I/O redirections in Linux 1. stdin         < 2. stdout       > 3. stderr       2> Examples:  1. # date > file1.txt     Redirects the output of date command to the file file1.txt . 2. #cal >> file1.txt     Redirects the output of cal command to file1.txt. Note that the out put of cal command will append to file    file1.txt.   > simply replaces the content where >> will append the content. 3. #tr [a-z] [A-Z] file1.txt  < file1.txt      Translates the all lowercase letter to uppercase letter in file1.txt. Here we are giving the file1.txt as input to the command using < . 4. $find / -name linux 2> out_error.txt     Here a normal user is trying to find the file/folder with name "linux" under root file system ( / ).A normal user doesn't have permissions to every location under root file system ( / ). So the above command will give the output as well as some errors.      We can redirect the error messages to a file out_error.tx