In article 4.7, we told you that you should have lots of directories. Experienced UNIX users are creating new directories all the time. How do you make a directory?
This creates the new directory you want. It doesn't necessarily have to be in your current directory. For example:
The only requirements are:
The parent of the directory you want to create must exist (in this case, /src/books/power/articles).
You must have write access to the parent directory.
|mkdir||What if the parent directory doesn't already exist? Assume, for example, that /src/books already exists, but the power and articles directories don't. You can make these "by hand," or (on many UNIX systems, and with the GNU version on the CD-ROM) you can add the -p (parents) option:|
mkdir -p /src/books/power/articles/files
This tells mkdir to create all the intermediate directories that are needed. So the above command creates three directories:
[If your mkdir doesn't have -p, you can use:
!!/articlesmkdir /src/books/power/articles %
That's almost as quick. -JP ]
If you are using System V, you can also supply the "file protection mode" to be assigned to the directory. (By default, the file protection mode is derived from your.) To do so, use the -m option. For example:
mkdir -m 755 /src/books/power/articles/files
This creates the directory with access mode 755, which allows the owner to do anything with the directory. Note that this must be a numeric mode; see article 22.1 for an introduction to file and directory protection.