0

I'm on OS X, using Terminal (bash) to connect to my web server. I'd like to set up the Profile so that it opens to a specific subdirectory after ssh connects.I don't always want to start in this directory — this profile is meant for managing a specific area of the server.

Right now I have the profile set up in the Terminal Preferences > Profile > Shell > Startup > Run command: ssh me@server.com; cd sub/folders/

Of course, ssh connects and the second command never runs. Any way to do this within a Terminal profile?

1

Thanks to @rickfillion:

ssh -t me@server.com "cd sub/folders/; bash -l"
0

ssh user@ip cd /path/to/dir SHOULD do it fine OR set it in the ssh_config file for that connection even:

  • Your first answer runs the command then exits the ssh connection immediately. If I understand your second, it would run it every time I connect, which I don't want (as stated in my question). Thanks, though. – bobtiki May 3 '15 at 1:42
  • I was assuming you wanted every time if not use rickfillion's response – linuxdev2013 May 3 '15 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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