2024-10-01 20:20:05 +03:00
|
|
|
# Greater than
|
|
|
|
|
|
|
|
> Redirect output to a file.
|
|
|
|
> 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-10-01 20:20:05 +03:00
|
|
|
|
2024-12-26 08:57:41 +02:00
|
|
|
`{{command}} 2> /dev/null`
|
2024-10-10 16:11:12 +03:00
|
|
|
|
|
|
|
- Clear the file contents or create a new empty file:
|
|
|
|
|
|
|
|
`> {{path/to/file}}`
|