[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