Pipes & Redirections
Pipes and Redirections
Pipes (
|) connect commands together — the output of one becomes the input of the next. Redirections (>, >>, <) send output to files or read input from files.bash
# Pipe: send output of one command to another
ls -la | grep ".txt"
# Chain multiple pipes
cat logfile.txt | grep "error" | wc -l
# Redirect output to a file
ls > filelist.txt
# Append to a file
echo "new line" >> filelist.txt
# Redirect errors
command 2> errors.txtTip:Pipes are the secret weapon of Linux. They let you build powerful data processing pipelines from simple commands.
Terminalbash
Welcome to the Linux Terminal Simulator!
Type commands below. Use 'help' to see available commands.
Try: