Saving Commands to a File
- 0
- Add a Comment
Saving Commands to a File
You’re already aware of catting in Linux. The cat command, in effect, opens a file for reading. This core function can also be combined with other programs to create usefulness you might not have thought of.
Let’s take an example straight out of the Penguin mailbag. A user wrote to say that he had just configured a new mail program on his machine. In order to customize it precisely as he wanted it, he’d used many, many command line options in the compilation. Everything compiled fine, but he wanted to know if there was a way to capture the command line input to a file for future reference.
But, of course. Using the catting cabailities of Linux, you can enter the following command to do exactly that:
cat -> filename
This command captures all the command line input to the file designated by filename. When finished, the Ctrl-D key combination will end the capture of the input.
cat is a core function in Linux that can be put to more useful purposes than you might ever think of. If you’ve got complicated command line entries you’d like to save for future reference, cat makes the process completely accurate and painless.
