-bash: ls: command not found 或ifconfig ,su 等命令不能使用
来源:互联网 发布:js获取asp控件的值 编辑:程序博客网 时间:2024/06/05 15:23
linux命令如果不能使用,可以用以下步骤排查:
1,$ whereis ifconfig 查看这个命令在那个目录下 ,如果whereis命令也不能使用可以考虑使用其他用户,一般linux的基本命令是不会说不能使用,出现这种不能使用的情况,基本上是我们在某个账户下误操作造成的,可以考虑换个用户使用whereis命令,是可以发现能够使用此命令的。
2.echo $PATH 看一下该目录是否在路经下,注意lunux下是完全区分大小写的,所以不要忽略这点
3.执行命令,需要指定路径或者把目录加入PATH中
4.于是可以这样访问
方法一:[root@localhost sbin]$ /sbin/ifconfig 就可以出现使用了
方法二:[root@localhost sbin]$ export PATH=$PATH:/sbin ,这样设置后,下次就可以直接访问了,免除第一种的麻烦,如:
[root@localhost /]$ ifconfig
方法三:一般的linux基本命令都放在/usr/bin/目录下
所以我们可以进入到/home目录下,找到不能使用命令的用户并 “cd /用户”
然后ls -a
会发现有个隐藏的“.bashrc”文件。
$ vim .bashrc
修改此文件,在文末加上:
export PATH=$PATH:/usr/bin/
这样就能正常使用/usr/bin目录下的所有命令了
其实此步的操作就相当于方法二中的 export PATH=$PATH:/sbin 命令
如下图:
最后 $ source .bashrc
让修改后的文件生效。
阅读全文
0 0
- -bash: ls: command not found 或ifconfig ,su 等命令不能使用
- ifconfig命令无法找到,提示bash: ifconfig: command not found
- sudo, su, ls 等常用命令找不到:Command not found
- linux ifconfig 无法使用 bash: ifconfig: command not found
- bash: ifconfig: command not found
- bash: ifconfig: command not found
- bash: ifconfig: command not found
- bash: ifconfig: command not found
- -bash: ifconfig: command not found
- bash: ifconfig: command not found
- bash: ifconfig: command not found
- bash: ifconfig: command not found
- bash: ifconfig: command not found
- bash: ifconfig: command not found
- -bash : ls:command not found
- -bash: ls: command not found
- -bash: ls: command not found
- Linux不能使用FTP 命令 -bash: ftp: command not found
- PowerShell实现简单的grep功能
- xml 读写
- jQuery length 和 size()区别
- Java 标准 I/O 流编程一览笔录
- 7-24 树种统计(25 分)
- -bash: ls: command not found 或ifconfig ,su 等命令不能使用
- TCP分段与IP分片
- Spark算子总结(带案例)
- C++ primer——函数学习
- JFreeChart中文乱码解决方案
- ionic+anjularjs点击图片放大
- ImportError: No module named lmdb解决办法
- 规则推理算法:Treat
- mock server