Another way to create a text file
October 1st, 2005 by George Notaras
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
The Another way to create a text file by George Notaras, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Terms and conditions beyond the scope of this license may be available at www.g-loaded.eu.
January 4th, 2006 at 2:36 am
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 :)
January 5th, 2006 at 8:19 am
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. :-)
December 19th, 2006 at 2:01 pm
Ctrl+D is more appropriate since it stands for EOF (End Of File).
December 20th, 2006 at 6:12 am
Indeed, Ctrl-D is more appropriate and, apparently, the correct alternative choice to typing “EOF”.