Monday, February 9, 2009

More on Unix terminal cat command

The other day I played around with the Unix cat command to write to a config file. Well today my curiosity got the better of me and I went to do a little more research into the uses and syntax of cat. The cat command is used to read from, write to, and concatenate text to a file. Typing "cat [filename]" will print the contents of the specified file. To create a file, type either "cat>[filename]" or "cat>>[filename]". Now you will be writing to the file. Press [control+c] to stop editing and exit the cat command. The difference between these two options is an extra ">". For just creating a file, there is no difference. However, for editing an existing file, "cat>[filename]"will overwrite the contents of the new file whereas "cat>>[filename]"will contatenate new text to the end of the file.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.