DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Working with files and directories

Creating a directory

To create a new directory, use the mkdir(C) (make directory) command, as follows:

mkdir directory

The directory argument can be either a simple name, in which case the new directory is created within the current working directory, or a pathname. For example, if you want to create a new subdirectory called projects in the directory called /u/workfiles, you can do the following:

   $ mkdir /u/workfiles/projects
You get the same result by entering the following:
   $ cd /u/workfiles
   $ mkdir projects
The cd command stands for ``change directory''. See ``Navigating the filesystem'' for more details.

For details of naming conventions for directories, see ``Filenaming conventions''.

You can create a directory within any directory where you have write permissions. See ``Access control for files and directories'' for details of how to manage access to files and directories.

You can create several directories at the same level. For example, to create directories called directory1 through directory3, use the following command:

   $ mkdir directory1 directory2 directory3
If you need to create an entire directory path at once, use the mkdir -p (path) option. The following command creates a directory called user_guide, and any of the other directories in the specified path that do not already exist:
   $ mkdir -p projects/myprojects/user_guide
Bear in mind that the efficiency of the filesystem has some impact on overall system performance. For example, you should not let your directories grow larger than necessary. Ideally, a directory should contain no more than 640 files (providing that the number of characters in each filename is 14 or less), otherwise it may take the system longer to search the directory whenever you access a file stored in it. If you use longer filenames, the limit may be lower. File size is also significant: large files impose overheads on access. See ``Looking at the contents of a file'' for more information.
Next topic: Listing the contents of a directory
Previous topic: An example: what the system contains

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003