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.

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents