Kjetil's Information Center: A Blog About My Projects

X Terminal Directory Hack

When working under the X Window System environment with multiple terminals opened, I usually work in the same directory on the file system. Instead of manually changing directory every time a new terminal is opened, I had an idea to do it with shell functions like this:

function mk { pwd | xclip; }
function rt { cd `xclip -o`; }
          


These functions will use the X clipboard to store and retrieve the current directory using the xclip tool. This way, the current directory can be marked (mk) in the terminal currently in use and retrieved (rt) in the new terminal afterwards.

Topic: Configuration, by Kjetil @ 17/08-2009, Article Link