0

In order to open a new screen window in the same directory as the current working directory of the screen window you are launching it from (rather than the directory you initially launched the screen session from), this works:

Using screenrc, how can I make `C-a c` open a new window at the current window's working directory?

...unless the current screen session has had its name set with C-a, :sessionname. In that case where for example the session is named:

$ screen -ls
There are screens on:
        18282.FOO_BAR (11/02/16 16:25:52)     (Attached)

instead of opening a new screen window the solution in the answer linked to above gives for example:

$ screen -X chdir $PWD;screen
/var/run/screen/S-username/18282.pts-29.hostname: No such file or directory
/var/run/screen/S-username/18282.pts-29.hostname: No such file or directory

Is a workaround possible to make this work for named screen sessions?

  • 1
    I was trying to investigate this, but it worked with named session right as it was. Maybe a downlevel version? Mine is: Screen version 4.01.00devel (GNU) 2-May-06 – Gombai Sándor Feb 11 '16 at 16:34
  • Thanks Gombai, my screen version happens to be identical. Could you cut and paste exactly what you are using in your .screenrc to open the new window at the current window's working directory? – Paul Caheny Feb 11 '16 at 18:10
  • My one and only bind line is exactly as written in the linked topic: bind c stuff "screen -X chdir \$PWD; screen^M" where ^M is Ctrl-M – Gombai Sándor Feb 11 '16 at 19:42
  • Went back to double check Gombai, unfortunately I have the problem as described in the original question with just a single bind line in my .screenrc identical to yours and with an identical version of screen. – Paul Caheny Feb 15 '16 at 10:00

Your Answer

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

Browse other questions tagged or ask your own question.