1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/common/greater-than.md
Managor 5e9c1a3bbc
>: add file emptying example (#14080)
Co-authored-by: Wiktor Perskawiec <git@spageektti.cc>
2024-10-10 15:11:12 +02:00

535 B

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}}

  • Redirect both stdout and stderr to /dev/null to keep the terminal output clean:

{{command}} &> /dev/null

  • Clear the file contents or create a new empty file:

> {{path/to/file}}