Using relative pathname notation – HP NonStop G-Series User Manual

Page 115

Advertising
background image

$ pwd

/u/uname/project2
$ cd

To change your current directory to the /status directory, enter the cd command with the relative
pathname, as follows:

$ cd reports/status

$ pwd

/u/uname/reports/status

Using Relative Pathname Notation

You can use the following relative pathname notation to change directories quickly:

Dot notation (. and ..)

Tilde notation (~)

Every directory contains at least two entries represented by . (dot) and .. (dot dot). These entries
refer to directories relative to the current directory:

This entry refers to the current directory.

.

(dot)

This entry refers to the parent directory of your current
directory. The parent directory is the directory immediately
above the current directory.

..

(dot dot)

To display the . and .. entries as well as any files whose names begin with a period, use the -a
flag with the ls command.

In the following example, first change to your home directory and then change to the /reports
directory:

$ cd

$ cd reports

The following ls command displays the contents of the /reports directory, including the /status
subdirectory you created earlier:

$ ls

file1 file2 file3 notes status

The following ls -a command lists all directory entries including relative directory names that
begin with a . (dot) and a .. (dot dot):

$ ls -a

. .. file1 file2 file3 notes status

You can use the relative directory name .. (dot dot) to refer to files and directories located above
the current directory. That is, if you wish to move up the directory tree one level, you can use the
relative directory name for the parent directory rather than using the full pathname.

In the following example, the cd command changes the current directory from /reports to your
home directory, which is the parent directory of /reports. Remember that the /u/uname entry
represents your home directory.

$ pwd

/u/uname/reports

$ cd ..

Changing Directories (cd)

115

Advertising
This manual is related to the following products: