24/7/09

Some really usefull Bash keyboard shortucts.

I have a lot of RSS feeds, and at least once a month I recive an "Usefull bash tips" news, but they are always the same !


Here are some of the best ones that I really use every time I write in Bash, they are like reflexes now xP.



A = Alt
C = Ctrl

C-w : cut backwards until a blank space, and put that in the buffer.
A-backspace : cut backwards until a word delimiter character (usually ",./?%&#:_=+@~"), and put that in the buffer.
A-d : the same but cut forwards.
C-y : paste buffer.
C-7 : undo (really, bash has undo and I never seen this anywhere).
C-left-arrow : jump backwards by word delimiters.
C-right-arrow : try to guess (this ones also work in graphical environments).
A-. : previous argument (the last command's rightmost blank-delimited characters)

This one is so useful I'll leave an example of use:
$ ls -sh Apps/Torrents/pr0n.avi
1.2GB pr0n.avi
$ rm (A-.)

that will insert "Apps/Torrents/pr0n.avi" and when entering will try to remove it, hopefully pr0n.avi is read-write protected ...


No hay comentarios: