Basic Linux Tutorial
Computer Tutorial

Standard Input Redirection



Input Redirection

Linux commands can send output anywhere when using output redirection, and they can also get input from places other than the keyboard. We use the "less-than" symbol ( < ) for input redirection.

We use the "less-than" symbol ( < ) for input redirection. Say that you have already created a text file with name myfile. You want to send this text file to a user jane through electronic mail. The easiest way to do this is to ask the mail program to get its input from this file instead of from the keyboard.

The process of doing this is as follows :
$ mail general < myfile
The mail program sends an email message to user general on the current system consisting of the contents of myfile.