LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Questions about the alias command CentOS7 (https://www.linuxquestions.org/questions/linux-newbie-8/questions-about-the-alias-command-centos7-4175649744/)

HWDPlinux 03-07-2019 03:46 PM

Questions about the alias command CentOS7
 
When I use the alias/unalias command everything works fine, I just want to know why I am seeing this.
Where does the alias command store the new alias?
Why do I get the following output if my ~/.bashrc file looks as such...

Code:

[root@localhost profile.d]# alias
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -lZ'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

Code:

[root@localhost profile.d]# cat ~/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi


berndbausch 03-07-2019 04:24 PM

Quote:

Originally Posted by HWDPlinux (Post 5971405)
When I use the alias/unalias command everything works fine, I just want to know why I am seeing this.
Where does the alias command store the new alias?
Why do I get the following output if my ~/.bashrc file looks as such...

When you log on, your shell initializes itself from various system-wide and user-specific scripts, including /etc/profile, /etc/bashrc, .bash_profile, .bashrc and others. Aliases may be defined in any of these files, not only .bashrc.

Besides, you can also define aliases on the command line.

michaelk 03-07-2019 04:26 PM

It appears your in the /etc/profile.d directory have you looked at its contents? They are "loaded" by /etc/profile which is the system wide configuration and startup script.


All times are GMT -5. The time now is 11:51 AM.