Remember the path of last login

create ~/.bash_logout

with the following contents:

1
2
t=`readlink -f \`pwd\``
ln -sfn $t ~/lastdir

Each time when you log off, the current dir is remembered and a symlink is created in ~/ .
It’s convenient for the next time:)

NOTE:
1. “readlink -f” to ensure you ALWAYS get the really full path (or you will have recursive symlink if you are leaving a path with smylink in it)
2. “ln -sfn” allows you to overwrite the existing symlink

Share this:
Facebook Linkedin Twitter Digg Email

Leave a Reply