Using the Bash History

Now you know all these awesome commands, but next week you’ll notice you already forgot them. Luckily, there are tools to help us out here too!

You can use the up and down keys to scroll through previously typed commands. And that’s not all. I listed a few history-based time savers in the following table:

CommandExplanation
history nView a maximum of n lines from the history
!!Repeat the last command
!nrepeat command number n from history
!cdRe-run the last command you typed starting with, in this case, “cd”
!*Substitute the arguments from the previous command

Perhaps the most powerful way to use the terminal history is by searching through it. Hit control + r to get a search prompt that matches text from your history. Just start typing any part of a previous command, and you’ll find it back!

Get Certified and advance your career

Our premium courses offer a superior user experience with small, easy-to-digest lessons, progress tracking, quizzes to test your knowledge, and practice sessions. Each course will earn you a downloadable course certificate.

The Python Fundamentals Course For Beginners

Python Fundamentals I is a course for beginners that will get you started with Python in no time. Learn all the essentials, test your progress with quizzes and assignments, and bring it together with the final course project!

The Python Course for Beginners

Modules, Packages, And Virtual Environments

Python Fundamentals II covers creating modules and packages, using virtual environments and Python package managers to make your life as a programmer easier. Advance your productivity as a Python programmer!

If this article helped you, please help us out and share it!

Leave a Comment

I hope you’re enjoying my articles. Perhaps you’d like to sign up for my weekly newsletter as well. You’ll receive:

Super easy to unsubscribe & Your data stays on Python Land.

Footer subscribe

No, thanks!

Share to...