Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




NOTE: CentOS Enterprise Linux is built from the Red Hat Enterprise Linux source code. Other than logo and name changes CentOS Enterprise Linux is compatible with the equivalent Red Hat version. This document applies equally to both Red Hat and CentOS Enterprise Linux.

14.7. Finding Commands Quickly

I was looking at a man page yesterday, but I cannot remember the name of the command I was reading about, and I did not write it down. How do I get the man page back?

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 are displayed too quickly for you to read every line.

Another way to view .bash_history is with a utility 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] bar; 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.

Say you were reading the man page the day before, but cannot recall its name. To search for the command, type:

history | grep man

All the commands you typed which have the word man in them are now highlighted.

There are many ways to use your command history. For other tips and tricks, see Section 14.8 Tips on Using Command History.

  Published under the terms of the GNU General Public License Design by Interspire