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

程智明
2023-12-01
[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                      setterm
c89                    journalctl                setup-nsssysinit
c99                    kbdinfo                   setup-nsssysinit.sh
cal                    kbd_mode                  setvtrgb
ca-legacy              kbdrate                   sexp-conv
captoinfo              kdumpctl                  sftp
cat                    kernel-install            sg
catchsegv              kill                      sh
catman                 kmod                      sha1sum
cc                     last                      sha224sum
ccmake                 lastb                     sha256sum
cd                     lastlog                   sha384sum
centrino-decode        lchfn                     sha512sum
certutil               lchsh                     shasum
c++filt                ld                        show-changed-rco
chacl                  ld.bfd                    showconsolefont
chage                  ldd                       show-installed
chardetect             ld.gold                   showkey
chattr                 less                      shred
chcon                  lessecho                  shuf
chfn                   lesskey                   signtool
chgrp                  lesspipe.sh               signver
chmod                  lexgrog                   size
chown                  libnetcfg                 skill
chrt                   link                      slabtop
chsh                   linux32                   sleep
chvt                   linux64                   slogin
cksum                  linux-boot-prober         snice
clear                  ln                        soelim
cmake                  loadkeys                  sort
cmp                    loadunimap                sotruss
cmsutil                locale                    splain
col                    localectl                 split
colcrt                 localedef                 sprof
colrm                  logger                    sqlite3
column                 login                     ssh
comm                   loginctl                  ssh-add
command                logname                   ssh-agent
coredumpctl            look                      ssh-copy-id
cp                     ls                        ssh-keygen
cpack                  lsattr                    ssh-keyscan
cpan                   lsblk                     ssltap
cpio                   lscpu                     stat
cpp                    lsinitrd                  stdbuf
cpupower               lslocks                   strings
crlutil                lslogins                  strip
crontab                lsscsi                    stty
csplit                 lua                       su
csslint-0.6            luac                      sudo
ctest                  machinectl                sudoedit
curl                   mailq                     sudoreplay
cut                    mailq.postfix             sum
date                   make                      sync
db_archive             makedb                    systemctl
db_checkpoint          man                       systemd-analyze
db_deadlock            mandb                     systemd-ask-password
db_dump                manpath                   systemd-cat
db_dump185             mapscrn                   systemd-cgls
db_hotbackup           mcookie                   systemd-cgtop
dbilogstrip            md5sum                    systemd-coredumpctl
dbiprof                mesg                      systemd-delta
dbiproxy               mixartloader              systemd-detect-virt
db_load                mkdir                     systemd-escape
db_log_verify          mkfifo                    systemd-firstboot
db_printlog            mkinitrd                  systemd-hwdb
db_recover             mknod                     systemd-inhibit
db_replicate           mktemp                    systemd-loginctl
db_stat                modutil                   systemd-machine-id-setup
db_tuner               more                      systemd-notify
db_upgrade             mount                     systemd-nspawn
dbus-binding-tool      mountpoint                systemd-path
dbus-cleanup-sockets   msgattrib                 systemd-run
dbus-daemon            msgcat                    systemd-stdio-bridge
dbus-monitor           msgcmp                    systemd-sysv-convert
dbus-send              msgcomm                   systemd-tmpfiles
dbus-uuidgen           msgconv                   systemd-tty-ask-password-agent
db_verify              msgen                     tabs
dd                     msgexec                   tac
deallocvt              msgfilter                 tail
debuginfo-install      msgfmt                    tailf
df                     msggrep                   tar
dgawk                  msghack                   taskset
diff                   msginit                   tbl
diff3                  msgmerge                  teamd
dir                    msgunfmt                  teamdctl
dircolors              msguniq                   teamnl
dirname                mv                        tee
dmesg                  namei                     test
dnsdomainname          nano                      testgdbm
domainname             ncurses5-config           tic
dracut                 ncursesw5-config          time
dtrace                 ndptool                   timedatectl
du                     needs-restarting          timeout
dumpkeys               neqn                      tload
dwp                    netstat                   tmon
dwz                    nettle-hash               toe
easy_install           nettle-lfib-stream        top
easy_install-2.7       newaliases                touch
echo                   newaliases.postfix        tput
egrep                  newgrp                    tr
eject                  ngettext                  tracepath
elfedit                nice                      tracepath6
env                    nisdomainname             troff
envsubst               nl                        true
eqn                    nm                        truncate
eu-addr2line           nmcli                     trust
eu-ar                  nm-online                 tset
eu-elfcmp              nmtui                     tsort
eu-elflint             nmtui-connect             tty
eu-findtextrel         nmtui-edit                turbostat
eu-make-debug-archive  nmtui-hostname            tzselect
eu-nm                  nohup                     udevadm
eu-objdump             nproc                     ul
eu-ranlib              nroff                     umask
eu-readelf             nsenter                   umount
eu-size                numfmt                    unalias
eu-stack               objcopy                   uname
eu-strings             objdump                   unexpand
eu-strip               od                        unicode_start
eu-unstrip             oldfind                   unicode_stop
ex                     open                      uniq
expand                 openssl                   unlink
expr                   openvt                    unshare
factor                 os-prober                 unxz
fallocate              p11-kit                   unzip
false                  package-cleanup           unzipsfx
fc                     passwd                    update-ca-trust
fg                     paste                     update-mime-database
fgconsole              patch                     uptime
fgrep                  pathchk                   urlgrabber
file                   perl                      users
find                   perl5.16.3                usleep
find2perl              perlbug                   usx2yloader
findmnt                perldoc                   utmpdump
find-repos-of-install  perlivp                   uuidgen
fipscheck              perlthanks                VBoxClient
fipshmac               pgawk                     VBoxControl
firewall-cmd           pgrep                     vdir
firewall-offline-cmd   pic                       verifytree
flock                  piconv                    vi
fmt                    pinentry                  view
fold                   pinentry-curses           vim
free                   ping                      vimdiff
funzip                 ping6                     vimtutor
g++                    pinky                     vlock
gapplication           pk12util                  vmstat
gawk                   pkaction                  vxloader
gcc                    pkcheck                   w
gcc-ar                 pkcs1-conv                wait
gcc-nm                 pkexec                    wall
gcc-ranlib             pkg-config                watch
gcore                  pkill                     watchgnupg
gcov                   pkla-admin-identities     wc
gdb                    pkla-check-authorization  wdctl
gdb-add-index          pkttyagent                wget
gdbus                  pl2pm                     whatis
gencat                 pldd                      whereis
gendiff                plymouth                  which
geqn                   pmap                      whiptail
getconf                pod2html                  who
getent                 pod2man                   whoami
getfacl                pod2text                  write
getkeycodes            pod2usage                 x86_64
getopt                 post-grohtml              x86_64-redhat-linux-c++
getopts                powernow-k8-decode        x86_64-redhat-linux-g++
gettext                pr                        x86_64-redhat-linux-gcc
gettext.sh             preconv                   x86_energy_perf_policy
gio-querymodules-64    pre-grohtml               xargs
glib-compile-schemas   printenv                  xgettext
gmake                  printf                    xmlcatalog
gneqn                  prlimit                   xmllint
gnroff                 prove                     xmlwf
gpasswd                ps                        xsubpp
gperf                  psed                      xxd
gpg                    psfaddtable               xz
gpg2                   psfgettable               xzcat
gpg-agent              psfstriptable             xzcmp
gpgconf                psfxtable                 xzdec
gpg-connect-agent      pstack                    xzdiff
gpg-error              pstruct                   xzegrep
gpgparsemail           ptx                       xzfgrep
gpgsplit               pwd                       xzgrep
gpgv                   pwdx                      xzless
gpgv2                  pwmake                    xzmore
gpg-zip                pwscore                   yes
gpic                   pydoc                     ypdomainname
gprof                  python                    yum
grep                   python2                   yum-builddep
groff                  python2.7                 yum-config-manager
grops                  ranlib                    yum-debug-dump
grotty                 raw                       yum-debug-restore
groups                 read                      yumdownloader
grub2-editenv          readelf                   yum-groups-manager
grub2-file             readlink                  zcat
grub2-fstest           realpath                  zcmp
grub2-glue-efi         recode-sr-latin           zdiff
grub2-kbdcomp          rename                    zegrep
grub2-menulst2cfg      renice                    zfgrep
grub2-mkfont           repoclosure               zforce
grub2-mkimage          repodiff                  zgrep
grub2-mklayout         repo-graph                zip
grub2-mknetdir         repomanage                zipcloak
grub2-mkpasswd-pbkdf2  repoquery                 zipdetails
grub2-mkrelpath        repo-rss                  zipgrep
grub2-mkrescue         reposync                  zipinfo
grub2-mkstandalone     repotrack                 zipnote
grub2-render-label     reset                     zipsplit
grub2-script-check     resizecons                zless
grub2-syslinux2cfg     rev                       zmore
gsettings              rm                        znew
gsoelim                rmail                     zsoelim
gstack                 rmail.postfix

转载于:https://www.cnblogs.com/hellotracy/articles/5115774.html

 类似资料:

相关阅读

相关文章

相关问答