You can redirect the output of a command to a file:
cat file > copy_file
or append to it
cat file >> copy_file
If you want to write directly the command is echo ‘text’
echo 'Hello World' > file
Or
# possibility 1: echo "line 1" >> greetings.txt echo "line 2" >> greetings.txt # possibility 2: echo "line 1 line 2" >> greetings.txt # possibility 3: cat <<EOT >> greetings.txt line 1 line 2 EOT
References
https://stackoverflow.com/questions/11162406/open-and-write-data-to-text-file-using-bash-shell-scripting
https://unix.stackexchange.com/questions/77277/how-to-append-multiple-lines-to-a-file