Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you open a terminal with a specific path already cd'ed to?

How do I use the terminal to open another terminal window but with a path I specify?

I am using automator to load my work stuff when I get to work, but I need to know how to do this:

Open Terminal and Type:
• cd Work/Company/Project/
• script/server

And then new tab in that terminal window and cd to the same folder.

like image 988
NullVoxPopuli Avatar asked Aug 02 '10 19:08

NullVoxPopuli


2 Answers

This opens a new terminal window from a command prompt on Mac OSX , executes "cd /" and then keeps the window on top:

osascript -e 'tell application "terminal"' -e 'do script "cd /"' -e 'end tell'

You can put this into a script like this:

#!/bin/sh
osascript -e 'tell application "terminal"' -e "do script \"cd $1\"" -e 'end tell'

Hope this helps.

like image 68
Nordic Mainframe Avatar answered Sep 22 '22 06:09

Nordic Mainframe


Use an applescript to do this.

e.g. Open Terminal Here

like image 36
mmmmmm Avatar answered Sep 20 '22 06:09

mmmmmm