Chapter 7 Study Guide: Difference between revisions

From ITCwiki
Jump to navigation Jump to search
Line 29: Line 29:


  cat </etc/issue
  cat </etc/issue
Redirection only occurs between a command and a file. However you can send stdout of 1 command to another command as stdin. You can do this by using the pipe shell metacharacter "|" This symbol can be created by pressing the shift key along with the \ key. Common use for piping is to reduce the amount of information displayed.


==Shell variables==
==Shell variables==
==Shell Scripts==
==Shell Scripts==
==Escape Sequences==
==Escape Sequences==

Revision as of 21:19, 29 February 2012

Command input and output

Bash Shell Responsible for providing user interface

Interprets commands entered on command line

Can manipulate command input and output

Input and Outputs of commands Represented by labels know as file descriptors. There are 3 file descriptors:


Standard input (stdin) information processed by the command during execution

Standard output (stdout) refers to the normal output of a command

Standard error (stderr) refers to any error messages generated by the command

Both stdout and stderr are displayed on the terminal screen by default


Use the BASH shell to redirect stdout and stderr from the terminal screen to a file on filesystem

Use the > shell metacharacter followed by absolute or relative pathname of the file

ls /etc/hosts /etc/h 1>goodoutput

Use the < to redirect a file to the stdin

cat </etc/issue

Redirection only occurs between a command and a file. However you can send stdout of 1 command to another command as stdin. You can do this by using the pipe shell metacharacter "|" This symbol can be created by pressing the shift key along with the \ key. Common use for piping is to reduce the amount of information displayed.

Shell variables

Shell Scripts

Escape Sequences