Shell and Environment

redirection

Reads or writes command streams to files.

Redirection is shell syntax for sending output to files, appending output, reading input, or redirecting errors.

Syntax
command > file    command >> file    command 2> errors.log

Arguments explained

  • Options adjust output or behavior.
  • Arguments name the files, services, hosts, or values the command should work with.

Common examples

Overwrite a file
echo hello > message.txt

> creates or overwrites the target file.

Append to a file
echo hello >> message.txt

>> appends without replacing existing content.

redirection Command
FieldDetails
Commandredirection
CategoryShell and Environment
Primary useReads or writes command streams to files.
Syntaxcommand > file command >> file command 2> errors.log