Quick Start Guide
Relative Path
Enter a path to the relevant le or directory by using the current directory as a
starting point. This implies to give the levels you have to move up or down in the
le system tree to reach the target directory of le, starting from the current di-
rectory.
Paths contain lenames, directories or both, separated by slashes. Absolute paths
always start with a slash. Relative paths do not have a slash at the beginning, but
can have one or two dots.
When entering commands, you can choose either way to specify a path, depending
on your preferences or the amount of typing, both will lead to the same result. To
change directories, use the cd command and specify the path to the directory.
NOTE: Handling Blanks in Filenames or Directory Names
If a lename or the name of a directory contains a space, either escape the space
using a back slash (\) in front of the blank or enclose the lename in single quotes.
Otherwise Bash interprets a lename like My Documents as the names of two les
or directories, My and Documents in this case.
When specifying paths, the following “shortcuts” can save you a lot of typing:
•
The tilde symbol (~) is a shortcut for home directories. For example, to list the
contents of your home directory, use ls ~. To list the contents of another user's
home directory, enter ls ~
username
(or course, this will only work if you have
permission to view the contents, see Section 6.3, “File Access Permissions”
(page 81)). For example, entering ls ~tux would list the contents of the home
directory of a user named tux. You can use the tilde symbol as shortcut for home
directories also if you are working in a network environment where your home
directory may not be called /home but can be mapped to any directory in the
le system.
From anywhere in the le system, you can reach your home directory by entering
cd ~ or by simply entering cd without any options.
•
When using relative paths, refer to the current directory with a dot (.). This is
mainly useful for commands such as cp or mv by which you can copy or move
les and directories.
•
The next higher level in the tree is represented by two dots (..). In order to
switch to the parent directory of your current directory, enter cd .., to go up
two levels from the current directory enter cd ../.. etc.
To apply your knowledge, nd some examples below. They address basic tasks you
may want to execute with les or folders using Bash.
90 Start-Up










