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...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

106CHAPTER 4Understanding <strong>Linux</strong> ConceptsHelpful HintsThe default shell called the bash shell offers many useful shortcuts that can speed up youroperations on the command line. For example, instead of typing the entire command,you can type the first few characters of it and press the Tab key. If no other commandbegins with the characters you have typed, the command will be completed for you. If noresults are displayed after pressing the Tab key once, press it again. If there is nocommand that begins with the character you typed, the cursor will not move and noresults will be displayed. If there is more than one command that begins with the charactersyou typed, pressing the Tab key twice will display them. If there are too manycommands that begin with the characters, you will see a message telling you how manycompletions exist and ask you to confirm whether you want them displayed such as thefollowing example:Display all 112 possibilities? (y or n)Press the Y key to display all the results, or press the N key to go back to the prompt andtype a few more characters to the desired command. Using tab completion takes some practiceand getting used to, but it will quickly increase the speed at which you will be able touse the command line.TIPBecause it sometimes takes pressing the Tab key twice to return results, it is a goodhabit to always press the Tab key twice when using tab completion to speed up theresults.When you type commands at a shell prompt, they are saved as part of your commandhistory so you can reference them later. Type the command history at a shell prompt tosee the results. If you have ever forgotten a recently used command or forgotten whichcommand line arguments you used for a particular command, you can see how thismight be useful. If you know all or part of the command you are searching for, use thefollowing command:history | grep ‘part of the command’The grep command stands for get repetitions. It can also be used when displaying thecontents of files as discussed in the “Reading Text Files” section later in this chapter.Alternately, press the Ctrl and R keys simultaneously. Pressing multiple keys at the sametime is usually written with a plus sign between the keys such as Ctrl+R. This will changethe prompt to read (reverse-i-search)`’: while still providing a cursor to type. Starttyping any part of the previous command you want to recall and you will start seeingresults. If the command displayed is not the one you are searching for, keep typing. Theresults change as you type and completions are found.At a shell prompt, you can also press the up arrow to start listing your command historystarting with the most recently executed ones. After you have initiated the historyscrolling, press the down arrow to go in the opposite direction. Keep in mind that not

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

Saved successfully!

Ooh no, something went wrong!