HOWTO: Use Bash More Effectively Part 1
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.
Related Stories
POSTED IN: How To
2 opinions for HOWTO: Use Bash More Effectively Part 1
warren
Apr 10, 2006 at 5:59 pm
this is natural for emacs users — those same commands do the analogous operation in emacs.
Jon
Apr 10, 2006 at 7:03 pm
Which came first? The BASH or Emacs?
:)
Have an opinion? Leave a comment: