Add Alias Permanently to ~/.bashrc
Ensure that the alias command is included in the ~/.bashrc
file, as this file is loaded with each new interactive session:
alias sensors="sensors && nvidia-smi --query-gpu=name,temperature.gpu --format=csv,noheader | awk -F ',' '{printf \"GPU: %s - Temperature: %s°C\\n\", \$1, \$2}'"
This step is already set, but we will make some additional adjustments to ensure the alias truly loads on each startup.
Ensure Loading of ~/.bashrc
in All Environments
The ~/.bashrc
file may not be loaded in every new session. However, we can make sure it is included in all shell sessions:
Open ~/.bash_profile
(or create it if it doesn’t exist):
nano ~/.bash_profile
Add the following lines to ensure that ~/.bashrc
is loaded every time you log in:
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
This will ensure that ~/.bashrc
is loaded in new sessions or after a reboot.