How does '>' differ from '<'?

0105

The > and < symbols are both used for redirection in command-line operations, but they serve opposite purposes:

  • > (Output Redirection): This symbol is used to redirect the output of a command to a file. If the file already exists, it will be overwritten. For example:

    command > outputfile.txt

    This command takes the output of command and writes it to outputfile.txt.

  • < (Input Redirection): This symbol is used to redirect input from a file to a command. It allows a command to read data from a file instead of from standard input. For example:

    command < inputfile.txt

    This command takes the contents of inputfile.txt and uses it as input for command.

In summary, > is for directing output to a file, while < is for taking input from a file.

0 Comments

no data
Be the first to share your comment!