This
directory is automatically added to your path in some Linux systems, although you may need to create
that directory or add it to your PATH on other Linux systems. So as long as you add the command
to your bin with execute permission (described in the section ???Understanding File Permissions??? later
in this chapter), you can immediately begin using the command by simply typing the command name
at your shell prompt.
Unlike some other operating systems, Linux does not, by default, check the current directory for
an executable before searching the path. It immediately begins searching the path, and executables
in the current directory are run only if they are in the PATH variable or you give their absolute
address.
If you are the root user, directories containing administrative commands are typically in your path.
These directories include /sbin and /usr/sbin. (You may need to start your shell with a -l or
-login option to have /sbin and /usr/sbin added to your PATH.)
TIP
46
Linux First Steps Part I
The path directory order is important. Directories are checked from left to right. So, in this example,
if there is a command called foo located in both the /bin and /usr/bin directories, the one
in /bin is executed. To have the other foo command run, you either type the full path to the
command or change your PATH variable.
Pages:
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185