How can I input to a file directly from the terminal
a useful use of cat
: provide input on stdin
cat > filename
enter text
hit Ctrl-D to stop
or use a heredoc
cat > filename << END
enter text
provide the terminating word to stop
END
Use
cat > some_file
to write into the file some_file
. End your input with Ctrl+D