Super User is a question and answer site for computer enthusiasts and power users. 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 it possible to get tabs current directory when process is running in that tab without stopping that process? My intention is to create tab next to current with same directory. I sure can press ⌃Z, run dt (ruby script using appscript that duplicates tab) and then fg, but I hope for way without stopping process.

share|improve this question
up vote 1 down vote accepted

In another terminal tab/windows try ps -Exwwww this will list all your processes and their environment which will include PWD which will be the currect directory whe the process started.

You will have to manually work out which process is the one started in the tab.

See Apple's man page for ps. the -E shows the environment and -x all your processes.

share|improve this answer
Is it possible to get that list with better separation of environment variables, as if I have space or = in path, than it will be hard to separate variables. – tig Nov 15 '10 at 20:41
You will have to write a script that cleans up the output from ps – Mark Nov 16 '10 at 9:37

You can append an & to the command so it will run in the background and you will be able to work in the same tab in the current directory.

Simply run: fg &

But, the output of the command will still be displayed in Terminal, to make the command 'quiet' do: fg &> /dev/null &

Hope this helps!

share|improve this answer
1 — I need only to know directory, not to work in same tab, 2 - I need all this when process is already started and I did not know that I will need tab in same dir when starting that process – tig Nov 13 '10 at 20:43
Well, in bash-it there is a tab function to open a new tab with the current directory, but you can't have a process running to use it. – Wuffers Nov 13 '10 at 23:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .