40 Comments
- merreborn, on 10/12/2007, -0/+11man bash is 2,500 lines. A summary is welcomed.
- slackerbox, on 10/12/2007, -0/+10Windows XP? Where are you getting that from?
- mackstann, on 10/12/2007, -0/+5If you're a vi user, "set -o vi" is the best shortcut. (Although last I checked, bash's vi mode was buggy -- pdksh's is better)
- inactive, on 10/12/2007, -2/+6It has as much to do with WinXP as WinXP has to do with the linux/unix category this story was put into...
- emostar, on 10/12/2007, -0/+4They left off a very useful one:
CTRL+W : Delete word backwards
And these can be used on any software that uses the readline library. For example, all of the above work with postgresql's command line client. - fizzeh, on 10/12/2007, -0/+4Just open up Terminal
- MrGeneric, on 10/12/2007, -1/+4Try Cygwin, I find that running BASH on Win XP very useful.
http://www.cygwin.com/ - mackstann, on 10/12/2007, -1/+4Not really. I would argue the opposite: that incessant blabbing about AJAX, Nintendo, Apple, and Firefox are pretty non-geeky. (Not that I am against any of these things -- just making a point.)
- Kamaji, on 10/12/2007, -0/+3And things like the interactive python interpreter.
Even standard input used in python scripts has this sort of support. - merreborn, on 10/12/2007, -0/+3From the 900 line file I get running "man readline"
This manual page describes only the most basic use of readline. Much
more functionality is available; see The GNU Readline Library and The
GNU History Library for additional information.
As such, I can understand how most folks might not quite be hip to the ins and outs of readline. - bottar, on 10/12/2007, -1/+4My favorite is:
set -o vi
Then I can use vi commands to manipulate the cli.
The default mode, I believe, is emacs mode. Hence all the ctrl- ?
I'm not an emacs user so I can't say whether the short cut list is what an emacs person would do.
But if your into vi/vim. Try putting the line 'set -o vi' in your .bashrc - Xiol, on 10/12/2007, -0/+2I'm not calling dupe on this or anything, but I swear I've seen like 4 of these "bash shortcut" links on Digg's homepage now in the past week!
- karamba_kid, on 10/12/2007, -0/+2actually...
$ man bash | wc -l
Reformatting bash(1), please wait...
4917 - Kamaji, on 10/12/2007, -0/+2and, if people are frustrated that they can no longer get to the beginning of the line quickly, use ALT-0 when in vi insert mode.
This replaces the emacs mode CTRL-A.
Using GNU screen no longer makes command line editing a nuisance with vi mode. (it uses CTRL-A for it's control) - emostar, on 10/12/2007, -1/+3You must not be looking that hard, cuz here are some from 'man readline':
Killing and Yanking
kill-line (C-k)
Kill the text from point to the end of the line.
backward-kill-line (C-x Rubout)
Kill backward to the beginning of the line.
unix-line-discard (C-u)
Kill backward from point to the beginning of the line. The killed text is saved on the
kill-ring. - mackstann, on 10/12/2007, -0/+2Kamaji, you just hit escape then 0. I'm pretty sure the alt thing won't always work depending on how your terminal handles meta/escape crap. If escape 0 isn't quick enough then why do you want to use vi mode in the first place? :P
- Mooseknuckle, on 10/12/2007, -0/+1I agree ... this page is just the emacs mode for cmd-line editing ... vi users will be much happier with the vi syntax cmdline editor...
- bigsmoke, on 10/12/2007, -0/+1Of course, I'm biased, but I find my own list of Bash keyboard shortcuts [http://www.bigsmoke.us/readline/shortcuts] a little more useful. By the way, as others have probably already mentioned, most of these shortcuts are not bash specific, but available in all applications that use libreadline.
- mattclare, on 10/12/2007, -0/+1"Ctrl + d - Delete from under the cursor"
Really, I thought it was disconnect? I don't know of any default environments (OSX, RedHat/Fedora, Gentoo, IRIX off the top of my head) where ctrl+d is not disconnect or kill bash. - CharlesDarwin, on 10/12/2007, -2/+3fscking noobs!
- pixelbeat_, on 10/12/2007, -0/+1Most of the keys presented are actually implemented by
the readline library, and so apply also to python, gnuplot, ftp, bc, ...
Note a lot of the keys presented you would never use.
I've documented the most useful ones previously here:
http://www.pixelbeat.org/lkdb/readline.html - Kamaji, on 10/12/2007, -0/+1well, the answer generally is, I don't use vi mode. I'm an avid vi user, but alas, it doesn't seem to cut it for the command line. I tried it once back a while back, but it was just too slow for certain operations (like this). I thought I'd give it a try again.
- x3n1, on 10/12/2007, -0/+1Another useful command not mentioned is bg, for instance, say you start comipiling XYZ software using `make' but you want to interrupt it for whatever reason, use `ctrl + z' - once you have suspended your task you can either resume in the foreground using `fg', or send the process into the background using `bg'. Using `bg' acts the same way as doing a `make &' which is a subprocess of your shell... you can also list all the background subprocesses using `ps' and can `kill' the process now if you want.
See http://www.tldp.org/LDP/abs/html/index.html for more information on advanced BASH scripting. - idonthack, on 10/12/2007, -0/+1"member since: November 23, 2005"
If it's taken you *that long*, you really shouldn't be here. - aroedl, on 10/12/2007, -0/+1WTF!!!
We had these Bash Shell Shortcuts at least 4 times now - exaclty the same text. How often do we need "Bash Shortcuts" (man readline!) and "100 Alphabetically Sorted Linux Commands" (man )? - jordan314, on 10/12/2007, -1/+1lol, as elite as your comment was, I had to laugh, because I do have a noob friend who, any time he has a problem with os X, boots into single user mode and runs fsck -y. You're not getting email? Run fsck! Your mouse batteries are dead? Run fsck! You're having problems with your girlfriend? Run fsck!
I applaud your pun.
I found this article very useful though, I didn't know a lot of it. My two cents: As mentioned in the comments, hitting escape instead of holding down ALT works on macs and SSH. And mac's terminal has a nice window preference where you can option + click to jump the cursor to where you clicked, which is awesome. - MrGeneric, on 10/12/2007, -2/+2Try Cygwin, I find that running BASH on Win XP very useful.
http://www.cygwin.com/ - assadyoussef, on 10/12/2007, -3/+3Like a summarized man bash or man readline...
- diecastbeatdown, on 10/12/2007, -1/+1really useful? i'll have to say not.
ctrl+a and ctrl+e are a must know, in IOS or most any shell that will work. the rest is kind of fluff. your better off just piping your history into less or a grep or something instead of trying to memorize all these shortcuts. and if you don't know tab completion and tab shortcuts already then stop now. ;P - idonthack, on 10/12/2007, -0/+0wrong reply bury plz
- dickdok, on 10/12/2007, -3/+2Nice, Really useful. One doesn't get to see these shortcuts in a man command.
- MikeDubb, on 10/12/2007, -1/+0Very handy! Well, a couple of them at least...
- jwolf, on 10/12/2007, -3/+2You tell me this now, after I just went out and bought a new MacBook to replace my aging linux laptop!
How inconsiderate ;) - jwolf, on 10/12/2007, -3/+1I was kidding ;) Oh well.
- seventoes, on 10/12/2007, -4/+2You could always do them, you just didnt know them.
- digitalpoint, on 10/12/2007, -4/+2Very nice... I've always wished I could do some of those.
- neave, on 10/12/2007, -5/+2Oh dear.
I have just come to realize how unforgivably geeky Digg really is. - oooo, on 10/12/2007, -7/+2Doh! You need to upgrade, it's in Vista.
- oooo, on 10/12/2007, -13/+1eh? Weird, that comment got posted twice... so I'm editing and blabbing on. Someone please bury this one since I can't figure out how to delete a comment?
- Mooseknuckle, on 10/12/2007, -23/+3and this has "WHAT" exactly to do with Windows XP?
No digg ...


What is Digg?
Browsing Digg on your phone just got easier with our enhancements to the