1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-05 15:15:23 +02:00
tldr/pages/common/greater-than.md

29 lines
602 B
Markdown
Raw Normal View History

# Greater than
2025-04-02 06:23:45 +03:00
> Redirect output.
> More information: <https://gnu.org/software/bash/manual/bash.html#Redirecting-Output>.
- Redirect `stdout` to a file:
`{{command}} > {{path/to/file}}`
- Append to a file:
`{{command}} >> {{path/to/file}}`
- Redirect both `stdout` and `stderr` to a file:
`{{command}} &> {{path/to/file}}`
2024-12-26 08:57:41 +02:00
- Redirect `stderr` to `/dev/null` to keep the terminal output clean:
2024-12-26 08:57:41 +02:00
`{{command}} 2> /dev/null`
- Clear the file contents or create a new empty file:
`> {{path/to/file}}`
2025-04-02 06:23:45 +03:00
- Redirect `stderr` to `stdout` for piping them together:
`{{command1}} 2>&1 | {{command2}}`