How Do I Grep History in Linux?
Contents

How do you grep history?

Use history number | grep keyword the number here refers to how many previous history should be fetched. Example: history 500 will fetch last 500 command of your bash history. To extend your bash history recording add the below lines to your . bashrc file.

How do you check history in Linux?

Another way to get to this search functionality is by typing Ctrl-R to invoke a recursive search of your command history. After typing this, the prompt changes to: (reverse-i-search)`’: Now you can start typing a command, and matching commands will be displayed for you to execute by pressing Return or Enter.

Robert Thorne

Robert Thorne

Automotive & Future Transportation Editor

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.

Share this article
Twitter Facebook Pinterest