First, find the same CentOS system and copy the/etc/profile file to the/etc directory of the faulty system,
Then run the following command:
# Source/etc/profile
In this way, it is restored.
If the newly installed system runs commands such as shutdown and fdisk, the prompt bash: command not found is displayed. First, consider whether the root $ PATH contains these environment variables.
The main four are:/bin,/usr/bin,/sbin,/usr/sbin.
Four major storage items:
./Bin:
The short description of "bin" as "binary" mainly places some necessary execution files of the system, for example: cat, cp, chmod df, dmesg, gzip, kill, ls, mkdir, more, mount, rm, su, tar, etc.
/Usr/bin:
It mainly stores necessary execution files for some application software tools, such as c ++, g ++, gcc, chdrv, diff, dig, du, eject, elm, free, gnome *, gzip, htpasswd, kfm, ktop, last, less, locale, m4, make, man, mcopy, ncftp, newaliases, nslookup passwd, quota, smb *, and wget.
/Sbin:
It mainly includes some necessary programs for system management, such: cfdisk, dhcpcd, dump, e2fsck, fdisk, halt, ifconfig, ifup, ifdown, init, insmod, lilo, lsmod, mke2fs, modprobe, quotacheck, reboot, rmmod, runlevel and shutdown.
/Usr/sbin:
Place some necessary network management programs such as dhcpd, httpd, imap, and in. * d, inetd, lpd, named, netconfig, nmbd, samba, sendmail, squid, swap, tcpd, and tcpdump.
You can view the PATH in. bash_profile in the home directory. If it is: PATH = $ PATH: $ HOME/bin, add it as follows:
PATH = $ PATH: $ HOME/bin:/sbin:/usr/bin:/usr/sbin
When CentOS5.5 is installed on a virtual machine and some normal commands such as init, shutdown, and fdisk are run, the following prompt appears:
Bash: xx command not found.
First, check whether these environment variables are included in the root $ PATH. (this may be because I chose "minimal installation" during installation, which causes some functions to be disabled ).
The main four are:/bin,/usr/bin,/sbin,/usr/sbin.