Wednesday, September 7, 2011

Sticky session on Linux

Today i stumbled upon the slides from a talk given at Confoo 2011 by Sean Coates called "Fifty Tips, Tricks and Tools ...in one talk". Most of the stuff was not new to me, but still informative. But slide 56 gave a very usefull snippet "Sticky shell start", which allows you to login and be placed where the last shell operated.

You should place the following snippit in your ~/.bashrc or ~/.profile

cd () { builtin cd "$@" ; pwd > ~/.pwd ; }
cd "`cat ~/.pwd`"  

To me this is very usefull since i often jump between different servers and often need to go to the same place every time. so this saves me a lot of typing.

No comments: