About Red Hat Partner Programmes Training Support and Docs Products and Services
  downloadstorecart
red hat logo search    
redhat.comredhat network
Red Hat Documentation

Tips on Using Command History

Tips on Using Command History

Q: Tips and Tricks for history

What are some other ways I can use command history?

A: Using More Command History

If you type history, you'll see a numbered list flash by, showing you the previous 500 commands you'd used.

You probably don't need to see all of the last 500 commands, so the command history 20 might be more useful -- where 20 is the previous 20 commands you'd typed. (You can use any number to reveal a specific number of previous commands.)

Other Shortcuts

Here are other command history shortcuts which may come in handy for you:

  • "Bang, bang": Typing !! (called "bang bang") executes the last command in the history.

  • "Bang number": Typing !number (as in !302) will execute the command which is numbered 302 in the history file.

  • "Bang string": Typing !string (as in !rpm) will execute a command with that matching string from the history file.

  • Up arrow and down-arrow: At the Bash shell prompt, you can simply press the Up arrow to move back through previous commands in your history list (the Down arrow will move you forward through the commands) until you find the command you want. Press Enter to execute the command, just as if you had typed it on the command line.

 

 
 
© 2001 Red Hat, Inc. All rights reserved.       About Red Hat   :   Legal statement   :   Privacy statement   :   Y2K statement   :   Contact Red Hat