3
I'm a bit of a UNIX noob, but I'm trying to run the cat command to make a simple text file and it works great, however cat is never exited after making the file. For instance, I type cat > ~/mytextfile.txt and hit enter, the file is created but my cursor remains on a blank line.
3
catis most often used for dumping the contents of one file into another, ex.cat file1 > file2or feeding a file to a pipe, ex.cat file | somecommand. If you simply want to create an empty file, use the commandtouch. If you wish to create a new file with a few simple words, or append a few lines to an existing file,echois a common solution. – Darth Android – 2010-06-02T11:20:16.5631@Darth - You should write your comment as an answer instead. – Nifle – 2010-06-02T11:56:27.443
"feeding a file to a pipe, ex. cat file | somecommand" 'cat'ting in this context, though commonly done, is completely useless. 'somecommand <file' is equivalent and runs one less process. The only way it might make sense would be to concatenate several files into a single input stream for 'somecommand' – JRobert – 2010-06-02T21:56:23.040