Nifty app offers expanded access to terminal history

Reusing Previous Commands with the Bash History Suggest Box

© Lead Image © lightwise, 123RF.com

© Lead Image © lightwise, 123RF.com

Article from Issue 164/2014
Author(s):

You can always browse the Bash history using your arrow keys, but Bash's search capabilities are very limited. Enter the clever Bash History Suggest Box.

When you are working at the command line, you often need to repeat or slightly modify previously entered commands. Most experienced users know they can browse the Bash history quite simply by pressing the up and down arrows at the command line, then pressing the left and right arrows to move the text cursor.

Fewer users know that you can also search the Bash history by pressing Ctrl+R and then typing; the shell automatically retrieves the first matching result. Continuing to press Ctrl+R jumps from match to match until you find the command you are seeking.

Bash keeps track of all the commands typed at the command line in the ~/.bash_history file, and you can view the file with the history command (Listing 1).

[...]

Use Express-Checkout link below to read the full article (PDF).

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • McFly

    When it comes to working at the command line, using Bash history effectively can save you time. McFly extends the Bash history's features and helps you find past commands more quickly.

  • Effectively using Bash history

    You can do more with the Bash history command than just using the arrow keys. We show you how to use this command-line tool more efficiently.

  • Don't Know Much About History

    The versatile Bash history command can save you time and effort at the command line.

  • History Lesson

    For admins like Charly, who try to avoid typing at all costs, the shell offers an excellent opportunity to avoid wear on your fingertips in the form of built-in history.

  • Command Line

    A few basic tricks can liven up the command line and add a dash of color to your console.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News