Problem:
I want to create a server-www
alias that connects me to the SSH server and change the directory to /var/www/
right after the connection.
There it is :
ssh -t server 'cd /var/www && $SHELL'
And for the alias, add this in your ~/.bashrc
:
alias server-www="ssh -t server 'cd /var/www && $SHELL'" server-www # test it !
References :