.bash_profile이 내컴터에 없었다....
echo $PATH하면 뭔가 경로가나옴...
find / -name '.bash*'를 하니 몇개의 경로가나온다...
모두다 뒤져봤는데 PATH가 없어...
그래서 ~/.bashrc에 export PATH=$PATH:경로를 추가했다....
저장후에
source .bashrc로 적용...
참고
.bash_profile -> 개인 사용자
.profile -> root를 제외한 모든 사용자의 홈디렉토리에 .profile
/etc/profile -> 모든 사용자가 공통의 PATH
source ~/.bash_profile -> 환경 적용
출처 : http://comxp.tistory.com/202
참고
Setting bash_profile
Users can use the .bash_profile and .bashrc file to set up for their bash shell various functions such as the prompt, and path. Below we show how to make a basic change to the PATH so that root can run programs in the pwd with entering ./
Utilities and files
echo $PATH
/root/.bash_profile
/root/.bashrc
source .bash_profile
~USERNAME/.bash_profile
/etc/skel/.bash_profile
Security Discussion
Root is powerful. Therefore the administrator must be careful about executing commands in a user's dirctory. The . or ./ (dot slash) must be last in the path so that a user's command isn't run in place of a usual command. For instance, a malicious user might put the following in an executable file named ls:
rm -rf /
If the dot slash in root's path occurred before /bin (where the system ls is stored), then the user's ls would be run, wiping out the system.
Procedure for changing the default path for root
1. As root, enter cd
2. Enter echo $PATH You can see the current path. If you have not previously altered it, it should be something like this:
/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/local/bin:
/usr/bin:/usr/X11R6/bin:/root/bin
3. Now enter vi .bash_profile . The profile should look like this:(원본에는 me .bash_profile me???)
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:.
BASH_ENV=$HOME/.bashrc
USERNAME="root"
export USERNAME BASH_ENV PATH
The if ... fi block is a shell script meaning that if .bashrc exists, then run it now.
The PATH= line sets the path to whatever is alread there, plus $HOME/bin (in this case, /root/bin)
4. Add colon period, :. to the end of the PATH line to create a new path to the pwd. It should now read as follows:
PATH=$PATH:$HOME/bin:.
5. Save the file.
6. Enter source .bash_profile
7. Enter echo $PATH again.
The path should now look like this:
/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11:/usr/local/bin:
/usr/bin:/usr/X11R6/bin:/root/bin:.
Setting the path for users
Users will want to run commands from their files without entering ./ (dot slash). They can do this by altering their .bash_profile accounts as did root in the above procedure. But if you want to give them this ability from the creation of their account then simply alter the /etc/skel/.bash_profile file to include dot slash. Anything that you put in /etc/skel will appear in the new accounts that you make on the system.
출처 : http://heron.tc.clarkson.edu/~horn/classes/comm444/bash_profile.html
'나머지 > IT개발.잡다한것.' 카테고리의 다른 글
가는점선ex1(O).xls, 가는점선ex1(X).xls (0) | 2012.06.18 |
---|---|
도트프린터단어들 (0) | 2012.06.07 |
vi plugin taglist설치 (0) | 2012.04.20 |
VI 와 VIM 차이, '빔'과 '브이 아이' 에디터 차이점; Unix Editor Difference (0) | 2012.04.20 |
크로스 컴파일러 (0) | 2012.04.19 |