--- layout: page category-page: scripts category-title: Scripting tags: redirect output input author: Dario Rasic title: Redirection ---
To redirect a certain output of the command-line we have to use the symbol ">".
In this case, we will use a file named hello.txt, in which we want to insert
a certain output ("Sun" in this case):
echo "Sun" > hello.txtSo if we print the content of the file in our command-line, the output will be the following:
cat hello.txt SunIf we want to append a certain output to an existing file, we just have to use ">>" symbols:
cat hello.txt Sun echo "Moon" >> hello.txt cat hello.txt Sun Moon
echo < $(cat hello.txt) Sun MoonThis is particularly useful when chaining commands.