12.07.2015 Views

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

Red Hat Enterprise Linux 5 Administration Unleashed

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

108CHAPTER 4Understanding <strong>Linux</strong> ConceptsReplace with the directory to start looking in. It will look recursivelythrough the directory, meaning that it will look in any subdirectories, subdirectories ofthe subdirectories, and so on. Replace with the filename for which you aresearching. To search in the current directory and below, replace with a dot(.) character such as:find . -name guidelines.txtFinding CommandsIf you know a command exists on the system but keep getting the error message commandnot found, check to make sure you are typing the command correctly. Otherwise, itmight not be in your PATH environment variable. To view the value of your PATH, executethe command echo $PATH from the command line. As you can see, your PATH is a list ofdirectories. When you execute a command without providing its full path, it must be inone of the directories listed in your PATH. Otherwise, the command not found error isdisplayed. You can provide the full path to the command if you know it, such as/sbin/lspci to execute the command to list the PCI devices. If you use the commandoften, but it is not in your PATH, you can add the directory to your PATH.To add a directory to your path, modify the .bashrc file in your home directory. Refer tothe “Editing Text Files” section later in this chapter if you don’t know how to modify atext file. For example, to add the /usr/sbin/ and /sbin/ directories to your PATH, add thefollowing line to the .bashrc file in your home directory:export PATH=:$PATH:/usr/sbin:/sbinIt is not recommended that you add the dot (.) character to your path so that it includeswhatever the current working directory is. Although this might be tempting when writingand testing your own scripts, it is a security risk because an authorized or nonauthorizeduser can place a different version of common commands in a directory you are likely tobe in while executing them such as the /tmp/ directory, which is writable by all users. Forexample, if someone places a different version of the command ls in the /tmp/ directoryand (which represents the current working directory) is listed before /bin in your PATH,you will be executing a different version of ls, which could contain code to do somethingharmful to your data or the system. If you need to execute a command in the currentworking directory, precede it by ./ such as ./test.pl or provide its full path whenexecuting it.TIPTo verify which command you are executing, type the command which . If amatch to the command is found in the directories from your PATH, the full path to thecommand is displayed.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!