I noticed a difference in 'env' before and after a 'screen' call, is there any additional clarity on what gets called (for setting environment variables)?

I couldn't see any clear explanation from a quick search on 'man screen'

Some googled queries on the topic:



I guess a more specific sub-question would be, what is not instantiated in a screen session vs. that of a normal log-in?

1 Answer 1


A process inherits the environment variables from the parent, this means the first time you call screen (create a new one) it has a copy of all the environment variables of the parent process. Now screen adjusts/creates some variables like COLUMNS, LINES, TERM, TERMCAP, WINDOW and STY. You can also adjust or delete environment variables in your screenrc with setenv/unsetenv.

On some systems, screen is setuid or setgid in order to update utmp and wtmp; then a few more variables are removed from the environment when screen starts, such as LD_LIBRARY_PATH.

If you attach to an existing screen session your environment variables won't be copied as the screen process already exists and has it own environment variables (from the time when you started the process before). This means your changed environment variables won't be visible in the processes started by screen as they are copied from the parent process which has the old environment variables.


You must log in to answer this question.

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