I'm running RHEL 7.4 with bash shell and GNOME Terminal and am trying to figure out why LD_LIBRARY_PATH contains paths to certain directories. I removed ~/.bashrc and ~/.bash_profile but after restarting the terminal I find that LD_LIBRARY_PATH is still populated.

More peculiar is that LD_LIBRARY_PATH contains paths to locations which I've created like /home/jodag/my_local/lib. I thought deleting .bashrc would stop these values from being loaded but it hasn't.

Is there a way to list all the scripts being executed when the terminal starts, or possibly some other way to track down what is setting my LD_LIBRARY_PATH environment variable?

  • 3
    I'd guess it's possible that the process which starts the terminal emulator still has LD_LIBRARY_PATH set and this gets inherited by bash when you start it? – njsg Sep 4 '17 at 21:02
  • I think you're right. I re-logged and now things are working as I would expect. Looking through my old ~/.bash_profile I found that it was executing ~/.bashrc which meant that ~/.bashrc was being executed twice, once on log-in and once when the terminal started. – jodag Sep 4 '17 at 21:37

Your display manager and your window manager each run system-wide init scripts and per-user init scripts. Consult their man pages. Among the usual suspects are ~/.xinitrc and ~/.xsession.

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.