Owner's manual

$ pwd
/u/uname
To move up the directory structure more than one level, you can use a series of relative directory
names, as shown in the following example. The response to the following pwd command, the /
(slash) entry, represents the parent directory of your home directory.
$ cd ../..
$ pwd
/
You can use ~ (tilde) to specify a user’s home directory. For example, to specify your own home
directory, use the tilde alone as follows:
$ cd ~
Used with the cd command, the tilde notation does not save you keystrokes because in the OSS
shell you get the same results by merely entering cd without specifying a pathname.
However, if you wish to access a directory below your home directory, using the tilde notation
can save you keystrokes. For example, to access the /reports directory from anywhere in the
file system, enter the following:
$ cd ~/reports
Tilde notation is also very useful when you wish to access a file or directory either in or below
another user’s home directory. You may not know the precise location of that user’s home directory
but, assuming you have the appropriate permissions, you could get there with a minimum of
keystrokes.
For example, from any place in the file system, you could specify the home directory of a
hypothetical user jones by entering the following:
$ cd ~jones
In addition, if you want to change your current directory to a directory named /status that is
under /jones, you can enter the following:
$ cd ~jones/status
Displaying Directories (ls -F)
A directory can contain subdirectories as well as files. To display subdirectories, use the ls -F
command. This command displays the contents of the current directory and marks each directory
with / (a slash character) so that it can be readily distinguished from a file.
The general format of the ls -F command is as follows:
ls -F
In the following example, first return to your home directory and then enter the ls -F command
to display the directory contents:
$ cd
$ ls -F
file1 file3 project2/ record6
file2 project/ record1 reports/
Note that the /project, /project2, and /reports directories are marked with a slash.
You can define an alias for the ls command so that, whenever you enter ls, the ls -F command
is executed. For more information on defining aliases, see Chapter 3 (page 31).
116 Managing Directories