Of course, the easiest way to create a file is to
use a word processor like vi or emacs. However, there are a few utilities
which you can use to create files from the command line as well.
The "touch" Utility
The touch utility simply creates an empty file of a
given name using the syntax:
As you can see from the example above, if
the file already exists, it will modify the access time
without changing the contents of the file.
The touch utility offers the following options
touch [options] MMDDhhmmYY filelist
||Specifies the access time
||Instructs touch to not create a file not specified in the list
||Specifies the modify time
||The time and date for setting files
||Space delimited list of files to apply time to.
A more useful tool for creating files from the command line
is redirection. Typically, you will use redirection to save the output
of a command in the body of a file. for example, check out how we use
redirection in the following example to crate a file with the directory
Table of Contents