레이블이 profile인 게시물을 표시합니다. 모든 게시물 표시
레이블이 profile인 게시물을 표시합니다. 모든 게시물 표시

2015년 4월 19일 일요일

linux BASH

Bash will CACHE executables it finds in the path for next time in any particular session.
To tell Bash to clear this cache and look through the path again, you have to do a:
$ hash -r

~/.bashrc를 수정했을 때, 바로 적용하려면
$ source ~/.bashrc


Bash: about .bashrc, .bash_profile, .profile, /etc/profile, etc/bash.bashrc and others
  • When bash is invoked as an interactive login shell, or as a non-interactive shell with the --login option, it first reads and executes commands from the file /etc/profile, if that file exists. After reading that file, it looks for ~/.bash_profile,~/.bash_login, and ~/.profile, in that order, and reads and executes commands from the first one that exists and is readable. The --noprofile option may be used when the shell is started to inhibit this behavior.
  • When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and~/.bashrc, if these files exist. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of /etc/bash.bashrc and ~/.bashrc.

My bashrc, bash aliases, profile and other files (with good samples)
  • .bashrc : In .bashrc, I put the things that are related to interactive Bash usage. You'll also find a lot of references that configure environment variables like PATH in .bashrc, but I prefer to put these in .profile. (.bashrc should be loaded when opening a new interactive Bash shell.)
  • .bash_aliases : I use a separate file .bash_aliases for my favorite Bash aliases, to keep things more tidy. This file is "sourced" by .bashrc.
  • .profile: I put the "run time modifying" stuff (PATH and friends) in .profile, so that these things are also easily available outside interactive Bash sessions, like non-interactive Bash sessions, other command line shells sessions and even the graphical shell/desktop environment. The .profile file should be loaded on login on Linux setups.