LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1449|回复: 6

root 下的环境变量.bashrc被修改出错,现在root下无法识别命令

[复制链接]
发表于 2006-11-21 08:20:13 | 显示全部楼层 |阅读模式
完了,信心倍受打击。前几天我发过帖子,说是关机只能用/sbin/shutdown -h now.
有高手说是要修改环境变量:/root/.bashrc/这个文件。但是现在修改之后发现root下的bsh命令无法识别也无法执行如startx ls top free。怎么办呢?
在普通用户下还可以执行这些命令。这次发帖在linux系统下做的。
下面是在终端下执行命令的结果:

[scg@Fangzheng ~]$ su
口令:
[root@Fangzheng scg]# ls
bash: ls: command not found
[root@Fangzheng scg]# free
bash: free: command not found
[root@Fangzheng scg]# top
bash: top: command not found
[root@Fangzheng scg]# ls -a
bash: ls: command not found
[root@Fangzheng scg]# pwd
/home/scg
[root@Fangzheng scg]# cd /root
[root@Fangzheng ~]# ls
bash: ls: command not found
[root@Fangzheng ~]# vi .bashrc-bak
bash: vi: command not found
[root@Fangzheng ~]# vi .bashrc
bash: vi: command not found
[root@Fangzheng ~]#

请各位多多帮忙呀!!!谢谢。
发表于 2006-11-21 09:11:34 | 显示全部楼层
echo $PATH看看是什么?估计是这错了
root用户起码应该有/bin:/usr/bin:/sbin:/usr/sbin
su - root才能拥有root的环境变量,su只是你登陆用户的环境变量,要注意
回复 支持 反对

使用道具 举报

发表于 2006-11-21 09:12:43 | 显示全部楼层
echo $PATH看看是什么?估计是这错了
root用户起码应该有/bin:/usr/bin:/sbin:/usr/sbin
su - root才能拥有root的环境变量,su只是你登陆用户的环境变量,要注意
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-11-21 10:13:28 | 显示全部楼层
gzyui兄弟:按照你的说法我运行了:看来果真是root下的环境变量不对。下面是是运行echo     $PATH的结果。

[scg@Fangzheng ~]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/scg/bin
[scg@Fangzheng ~]$ su root
口令:
[root@Fangzheng scg]# echo $PATH
/sbin
[root@Fangzheng scg]#

现在的情况是root下的vi命令无法运行,无法修改.bashrc这个文件。
提示:
[root@Fangzheng scg]# cd /
[root@Fangzheng /]# cd root
[root@Fangzheng ~]# ls -a
bash: ls: command not found
[root@Fangzheng ~]# vi .bashrc
bash: vi: command not found
[root@Fangzheng ~]#

怎么办呢??////
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-11-21 10:14:08 | 显示全部楼层
gzyui兄弟:按照你的说法我运行了:看来果真是root下的环境变量不对。下面是是运行echo     $PATH的结果。

[scg@Fangzheng ~]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/scg/bin
[scg@Fangzheng ~]$ su root
口令:
[root@Fangzheng scg]# echo $PATH
/sbin
[root@Fangzheng scg]#

现在的情况是root下的vi命令无法运行,无法修改.bashrc这个文件。
提示:
[root@Fangzheng scg]# cd /
[root@Fangzheng /]# cd root
[root@Fangzheng ~]# ls -a
bash: ls: command not found
[root@Fangzheng ~]# vi .bashrc
bash: vi: command not found
[root@Fangzheng ~]#

怎么办呢??////
回复 支持 反对

使用道具 举报

 楼主| 发表于 2006-11-21 10:16:23 | 显示全部楼层
gzyui兄弟:按照你的说法我运行了:看来果真是root下的环境变量不对。下面是是运行echo     $PATH的结果。

[scg@Fangzheng ~]$ echo $PATH
/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/home/scg/bin
[scg@Fangzheng ~]$ su root
口令:
[root@Fangzheng scg]# echo $PATH
/sbin
[root@Fangzheng scg]#

现在的情况是root下的vi命令无法运行,无法修改.bashrc这个文件。
提示:
[root@Fangzheng scg]# cd /
[root@Fangzheng /]# cd root
[root@Fangzheng ~]# ls -a
bash: ls: command not found
[root@Fangzheng ~]# vi .bashrc
bash: vi: command not found
[root@Fangzheng ~]#

怎么办呢??////
回复 支持 反对

使用道具 举报

发表于 2006-11-21 10:44:34 | 显示全部楼层
  1. /bin/vi .bashrc
复制代码


  1. /usr/bin/vim .bashrc
复制代码

试试
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表