Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Let's assume that you are at /users/cs/uni/databases/python/codes/ and you want to compare the outputs of the same command with different parameters.

The program asks you the outputs such that you would like to have two windows open at the same folder such that you can run simply python code.py at both windows for different parameters.

I would like to know how you open a new tab in Screen such that the location of the new tab is at the folder where you are at. If I open a new tab, the location of the tab is at my Home.

How can you make a new tab open at the current folder in Screen?

share|improve this question
add comment

3 Answers 3

up vote 10 down vote accepted

Just run screen inside screen and it'll open a new window in the current directory.

share|improve this answer
1  
Ouch!! Who would have thought it could be THAT easy? –  innaM Jul 24 '09 at 12:52
    
Very cool! What if we're running some long process and can't get to a prompt, though? –  ojrac Feb 24 '10 at 6:03
    
@orjac: Perhaps ^z, screen, fg ? –  TRS-80 Feb 28 '10 at 17:22
    
Thank you for the answer! - It was easier than I first thought. –  Masi Sep 28 '11 at 21:44
add comment

I usually do a screen -dmS SessionName && screen -r SessionName and I'm in my working dir not my Home dir.

Maybe you have some custom config file ?

share|improve this answer
add comment

How about this:

screen -X chdir `pwd`; screen -X screen

This sets screen's (not your shell's) current directory to your shell's current directory and opens a new window.

You could also do

screen -X chdir `pwd`; screen -X screen; screen -X ~

This will additionally restore screen's current directory to your home directory.

Put that in an alias and you should be fine.

share|improve this answer
add comment

Your Answer

 
discard

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.