Prev | Current Page 172 | Next

Christopher Negus

"Linux Bible, 2008 Edition: Boot up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions"


Locating Commands
If you know the directory that contains the command you want to run, one way to run it is to type
the full, or absolute, path to that command. For example, you run the date command from the
/bin directory by typing:
$ /bin/date
Of course, this can be inconvenient, especially if the command resides in a directory with a long
path name. The better way is to have commands stored in well-known directories, and then add
those directories to your shell??™s PATH environment variable. The path consists of a list of directories
that are checked sequentially for the commands you enter. To see your current path, type the
following:
$ echo $PATH
/bin:/usr/bin:/usr/local/bin:/usr/bin/X11:/usr/X11R6/bin:/home/chris/bin
The results show the default path for a regular Linux user. Directories in the path list are separated
by colons. Most user commands that come with Linux are stored in the /bin, /usr/bin, or
/usr/local/bin directory. Although many graphical commands (that are used with GUIs) are
contained in /usr/bin, there are some special X commands that are in /usr/bin/X11 and
/usr/X11R6/bin directories. The last directory shown is the bin directory in the user??™s home
directory.
If you want to add your own commands or shell scripts, place them in the bin directory
in your home directory (such as /home/chris/bin for the user named chris).


Pages:
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184