OnWorks Linux and Windows Online WorkStations

Logo

Free Hosting Online for WorkStations

< Previous | Contents | Next >

Note that when using the export command in a shell, the changes are temporary and only valid for this session (until you log out). Opening new sessions, even while the current one is still running, will not result in a new path in the new session. We will see in Section 7.2 how we can make these kinds of changes to the environment permanent, adding these lines to the shell configuration files.


image


3.2.2. Absolute and relative paths


A path, which is the way you need to follow in the tree structure to reach a given file, can be described as starting from the trunk of the tree (the / or root directory). In that case, the path starts with a slash and is called an absolute path, since there can be no mistake: only one file on the system can comply.


In the other case, the path doesn't start with a slash and confusion is possible between ~/bin/wc (in the user's home directory) and bin/wc in /usr, from the previous example. Paths that don't start with a slash are always relative.


In relative paths we also use the . and .. indications for the current and the parent directory. A couple of practical examples:


When you want to compile source code, the installation documentation often instructs you to run the command ./configure, which runs the configure program located in the current directory (that came with the new code), as opposed to running another configure program elsewhere on the system.

• In HTML files, relative paths are often used to make a set of pages easily movable to another place:

<img alt="Garden with trees" src="../images/garden.jpg">

theo:~> ls /mp3

ls: /mp3: No such file or directory theo:~>ls mp3/

oriental/ pop/ sixties/

theo:~> ls /mp3

ls: /mp3: No such file or directory theo:~>ls mp3/

oriental/ pop/ sixties/

• Notice the difference one more time:


image


Top OS Cloud Computing at OnWorks: