DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Managing files

Making directories

The mkdir command makes a directory on a UNIX system. To make a directory, change to the directory under which you want the new directory to live. Then, type mkdir directory, where directory is the name you want to call the new directory, and press <Enter>. If you have permission to write in the current directory, and there is no directory already named directory in the current directory, the new directory is created.

The rules on naming directories are the same as the rules on naming files: do not use a name longer than 256 characters, and do not use the filename metacharacters *, ?, [ ... ]; otherwise, anything goes. A useful convention is to always start directory names with a capital letter. This way, you can differentiate between a file and a directory without doing a long listing (l).

You can make several directories at once by typing:

mkdir directory1 directory2 directory3

Try creating a directory for memos and a directory for reports:

  1. Type cd and press <Enter> to go to your home directory.

  2. List the current directory (your home directory) by typing lf and pressing <Enter>. Check that there are no files or directories named Memos or Reports.

  3. Type mkdir Memos Reports and press <Enter>. This creates two new directories, Memos and Reports.

  4. Type lf and press <Enter> to list your home directory again. The lf command shows the two new directories.
    $ cd
    $ lf
    $ mkdir Memos Reports
    $ lf
    Memos/    Reports/
    

Next topic: Removing directories
Previous topic: Reading just the first or last lines of a file

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