next up previous contents
Next: UNIX File Handling Up: UNIX Help and more Previous: UNIX Help and more

UNIX Directory and Subdirectory Structures

  UNIX directory names are delimited with a slash (/). For example, a pathname consisting of 4 directories might look like this: /users/users2/grad/jones.

Your path is a list of directory pathnames through which the shell searches to find commands.
For example, if your path is set to . /usr/bin  /usr/local/bin and you type print it looks for a file called print, first in your current directory, then in /usr/bin, and then in /usr/local/bin. Changing your path by adding other directory pathnames can be done by adding a suitable command to your .bashrc file, and for ways to do this, refer to section on SHELL Commands.

Directory Manipulation Commands

pwd (print working directory) displays the current default directory.
Format:          % pwd.

cd is used to change directories.
Format:         % cd pathname.

To point to the parent directory (one level up), you can use dot dot ( .. ). For example, to move one level up from where you are now you type:      % cd ..
To move to your home directory simply type:         % cd

mkdir will make or create a new directory.
Format:         % mkdir dirname....

To remove a directory file use a special form of the rm (remove) command, the rmdir command.
Format:          % rmdir dirname

To remove a directory that is not empty, use the rm command with the -r (recursive) switch. USE WITH EXTREME CAUTION!
Format:          % rm -r dir...

ls - the list command, will get a directory of files. The command can take a large number of options to write dates, protection, etc..


next up previous contents
Next: UNIX File Handling Up: UNIX Help and more Previous: UNIX Help and more
Paul A. Sihvonen-Binder
8/8/2014