New Command (alias)

Bill Vance kbun at xpresso.seaslug.org
Wed Aug 27 05:59:03 UTC 2014


Howdy Folks;

While I haven't seen much of it, it seems logical
to me, that this list is not just about problems,
but also bout passing along the, "little goodies",
that we come across.  Well here's one for you.

Cd-ing down into a long string of directories one
dir name at a time is one thing, but using cd to
try to negotiate back up a few dirs, can be
downright cumbersome.

Conversely, I've allways liked the way ftp
handled this with it's, "cdup", command.  After
playing with it a while, I think I've found the
most elegant version to date.  After you've
checked it out in a shell, you're probably
going to want to cut/paste it in with the other
aliases in your /home/$USER/.bashrc file. 
So anyway, here it is.

   alias cdup='cd $(dirname $PWD)'

The dirname command simply chops the last name
off of a directory string, in this case, the
Present Working Directory, and there you have
it.  Enjoy.

Bill




More information about the kubuntu-users mailing list