Linux Input/Output Redirection Command Cheat Sheet

Linux input/output redirection commands redirect commands and scripts. This command allows you to specify input and output locations. You can read input from a file instead of typing it rather than displaying it on the screen. The output of multiple commands can also be filtered and modified using redirection commands. They provide a powerful and flexible way to control Linux data flows.

Command Description
">" Used to redirect output to a file, creating a new file if it doesn't exist or overwriting the existing file if it does.
">>" Used to redirect output to a file, but appending the output to the end of the file instead of overwriting it.
"<" Used to redirect input from a file, with the contents of the file being used as input to the command.
"<<" Used to redirect input from a "here document", which is a way to pass input to a command without using a file.
"&>" Used to redirect both standard output and standard error to a file, creating a new file if it doesn't exist or overwriting the existing file if it does.
"&>>" Used to redirect both standard output and standard error to a file, but appending the output to the end of the file instead of overwriting it.
"2>" Used to redirect standard error to a file, creating a new file if it doesn't exist or overwriting the existing file if it does.
"2>>" Used to redirect standard error to a file, but appending the output to the end of the file instead of overwriting it.
"|" Used to redirect the output of one command as input to another command, creating a pipeline of commands.
"tee" Used to redirect output to a file, while still displaying the output on the screen.
"<<<" Used for here strings, which allow you to specify input directly in a variable.
"<>" Used to open a file for both reading and writing.
">&" Used to redirect standard output and standard error to a file descriptor.
"<()" Used for command substitution, which allows the output of a command to be used as input for another command.
">()" Used for process substitution, which allows the output of a command to be used as input for another command as a file.
"script" Used to record a shell session to a file for later replay.
"/dev/null" Used to discard output, effectively sending it into a "black hole".

About John Gomez

John Britto Founder & Cheif-Editor @LinuxTeck. A Computer Geek and Linux Intellectual having more than 10+ years of experience in Linux and Open Source technologies.

View all posts by John Gomez →

Leave a Reply

Your email address will not be published.

L