I'm using a server where I'm a common user (non-sudo).
I access the server through ssh
.
Here's the output of some commands run on the server:
[username@machinename: ~]$ ps -p $$
PID TTY TIME CMD
1332818 pts/55 00:00:00 bash
[username@machinename: ~]$ echo $$SHELL
1332818SHELL
[username@machinename: ~]$ echo $-
himBHs
[username@machinename: ~]$ uname
Linux
[username@machinename: ~]$ uname -v
#1 SMP Thu May 11 07:38:47 EDT 2023
[username@machinename: ~]$ uname -r
4.18.0-372.57.1.el8_6.x86_64
[username@machinename: ~]$ cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.6 (Ootpa)"
ID="rhel"
ID_LIKE="fedora"
VERSION_ID="8.6"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Red Hat Enterprise Linux 8.6 (Ootpa)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:redhat:enterprise_linux:8::baseos"
HOME_URL="https://www.redhat.com/"
DOCUMENTATION_URL="https://access.redhat.com/documentation/red_hat_enterprise_linux/8/"
BUG_REPORT_URL="https://bugzilla.redhat.com/"
REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 8"
REDHAT_BUGZILLA_PRODUCT_VERSION=8.6
REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux"
REDHAT_SUPPORT_PRODUCT_VERSION="8.6"
Username and machine name are hided.
Here's the operating system information:
LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch
Distributor ID: RedHatEnterprise
Description: Red Hat Enterprise Linux release 8.6 (Ootpa)
Release: 8.6
Codename: Ootpa
Normally to add aliases on Ubuntu/Linux, I just need to edit the ~/.bashrc file. But this file doesn't exit the first time I enter the system, so I created it on my own in my home directory and fill the aliases:
# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/home/tien/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/home/tien/anaconda3/etc/profile.d/conda.sh" ]; then
. "/home/tien/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/home/tien/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
export PATH="/usr/local/cuda-12.1/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda-12.1/lib64:$LD_LIBRARY_PATH"
alias c='clear'
alias gpu='watch -n 0.5 nvidia-smi'
alias ..='cd ..'
alias ...='cd ../..'
alias ....='cd ../../../../'
alias .....='cd ../../../../'
alias h='history'
alias j='jobs -l'
alias gst='git status'
But when I log out and re-login, the alias doesn't work.
So how can I debug this?
Here are some of my info:
[username@machinename: ~]$ which alias
/usr/bin/alias
[username@machinename: ~]$ alias
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias vi='vim'
alias xzegrep='xzegrep --color=auto'
alias xzfgrep='xzfgrep --color=auto'
alias xzgrep='xzgrep --color=auto'
alias zegrep='zegrep --color=auto'
alias zfgrep='zfgrep --color=auto'
alias zgrep='zgrep --color=auto'
ps -p $$
andecho $SHELL
run on the server, iii) the output ofecho $-
on the server.