User Tools

Site Tools


ops102:redirection

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
ops102:redirection [2024/02/01 19:44] – [Piping] chrisops102:redirection [2024/05/04 02:26] (current) – external edit 127.0.0.1
Line 2: Line 2:
 =====  Standard File Descriptors  ===== =====  Standard File Descriptors  =====
  
-On Linux, other Unix-like systems, and on Windows, programs may open **file descriptors** (Linux terminology) or **handles** (Windows terminology). Each file descriptor/handle is a numbered channel connected to a file or device.+On Linux, other Unix-like systems, and on Windows, programs may open **file descriptors** (Linux terminology) or **file handles** (Windows terminology). Each file descriptor/handle is a numbered channel connected to a file or device.
  
 By default, three channels are opened automatically by the shell when a process is started. These are: By default, three channels are opened automatically by the shell when a process is started. These are:
Line 107: Line 107:
  -rw-r--r--. 1 chris chris 0 Sep 26 13:17 one  -rw-r--r--. 1 chris chris 0 Sep 26 13:17 one
  -rw-r--r--. 1 chris chris 0 Sep 26 13:17 two</code>  -rw-r--r--. 1 chris chris 0 Sep 26 13:17 two</code>
 +
 +Note that in this example, it is necessary to redirect stdout before redirecting stderr to the same location.
  
 =====  Piping  ===== =====  Piping  =====
  
-Piping is a special case of redirection, where the output of one command is connected to the input of another command. This is set up using the vertical-bar (pipe) symbol: ''|'' (this may look like a solid or a dashed vertical line, depending on the terminal font in use).+Piping is a special case of redirection, where the output (stdout) of one command is connected to the input (stdin) of another command. This is set up using the vertical-bar (pipe) symbol: ''|'' (this may look like a solid or a dashed vertical line, depending on the terminal font in use).
  
 For example, on Windows, the output of the ''help'' command is more than one screen long. You could pipe the output of the ''help'' command into the input of the ''more'' command to view one screen of text at a time: For example, on Windows, the output of the ''help'' command is more than one screen long. You could pipe the output of the ''help'' command into the input of the ''more'' command to view one screen of text at a time:
ops102/redirection.1706816684.txt.gz · Last modified: 2024/04/16 18:10 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki