본문으로 건너뛰기

.bashrc와 .bash_profile 그리고 내 설정

.bashrc에 설정해놓으면 편하니 몇가지 정리

일단 현재 사용중인 내용..
.bashrc

# Set vim as default
alias vi=vim
alias svi='sudo vi'
alias edit='vim'

# Hugo Command
alias hs='hugo server --bind 0.0.0.0 --themesDir ../..'
alias nhs='nohup hugo server --bind 0.0.0.0 --themesDir ../.. > /dev/null &'
alias hb='hugo --themesDir ../..'

# Jekyll Command
alias js='bundle exec jekyll serve'
alias jsnet='bundle exec jekyll serve --host 0.0.0.0'
alias jc='bundle exec jekyll clean'

# Linux
alias ll='ls -l'
alias lrt='ls -lrt'
alias la='ls -la'
alias cls='clear'
alias xplus='chmod +x'

.bash_profile

# Mongo
export AWS_MONGO_DB_URL=xx.xx.xx.xx
export AWS_MONGO_DB_PORT=27017

.bashrc와 .bash_profile

  • .bash_profile

    • .bash_profile은 로그인시에 실행된다.
    • 환경변수를 설정한다(export하는 변수)
  • .bashrc

    • bash를 기동 할 때마다 실행된다.
    • 환경변수가 아닌 변수를 설정할 때 (export안하는 변수)
    • alias설정
    • 쉘 함수 설정
    • 커맨드라인 보완하는것 등을 설정
    • bash를 시동 할 때마다 실행해야 하는것들을 기입한다.

조금더 정확한 설명 및 핵심 내용은 이것이다.
{{< color red ".bash_profile / .bashrc는 로드 되는 타이밍이 다르다. 라는것이 포인트. " >}}
{{< color red ".bashrc는 화면상에서 bash를 기동했을때 로드된다. 즉 bash 라고 커맨드를 쳐서 실행하면 로드 된다는 것이다. " >}}
{{< color blue "반면 .bash_profile은 유저로써 로그인 했을때 로드된다." >}}
{{< color blue "유저로써 로그인 했을때 한번만 설정 할 내용이라면 .bash_profile에 적는것이 맞다" >}}