Redirection

#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