views:

49

answers:

1

Hello All,

when you do an "ssh second_machine" you are able to connect to second_machine on your home directory

But usually i am working in my_machine in directory with very long path, and i want to connect to second_machine and move to my working directory right away. So everytime i have to:

ssh second_machine
cd /very/long/path/to/directory/

Is there a way to make it automatic ?? ( ssh automatically go to the desired directory )

Thanks,

Debugger

+2  A: 

This should work for you

ssh  -t second_machine "cd /very/long/path/to/directory/; bash"

Assumes you're wanting to run bash, substitute for a different shell if required.

Garethr
That meets the specifications !! Thanks :)