RedHat bash:useradd: Command not found

RedHat bash:useradd: Command not found

linux有些命令的路径并没有在PATH环境变量中,可以用echo  $PATH命令查询得知,添加PATH方法:

1.如RedHat bash:useradd: Command not found,  whereis useradd (whereis+命令),结果告诉你路

径/usr/sbin/

2.临时添加修改,下次开机无效的话,export PATH=$PATH:/usr/sbin/;

3.如果只给当前用户永久添加,则:在~/.bash_profile中的靠近末尾有类似这样的一行PATH=$PATH:$HOME/bin后添加/usr/sbin

保存,运行 source ~/.bash_profile即可生效

4.如果给系统中所有用户永久添加,则在/etc/profile文件末尾添加export PATH=$PATH:/usr/sbin/,保存运行source etc/profile命令即可

猜你喜欢

转载自nilm61.iteye.com/blog/1416694