> mostly stupid bash tricks_ 

c u t u p @ c u t u p . o r g


[bash tricks] last modified: 03/25/2007 02:01 pm

some nice bash stuff:

for .inputrc, this one makes up and down scroll through history matching whatever is already entered. If nothing is entered up and down work normally, but if, say vi is entered, it will be like vi ^R. Very nice:

# "\e[A" and "\e[B" being whatever your terminal uses for up & down.
"\e[A": history-search-backward
"\e[B": history-search-forward

for .bashrc, a function that cd's to a directory and lists the contents it takes ls arguments and a directory. for example, cl goes to home dir and lists contents. cl -l goes to ~/ and long lists contents. and cl -lrt public_html shows the contents of public_html in long list reverse time order.

function cl () {
 case $1 in
  -*) local o=$1; shift;; 
 cd $* && ls $o

[All Posts] [top]