Web page hosting, cheap domain name & website promotion services
  

 Home

Red Hat Linux 7.2: The Official Red Hat Linux Getting Started Guide
PrevChapter 13. Frequently Asked QuestionsNext

Finding Commands Quickly

Q: Locating Previously Used Commands

I was looking at a man page yesterday, but I can't remember the name of the command I was reading about, and I didn't write it down. How do I get the man page back?

A: Searching .bash_history

Probably, the command you used is stored in a file called .bash_history. By default, this file records the last 500 commands you typed at the shell prompt.

You can glimpse the history of your commands by typing history at the shell prompt, but the results will speed by quickly.

Another way to view .bash_history is with a pager such as less. Type less .bash_history at the shell prompt and the results will display one page at a time. To move forward a screen, press the [Space]; to move back a screen, press the [b] key, and to quit, press [q].

Paging through .bash_history to find a command can be tedious. Alternatively, you can search through the file for keywords using grep, a powerful search utility.

Let's say you'd been reading the man page the day before, but can't recall its name. To search for the command, type:

history | grep man

You'll see a list of all the commands you typed which have the word man in them.

There are plenty of ways to your command history. For other tips and tricks, see the section called Tips on Using Command History.


PrevHomeNext
Accessing a Windows PartitionUpKeep ls Output from Scrolling
 

 

 

 

Website promotion and ranking services | Active-Domain.com: Domain name registration | Cheap domain registrar 

Disclaimer: For authoritative source or latest update to this documentation, please refer to http://www.redhat.com/docs/manuals/linux/

 

 
Quotes: Good humor is a tonic for mind and body. It is the best antidote for anxiety and depression. It is a business asset. It attracts and keeps friends. It lightens human burdens. It is the direct route to serenity and contentment.