Standard commands

OUT

echo Hello World > new.txt → Adds "Hello World" to the new.txt file, overwritting it

echo Hello World >> new.txt → Adds "Hello World" to the new.txt file without overwritting it (appends)

IN

cat < new.txt > other.txt → Redirects new.txt content as stdin to the other.txt file (< used for stdin redirection)

ERR

ls /Nadesh/directory 2> new.txt → Redirect stderr to the new.txt file

ls /Nadesh/directory > new.txt 2>&1 → Redirect stderr and stdout to the new.txt file

Last updated

Was this helpful?