Get terminal to open in the last visisted folder:
I have longed to get terminal to open in the last visited folder, and ended up making a small bash command that accomplishes that. It furthermore allows one to "cd" to a file, which is very helpful when you want to change your directory to that of a given finder file. Simply write cd, and drag the file to the terminal and your are there.
Add the following to your .bashrc or .alias file
if [ -f "$*" ]
\cd "`dirname $*`"
echo "\cd \""`pwd`\""" > ~/.todir ;
PS1='\[\033]0;`pwd | xargs basename`\007\]\e[31m\w:\e[0m
Finally, you need to change your terminal settings:
In terminal:settings:shell - make the shell complete the following command:
source ~/.todir; clear
Next time you start your terminal - you will automatically be redirected to your last opened directory - the terminal title will change title when you use the cd alias, and your prompt will show the full directory path.