You can create a multiline text file without using any text editor. This is done like this:
# cat > ~/test.txt <<EOF
~/test.txt is the file we want to create. Now you can type the contents line by line. When you are finished, type EOF:
>EOF
Another way to create a text file by George Notaras is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Copyright © 2005 - Some Rights Reserved
I use:
cat > test.txt
next I type the contents line by line and hit CTRL+C when I finished typing..
Seems to do the same thing but a bit easier :)
Hi, Yannick. I just now noticed your comment. Was busy doing some things on the site…
Thanks for this tip. Works just fine. An absolutely quicker way than the one I wrote about. :-)
Ctrl+D is more appropriate since it stands for EOF (End Of File).
Indeed, Ctrl-D is more appropriate and, apparently, the correct alternative choice to typing “EOF”.