Linux - Redirection

By xngo on June 23, 2019

#Redirect stdout and stderr to a file
yourCommandName &> toFile.log
 
# Redirect and append both stdout and stderr to a file.
yourCommandName >> toFile.log 2>&1
 
 
cat > /tmp/somefile <<EOF
Write the following text below
that span multiple lines
in /tmp/somefile.
EOF

About the author

Xuan Ngo is the founder of OpenWritings.net. He currently lives in Montreal, Canada. He loves to write about programming and open source subjects.