bash

Published by onesixx on

.bashrc 적용안됨

$vi ~/.bash_profile에 아래 내용 추가

if [ -f ~/.bashrc ]; then 
  . ~/.bashrc 
fi  

바로 적용하려면,

$ . ~/.bashrc

다시 로그인한것과 같은 효과이므로, bash_profile을 호출하게 됨

PATH

https://askubuntu.com/questions/866161/setting-path-variable-in-etc-environment-vs-profile

현재 PATH확인

echo $PATH

Shell(Bash)수준에서

순서대로 보면 , root계정의 etc/bashrc 와 etc/profile 을 먼저 읽고 
                    사용자의 .bashrc 와 .bash_profile을 읽는다.

유저별 ~/.bashrc

PATH수정할때 일반적으로 건드리는 파일. 터미널을 실행할 때 마다 읽어 반영한다. 

vi ~/.bashrc
...
# added by Anaconda3 installer
export PATH="$PATH:/opt/anaconda3/bin/"
...

수정후 적용을 위해

source ~/.bashrc

유저별  ~/.bash_login , ~/.bash_profile

 로그인 할 때 한번만 읽음

영구적으로

모든 사용자 /etc/environment, /etc/security/pam_env.conf

시스템 단계에서 설정하는 파일, 웬만하면 건들지 말것

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"

모든 사용자 /etc/profile 

/etc/bash.bashrc    (또는 ~/.zshrc)

/etc/profile.d/*.sh

특정 목적의 shell을 만들어, 그 안에 export 로 PATH를 잡는다. 

유저별 ~/.profile

각 사용자마다 개별적으로 가지고있는 스크립트 파일

Categories: Ubuntu

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x