Redirecting standard output
suggest change> redirects the standard output (also called stdout) of the current command into a file or another descriptor.
These examples write the output of the ls command into the file file.txt
ls >file.txt
> file.txt ls
The target file is created if it does not exist. Otherwise the file is truncated.
The default redirection descriptor is the standard output or 1 when none is specified. This command is equivalent to the previous examples with the standard output explicitly indicated:
ls 1>file.txt
Note: the redirection is initialized by the executed shell and not by the executed command, therefore it is done before the command execution.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents