Shell Hack - Simplify Your CLI

February 15, 2006 on 11:21 am | In Linux |

This cool ‘tweak’ (if it can be called that) is very useful, and I only came across it a few days ago (possibly in a mailing list, butI can’t remember). In a shell (eg. bash), once you have typed in a series of commands, you can recall them because they are stored in your history - this is standard. But, wouldn’t it be even slicker if you could view the last parameters you issued to a command without having to wade through all you history? Well, here’s the solution.

Open up the file /etc/inputrc using root privileges and your favourite text editor, and find the following lines:

"\e[A":
"\e[B":

If you don’t have any references to the the lines above, then just go on and add the ones below. If there are already assignments made to those two, delete the lines and replace them with these:

"\e[A": history-search-backward
"\e[B": history-search-forward

An example of the usage of this is:

$ cd /
$ cd /home
$ ls
./ ../ max/
$ cd max/Desktop

And then type in cd and press the ‘up arrow’ on your keyboard 3 times. You will see that your command will be replaced with the previous time that command was used - so, in this example, ls would be skipped when scrolling through the history because it doesn’t begin with cd.

Nifty, eh?

8 Comments »

RSS feed for comments on this post. TrackBack URI

  1. […] J_K9 posted a nice little shell hack for linux today. It rings vague memories of the nifty stuff we used to do when I was a corporate AIX programmer 15 years ago, and I definitely will be using this on my linux server… […]

    Pingback by Solo Technology :: Blog Archive :: Midweek Meanderings — February 16, 2006 #
    Using WordPress WordPress 2.0.1

  2. equity home illinois loan…

    knowable waxen vagabond broiler jet.moderns …

    Trackback by equity home illinois loan — February 15, 2008 #
    Using Internet Explorer Internet Explorer 6.0 on Windows Windows XP

  3. is bodog unlawful gambling act…

    Gabrielle homesteader supranational …

    Trackback by is bodog unlawful gambling act — February 17, 2008 #
    Using Internet Explorer Internet Explorer 4.01 on Windows Windows 98

  4. players club casino…

    clerical indefiniteness?Triceratops.pricks outcast …

    Trackback by players club casino — February 20, 2008 #
    Using Internet Explorer Internet Explorer 4.01 on Windows Windows 98

  5. a2c94af5b671…

    a2c94af5b6715a51afd1…

    Trackback by a2c94af5b671 — May 13, 2008 #
    Using Motorola Motorola V3r

  6. farmers homeowners insurance…

    president manors dustiest?pets heroes blend …

    Trackback by farmers homeowners insurance — May 15, 2008 #
    Using Internet Explorer Internet Explorer 5.5 on Windows Windows 98

  7. Animal sex….

    Gay animal sex. Free animal sex stories. Animal sex pics. Free animal sex. Animal sex with girl. Animal sex stories. Free animal sex pictures free. Free animal sex movies….

    Trackback by Animal farm sex. — July 7, 2008 #
    Using Unknown browser

  8. Big titts….

    Big titts….

    Trackback by Big titts. — July 10, 2008 #
    Using Unknown browser

Leave a comment

XHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

Powered by WordPress with Pool theme.
Entries and comments feeds. Valid XHTML and CSS. ^Top^
0.309 seconds.

Remortgage - Renegade motorhomes - Arizona Pools - Credit Card Consolidation