.bash_profile, .bashrc 차이
둘의 차이는 실행이 되는 시점이 다르다.
.bash_profile 의 경우, 로그인 되는시점에 실행
.bashrc 의 경우, 이미 로그인한 시점에서 새로운 콘솔창(세션)을 열때 실행.
리눅스의 bash의 .bash_profile, .bashrc 실행순서
OS에서는 /etc/profile, .bash_profile or .profile을 실행하고, 각 파일 내부에서 다른 파일을 실행한다.
실행순서(내부 shell script포함) : /etc/profile -> /etc/profile.d/*.sh -> .bash_profile OR .profile -> .bashrc -> /etc/bashrc
1. /etc/profile
해당파일 안의 shell script
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
if [ "${-#*i}" != "$-" ]; then
. "$i"
else
. "$i" >/dev/null 2>&1
fi
fi
done
2. .bash_profile OR .profile (.bash_profile 이 없으면 .profile을 실행. .bash_profile 이 1순위이고, 우선순위에 따라 1개만 실행된다.)
해당 파일안의 shell script
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
'OS > linux' 카테고리의 다른 글
[Linux] 권한 변경(chmod) (0) | 2017.07.03 |
---|---|
[Linux] 커맨드라인 조작 방법 (0) | 2017.07.01 |
[Linux] 명령어(별칭) 만들기(alias) (0) | 2017.06.29 |
[Linux] 하드링크와 심볼릭링크(ln) (0) | 2017.06.29 |
[Linux] 파일 및 디렉토리 삭제(rm) (0) | 2017.06.28 |