Supported by: ACS
It is often useful to create subdirectories. For example, you can create a subdirectory under your home directory in which you can store homework files.
To create a subdirectory called Homework, you would enter the following command at a UNIX prompt:
mkdir Homework
Once you've created a directory or subdirectory, you can see it in a file listing. Try using ls to see what is in your current directory. You should see other directory names in the listing, if there are any. If you use ls -l you can see that the directories are labeled with a d at the far left of the permission status codes, as shown below:
drwx------ 2 doylel user 2048 May 15 17:00 test drwx------ 2 doylel user 2048 Jun 29 08:45 Homework
To remove a directory, enter
rmdir directory
replacing directory with the name of the directory you wish to remove.
To remove a directory and all its subdirectories, use the command
rmdir -r directory
Be careful to specify exactly which directory you want to remove!
There is an on line manual page. To read it, enter the command man mkdir at a UNIX prompt.
For general information about working with files, refer to Memo RPI.113, Using UNIX: The Rensselaer Computing System (RCS).
If you name your subdirectories using capital letters, it will be easier to distinguish directory names from filenames when you list the contents of your home directory.
Before you remove a directory, you must empty it. If you want to save a file and put it in another directory, you can do so by moving it with the mv command.
Return to ACS Consulting home page.
Return to the General System page.
Return to ACS home page.
Please send comments and suggestions to
consult@rpi.edu