sh IO Redirection Input Redirection


Example

The commands normally take their input from the standard input device keyboard. Using Input redirection concept, we can have their input redirected from a file. To redirect standard input from a file instead of the keyboard, the '<' character is used.

$ cat file1 
monday
tuesday
wednsday
thursday
friday
saturday
sunday

The above is the content of file1

$ sort < file1
friday
monday
saturday
sunday
thursday
tuesday
wednsday

here insted of taking input from keyboard, we redirected it from the file1 and sort it in ascending order.