5

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?

3 Answers 3

12

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

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

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 ?

1

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.

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.