1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-21 21:22:06 +02:00
tldr/pages/common/greater-than.md
2024-12-26 07:57:41 +01:00

517 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 stderr to /dev/null to keep the terminal output clean:

{{command}} 2> /dev/null

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

> {{path/to/file}}