New User? Register here - Existing Users: Username: Password: [Advanced Login]

 

 

Current Poll

Your preferred Interactive shell?









( 1341 votes ~ 14 comments )

 

Weblog entry #2 for mcortese

A handy bash shortcut
Posted by mcortese on Wed 23 May 2007 at 11:50
Tags: ,

I have become conscious that the two commands that I use most of the time in a shell are ls and less, and usually in that exact order. So I spend a lot of time going at the beginning of the current command line and editing the ls into a less.

Now I have added an entry to ~/.inputrc that binds the F12 key to the action "replace the first word with less".

This is the entry:

"\e[24~": "\C-aless\ed\C-e"

Of course, to test it in a shell, one should type:

$ bind '"\e[24~": "\C-aless\ed\C-e"'

 

Comments on this Entry

Posted by drgraefy (128.59.xx.xx) on Wed 30 May 2007 at 16:01
[ Send Message | View Weblogs ]
oh man yes those are my top two commands as well. and the shortcut is a very interesting idea. although the "C-{a,f} 'es'" is so burned into my muscles, i'm not sure learning a new key sequence would be worth the trouble. very neat idea, though.

[ Parent | Reply to this comment ]

Posted by mcortese (213.70.xx.xx) on Thu 31 May 2007 at 17:18
[ Send Message | View Weblogs ]

But the command must be ls (and not, say, file).

And then... One keystroke versus 5! It's a deal! :-)

[ Parent | Reply to this comment ]

 

 

Flattr