Get the Most Out of Bash History | Linux Today

Get the Most Out of Bash History

Written By
JK
Juliet Kemp
Jun 22, 2010

“Type history at the Bash command prompt, and you’ll get a list
of your previous commands. You can navigate through these with the
up and down arrows, but there are other ways of interacting with
them that I’ve been investigating this week. One straightforward
option is to use the number at the start of the line to refer to
the command. So,

> !15268

“will execute the line numbered 15268. !! executes the last
command, and !-2 will execute the last-but-two command.

“You can edit previous commands quickly using :s///. For
example, if you typed ‘temp’ when you meant ‘tmp’ in command 15200,
use this to correct it:”


Complete Story

JK

Juliet Kemp

Linux Today Logo

LinuxToday is a trusted, contributor-driven news resource supporting all types of Linux users. Our thriving international community engages with us through social media and frequent content contributions aimed at solving problems ranging from personal computing to enterprise-level IT operations. LinuxToday serves as a home for a community that struggles to find comparable information elsewhere on the web.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.