In this tutorial, How to set $PATH in Linux. You may set the $PATH permanently in 2 ways:
- Set PATH for Particular user.
- or set a common path for ALL system users.
You need to make “.bash_profile” in-home directory in the user for set PATH Particular user as command below
[huupv@DevopsRoles vagrant]$ echo "export PATH=$PATH:/path/to/dir" >> /home/huupv/.bash_profile
[huupv@DevopsRoles vagrant]$ source /home/huupv/.bash_profile
Or set a common path for ALL system users, you need to set path as below
[root@DevopsRoles vagrant]# echo "export PATH=$PATH:/path/to/dir" >> /etc/profile
[root@DevopsRoles vagrant]# source /etc/profile
An example set a common path for ALL system users as the picture below
Conclusion
Thought the article, You can set PATH 2 way in Linux as above. I hope will this your helpful. Thank you for reading the DevopsRoles page!