Читать книгу Linux Bible - Christopher Negus - Страница 95
TIP
ОглавлениеSometimes, you run a command and receive an error message that the command was not found or that permission to run the command was denied. If the command was not found, check that you spelled the command correctly and that it is located in your PATH
variable. If permission to run the command was denied, the command may be in the PATH
variable but may not be executable. Also remember that case is important, so typing CAT or Cat will not find the cat
command.
If a command is not in your PATH
variable, you can use the locate
command to try to find it. Using locate
, you can search any part of the system that is accessible to you. (Some files are only accessible to the root user.) For example, if you wanted to find the location of the chage
command, you could enter the following:
$ locate chage /usr/bin/chage /usr/sbin/lchage /usr/share/man/fr/man1/chage.1.gz /usr/share/man/it/man1/chage.1.gz /usr/share/man/ja/man1/chage.1.gz /usr/share/man/man1/chage.1.gz /usr/share/man/man1/lchage.1.gz /usr/share/man/pl/man1/chage.1.gz /usr/share/man/ru/man1/chage.1.gz /usr/share/man/sv/man1/chage.1.gz /usr/share/man/tr/man1/chage.1.gz
Notice that locate
not only found the chage
command, it also found the lchage
command and a variety of man pages associated with chage
for different languages. The locate
command looks all over your filesystem, not just in directories that contain commands. (If locate
does not find files recently added to your system, run updatedb
as root to update the locate database.)
In the coming chapters, you learn to use additional commands. For now, I want you to become more familiar with how the shell itself works. So next I discuss features for recalling commands, completing commands, using variables, and creating aliases.