b5media.com

Advertise with us

Enjoying this blog? Check out the rest of the Technology Channel Subscribe to this Feed

New Linux User

HOWTO: Use Bash More Effectively Part 1

by Jon on April 6th, 2006

I recently decided to take my LPI exams and ordered a couple of books to prep for it. The first one I’m reading is the LPI Linux Certification In a Nutshell by Jeffrey Dean. The book starts by jumping right into bash commands. So, guess what? You get to learn along with me.

I think that most of us know that pressing the up and down arrows while in the shell (or terminal window or command prompt) will iterate you through the last 500 commands you’ve typed. Those commands are stored in your ~/.bash_history file.

What I didn’t know is that there’s a whole lot of other ways to iterate through your bash history. A lot of the commands are really arcane, but some of the more interesting ones are:

  • control-p: previous command in history ->same as up arrow
  • control-n: next command in history -> same as down arrow
  • control-a: go to the beginning of the line
  • control-e: go to the end of the line
  • control-l: clear the screen
  • alt-d: delete the word (actually ‘meta key’ and d - may not be your alt key

By far the most useful is control-p and control-n. Very cool.

POSTED IN: How To

2 opinions for HOWTO: Use Bash More Effectively Part 1

Have an opinion? Leave a comment:




Check Spelling
Activate Spell Check while Typing