On Thu, Dec 26, 2024 at 04:16:17 +0100, hen...@privatembox.com wrote: > Hello > > I have these settings in .bashrc of my home dir: > > $ cat .bashrc > export TF_CPP_MIN_LOG_LEVEL=3 > export CUDA_VISIBLE_DEVICES=-1 > > but every time after i login the system, the settings are not activated. > I have to source it by hand to make it work. > > what's wrong with me?
1) What shell do you use? 2) How do you get to a terminal? If you're not using bash as your login shell, then it makes perfect sense .bashrc wouldn't be read. If you open a terminal which works *normally*, it should run a non-login shell, which in the case of bash should read .bashrc. However, if your terminal has been configured to run a login shell, then it will read .bash_profile or .bash_login or .profile instead. However however, your .profile or equivalent should be configured to dot in your .bashrc file, possibly after verifying that you are, in fact, in bash. A .profile which fails to dot in .bashrc will lead you to all kinds of subtle problems whenever you launch a login shell, which would normally be when you ssh in, or login on a text console. A terminal emulator should normally run a NON-login shell, but some of them are sometimes configured to do the wrong thing because it works around stupid users. So, if you're using a Desktop Environment that assumes you are a stupid user, it might be running your shell as a login shell. You can tell whether your shell is a login shell by looking at the name it's invoked with (via ps(1) or similar commands). If the invocation name begins with a hyphen ("-"), it's a login shell. hobbit:~$ ssh localhost greg@localhost's password: Linux hobbit 6.1.0-28-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.119-1 (2024-11-22) x86_64 [...] hobbit:~$ ps -fp $$ UID PID PPID C STIME TTY TIME CMD greg 1001894 1001893 0 22:46 pts/29 00:00:00 -bash That's a login shell, because I ssh'ed in. You can tell because it's invoked as "-bash" instead of "bash". As a login shell, it will read my .profile, and my .profile contains: hobbit:~$ grep bashrc .profile . ./.bashrc so that my .bashrc file is *also* read. Yours should have this too, or something fancier, maybe even test "$BASH" && source ~/.bashrc or the default Debian /etc/skel/.profile way: # if running bash if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi which is ridiculously verbose. I went with a more basic route.