Next / Previous / Index / ITC Help System / Publications / Site map / NM Tech homepage

Redirecting input streams

Tech Computer Center logo

Unless you specify otherwise, many Unix commands take their input from the keyboard. For example, the cat command usually takes input from the keyboard and sends it to the display screen:

      yourname@yourcomputer<26>% cat
      Foo.
      Foo.
      Bar!
      Bar!
      ^D
In the above example, user input is shown in bold type. Note that every time you type a line, the line is typed back at you. Use the control-D character to terminate your input; this character is shown as ^D on your screen.

To redirect the input stream of a command means to execute it so that the command reads its input from a given file. To use input redirection, type a ``less-than'' character (<) at the end of the command, and then type the name of the file you want to use for input. For example:

      yourname@yourcomputer<27>% cat <timestamp
      Sat Jan 28 15:03:08 MST 1995

Next: Using pipelines
See also: What is a Unix command?
Previous: Redirecting output streams
Site map
Index: Keyword index to help pages
Help: New Mexico Tech Information Technology and Communications: Help System
ITC Publications
To report a problem: File a ticket
Send mail to the User consultant on duty or call them at 575-835-5437
Home: About New Mexico Tech

John Shipman, john@nmt.edu
Last updated: 1995/12/04 19:39:34 UT
URL: http://www.nmt.edu/tcc/help/unix/inredirect.html
QR two-dimensional bar code