There is additional information about directories, how to create them, how to move to specific directories, etc., in the Unix 7 page, under "Common Unix Practices" and "Directory Path Names."
Any directory may, in turn, have "subdirectories," producing a tree-like structure and organization for files.
In general, it is a good idea for students to create a separate directory for each course and then to create separate subdirectories for each program.
mkdir Ma10
(A standard convention is to begin the names of any directory
with a capital letter.)
By itself
cd
will shift to the user's home directory (the directory
one is in initially upon login).
To move to a subdirectory, one indicates the name of the directory after the command, for example:
cd Ma10
To move to a parent directory, one put two dots as the
"directory name," for example:
cd ..
If one has created subdirectories within a directory (for example,
a directory Mp1 within Ma10, then one
can change to that directory (from the root ["home"] directory)
either in two steps, as follows:
cd Ma10
cd Mp1
or in one step as follows:
cd Ma10/Mp1
To verify (or find out) which directory one is in at any
time, one can issue the "present working directory" Unix command,
abbreviated pwd, which will return the full "pathname"
of the current directory
The tilde, ~, indicates the user's home directory (see Unix 7, "Directory Path Names" for more information). By using the tilde with any full directory name, one can change from one subdirectory to another subdirectory. For example, no matter which subdirectory one is currently in, the following command:
cd ~/Ma10/Mp1
will switch from the current directory to the indicated directory
without first changed to the home directory.
One can also use the command pushd ("push" onto the the "directory" stack) or popd ("pop" from the "directory" stack) to shift between subdirectories and "remember" the previous directories one has been previously in. To recall all directories on the "directory stack," one uses the Unix command dirs.
After the course directory and the assignment subdirectory have been created, for subsequent logins, one need only type in the command, for example:
cd Ma10/Mp1
to connect to the correct directory for the currect course (e.g.,
Ma10) and current assignment (e.g., Mp1).
Using this procedure, all work for other courses and other assignments will be in different subdirectories and there will be no name conflicts with files.
This page is maintained by Dennis C. Smolarski, S.J.
dsmolarski@math.scu.edu
© Copyright 1999 Dennis C. Smolarski, SJ, All rights reserved.
Last changed: 14 April 1999.