I added my .screenrc below line to create new window on same path.

bind , stuff "screen^M" #send command 'screen' to current screen session

It creates new window on current path well. However if it some process is running (ex. top), the new screen command cannot pass to current session, so it fails.

Is there any way to avoid this situation. When I compile a source, It takes long times so I can not make new window (with same path) by this method.


1 Answer 1


I add self answer. I get idea from https://stackoverflow.com/a/20418619/1265770.

  1. edit PROMPT_COMMAND variable in .bashrc

    export PROMPT_COMMAND="screen -X chdir "$PWD"; PROMPT_COMMAND" //evaluate PWD whenever cd command

  2. edit your .screenrc

    bind , 'screen' //map , to create new window from $PWD

You must log in to answer this question.

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