Examples of using relative pathnames

To give a relative path to a file below your current directory:

   pwd (prints the current directory)
   /home/eucs/jane (the full pathname to the current directory)
   ls -l presentation/docs/oview.html (lists information
                                       on the file)

This defines the file oview.html in the directory docs which is in the directory presentation which itself is a directory in the current directory.


To define a file that is in another directory:

   pwd (prints the current directory)
   /home/eucs/jane/presentation/docs (the full pathname)
   cd ../illustrations (use relative pathname)
   pwd (check the current directory)
   /home/eucs/jane/presentation/illustrations

The user jane uses the relative pathname ../illustrations to move up to the directory presentation and then down into the directory illustrations.


To give a pathname using the ~ character:

   cp ~fran/tmp/for_mike.txt

This copies the file for_mike.txt from the directory ~fran/tmp. The ~ (tilde) character is used to save giving the full pathname to fran's home directory.


[Home] [Search] [Index] This site maintained by bondaren@thsun1.jinr.ru