Redirection of input and output

Input and output, to and from commands, may be taken from the console (user input), a file, a variable and directly from other programs. What is possible varies on how you are using the command and what it supports, see the man pages for each command for further info. However, in general the following options are possible:

In the following examples the pwd program is used to provide output as it always generates a line of text, the ls command is used where it is more useful to have multiple lines for the example and other commands are used when it assists the explanation.