Is there a way to set a GNU Screen LS_COLORS to that of the default non-screen terminal window?

Is there .screenrc or .screen_profile, I don't understand what happens when a GNU Screen is initialized?

  • There is a ~/.screenrc file, but it is not a shell script, it is read by screen with its own command set. Do you see something different using screen and not? I've had no problem with the default LS_COLORS for years, on different OSs. – Arcege Feb 15 '12 at 19:31
  • Yes, the LS_COLORS are set different and vim syntax highlighting changes as well. Here are my dotfiles. – rudolph9 Feb 15 '12 at 20:20
  • Could you show the two different values of LS_COLORS? Your .aliases file explicitly sets LS_COLORS, so it could be something to do with the macos version of screen changing the OSTYPE value (but that doesn't seem likely. My suggestion to you is to diff the output of env (after proper sorting) inside and outside of screen and see what turns up. – Arcege Feb 15 '12 at 21:37
  • It turns out I had an issue with my dotfiles, in my .bash_promp I removed the following and all is well: if [[ $COLORTERM = gnome-* && $TERM = xterm ]] && infocmp gnome-256color >/dev/null 2>&1; then export TERM=gnome-256color elif infocmp xterm-256color >/dev/null 2>&1; then export TERM=xterm-256color fi. Still different but it doesn't just make everything red. – rudolph9 Feb 15 '12 at 22:15
  • I still don't understand what happens when a GNU Screen is initialized? If anyone can explain that, it would be greatly appreciated. – rudolph9 Feb 15 '12 at 22:16

According to tests with screen on both Linux and FreeBSD, only ~/.bashrc is sourced. The ~/.bash_profile is not sourced as not being a "logging shell".

You can easily do this test yourself by adding the right echo lines at the beginning of all your ~/.*rc.

If you are still unsure of the things or you want screen to set some specific environment, your can use the following "~/.screenrc" options:

  • shell <shell_bin> to specify the shell binary to use (instead of the default: $SHELL)
  • setenv <var> <value> to set the environment <var> to <value>
  • source <file> to source another <file>

You can have a look at the other available ~/.screenrc options in man screen, but not much is specificly said about the sourced ~/.*rc files as it is imply that screen is invoquing a "non-logging shell".

  • 2
    Note that source here means to source another screenrc file, not to source a bash script (e.g. ~/.bashrc). – Arcege Feb 16 '12 at 1:40

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.