centos设置PATH

以nginx为例

1.临时

[root@localhost ~]# export PATH=$PATH:/usr/local/nginx/sbin


2.永久

对所有用户:

[root@localhost ~]# vim /etc/profile

在最后加上

PATH=$PATH:/usr/local/nginx/sbin


对www用户

[root@localhost ~]# vim /home/www/.bash_profile

最后加上

PATH=$PATH:/usr/local/nginx/sbin


设置永久的话,在正常情况下需要重启才能生效

如果要马上生效需要执行以下指令

所有用户:

[root@localhost ~]# source /etc/profile

单个用户:

[root@localhost ~]# source /home/www/.bash_profile

你可能感兴趣的:(服务器,centos)