«
»

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.

Related Articles

Tags: ,

4 Responses to “Another way to create a text file”

  1. Yannick Says :

    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 :)

  2. Gnot Says :

    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. :-)

  3. agorf Says :

    Ctrl+D is more appropriate since it stands for EOF (End Of File).

  4. GNot Says :

    Indeed, Ctrl-D is more appropriate and, apparently, the correct alternative choice to typing “EOF”.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight=""> <pre>