Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to make the default ssh location be the folder that was current when last logged out?

I'm using bash and Ubuntu, so it looks like I could use the .bash_logout file to set a variable, but was wondering whether there is a better(/more correct) way.

share|improve this question
With 'location' you mean your cwd (current working directory) and with 'folder' you mean directory? – mghocke Aug 6 '12 at 14:07

Use Gnu Screen is maybe the solution. Your shell stay open in screen (with your history, your path, your variables). Just connect to your server by SSH and do the screen -r to restore the session.

share|improve this answer
And you can happily put screen -r (or -R or -x) in your .profile so you don't even have to type it when you log in. – Ladadadada Aug 6 '12 at 8:06
Makes logging out a bit tricky, though. – womble Aug 6 '12 at 8:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.