사용자 도구

사이트 도구


wiki:os:linux:bashrc

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
wiki:os:linux:bashrc [2020/03/19 14:13]
dhan
wiki:os:linux:bashrc [2023/01/13 18:44] (현재)
줄 1: 줄 1:
 ====== bashrc 커스터마이징 ====== ====== bashrc 커스터마이징 ======
 <WRAP left notice 80%> <WRAP left notice 80%>
-  * description : +  * description : bashrc 유용한 정보 모음
   * author      : 주레피   * author      : 주레피
   * email       : dhan@repia.com   * email       : dhan@repia.com
줄 22: 줄 22:
  
 ===== Alias ===== ===== Alias =====
 +~/.bashrc 파일에 내용 추가
 <code bash> <code bash>
 # 검색엔진 관련 2020-02-10, Repia # 검색엔진 관련 2020-02-10, Repia
 +RSA_ROOT='/data/app/RSA'
 +
 alias rlog='tail -n200 -f ${RSA_ROOT}/logs/javaLog/log_${D_YMD}.txt' alias rlog='tail -n200 -f ${RSA_ROOT}/logs/javaLog/log_${D_YMD}.txt'
 alias tlog='tail -n200 -f ${TOMCAT_ROOT}/logs/localhost.${D_Y-M-D}.log' alias tlog='tail -n200 -f ${TOMCAT_ROOT}/logs/localhost.${D_Y-M-D}.log'
-alias search='cd ${RSA_ROOT}/bin'+alias search='cd ${RSA_ROOT}' 
 +alias sbin='cd ${RSA_ROOT}/bin
 +alias slog='cd ${RSA_ROOT}/logs'
 alias sfront='cd ${RSA_ROOT}/bin/html' alias sfront='cd ${RSA_ROOT}/bin/html'
 +
 +export RSA_ROOT
 </code> </code>
  
줄 33: 줄 40:
  
 <WRAP clear /> <WRAP clear />
 +
 +적용 방법
 +파일을 수정한 후 적용하기 위해서는 로그아웃을 하고
 +다시 로그인을 해야 하지만, 아래와 같이 실행하면 현재의 Shell에서도 적용된다.
 +<code bash>
 +$> source ~/.bashrc
 +or
 +$> . ~/.bashrc
 +</code>
  
 alias 명령어 alias 명령어
줄 48: 줄 64:
 </code> </code>
 > 이전에 설정된 내용 확인 가능 > 이전에 설정된 내용 확인 가능
- 
- 
- 
-===== 적용 방법 ===== 
-파일을 수정한 후 적용하기 위해서는 로그아웃을 하고 
-다시 로그인을 해야 하지만, 아래와 같이 실행하면 현재의 Shell에서도 적용된다. 
-<code bash> 
-$> source ~/.bashrc 
-or 
-$> . ~/.bashrc 
-</code> 
  
 ===== Example ===== ===== Example =====
줄 74: 줄 79:
 fi fi
 </code> </code>
 +
 +Git 브랜치 칼라로 보여주기
 +<code bash>
 +parse_git_branch() {
 + git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
 +}
 +if [ "$color_prompt" = yes ]; then
 + PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;31m\] $(parse_git_branch)\[\033[00m\]\$ '
 +else
 + PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w$(parse_git_branch)\$ '
 +fi
 +# THE SIX LINES BELOW are the default prompt and the unset (which were in the original .bashrc)
 +#if [ "$color_prompt" = yes ]; then
 +#    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
 +#else
 +#    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
 +#fi
 +#unset color_prompt force_color_prompt
 +</code>
 +
 ===== Ref ===== ===== Ref =====
 +  * [[https://askubuntu.com/questions/730754/how-do-i-show-the-git-branch-with-colours-in-bash-prompt|How do I show the git branch with colours in Bash prompt?]]
  
 ---- ----
 {{tag>주레피 bash bashrc}} {{tag>주레피 bash bashrc}}
/volume1/web/dokuwiki/data/attic/wiki/os/linux/bashrc.1584594834.txt.gz · 마지막으로 수정됨: 2022/03/10 19:52 (바깥 편집)