[trouble shooting ] -bash : cat:command not found

[root@centos7 ~]# cat /root/.bashrc 
-bash: cat: command not found
[root@centos7 ~]# ls
-bash: ls: command not found
[root@centos7 ~]# 

 

解决过程

ls和cat都是linux的工具,它们都在/bin 这个位置,命令没找到大概是没有去/bin这个地方寻找ls和cat,我们可以打印一下PATH变量承载的是什么东西

[root@centos7 usr]# echo $PATH
/usr/local/mysql/bin

这说明,在把mysql的工具添加到环境变量里面的时候,把前面的都覆盖掉了,在 ./bashrc 正确添加mysql环境变量的做法应该是

PATH=${PATH}:/usr/local/mysql/bin

解决方案

[root@centos7 usr]# PATH=${PATH}:/bin
[root@centos7 usr]# echo $PATH
/usr/local/mysql/bin:/bin

之后cat和其他工具都可以使用了,这时应该重新修改/root/.bashrc文件就可以了,我们看看/bin中有什么

[root@centos7 bin]# ls
[                      gtar                      rmdir
a2p                    gtbl                      rnano
addr2line              gtroff                    rpcgen
alias                  gunzip                    rpm
apropos                gzexe                     rpm2cpio
ar                     gzip                      rpmbuild
arch                   h2ph                      rpmdb
as                     h2xs                      rpmkeys
aserver                hdsploader                rpmquery
aulast                 head                      rpmspec
aulastlog              hexdump                   rpmverify
ausyscall              hostid                    rsyslog-recover-qi.pl
auvirt                 hostname                  runcon
awk                    hostnamectl               run-parts
base64                 i386                      rvi
basename               iconv                     rview
bash                   id                        rvim
bashbug                idn                       s2p
bashbug-64             igawk                     scp
bg                     info                      script
bond2team              infocmp                   scriptreplay
bootctl                infokey                   sdiff
bunzip2                infotocap                 secon
busctl                 install                   sed
bzcat                  instmodsh                 seq
bzcmp                  ionice                    setarch
bzdiff                 ipcalc                    setfacl
bzgrep                 ipcmk                     setfont
bzip2                  ipcrm                     setkeycodes
bzip2recover           ipcs                      setleds
bzless                 iptables-xml              setmetamode
bzmore                 isosize                   setpriv
c++                    jobs                      setsid
c2ph                   join
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值