一、普通用乎
如果一些程序没有安装在系统默认的路径(ie /bin/, /usr/bin, /usr/local/bin/ )里面,这个时候普通用户想要调用这些命令,必须设定路径。方法很简单:以普通用户登录,然后在终端输入:
vi ~/.bash_profile
会出现如下的内容:
引用:# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export PATH
此时,只要在export PATH前面加入自己的路径即可,例如我的修改后如下:
引用:[yyc@localhost bin]$ cat ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:/usr/local/programs/crosstool/gcc-4.0.2-glibc-2.3.6/arm-linux-gnu/bin/
export PATH
二、超级用户
这里主要是一些用在系统管理上的命令,例如ifconfig, route等等, 他们位于/sbin, 或/usr/sbin/下。其实这些命令本身就没有任何问题,软件包早已安装完毕,路径设置也没有丝毫问题。而出现Command not found的原因在于:在终端使用su变成超级用户的时候没有将root的路径(环境)一起切换过来,从而导致身份虽然已经是root,但是工作的环境和路径依旧是普通用户的。这种问题的解决方法有两个,其一是按照(一)里面提到的,对普通用户的工作路径进行修改,但是这样比较麻烦。其二则简单的多,只要在使用su的时候在其后家上一个空格和”-“ ,即将su改为 su - 。这样就可以在成为root的同时将root的工作路径也一起切换过来了。如果你已经使用su变成了root, 那也没有关系,只要在输入一下su - 就好了。
答案分析:vic_kk


bidayuan 于 2008-01-11 23:33:48发表:
遇到,学习
deepwhite 于 2007-12-25 22:51:49发表:
不会有任何危害。
http://hi.baidu.com/yangyingchao/blog/item/dfcabfb12000425009230249.html
guilinhangtian 于 2007-12-25 18:57:50发表:
这么弄会不会对系统造成危害呢??!
老赵 于 2007-12-25 18:13:33发表:
:0)1
taotie2007 于 2007-12-25 15:32:59发表:
:0)1
taotie2007 于 2007-12-25 15:32:47发表:
:0wmjh(1
sheshijie 于 2007-12-25 12:22:49发表:
:0wszxc