This guide is about How to Add a Directory to $PATH in Linux. So read this free guide, How to Add a Directory to $PATH in Linux. If you have query related to same article you may contact us.
How to Add a Directory to $PATH in Linux – Guide
On Linux or other Linux-like operating systems, when you type a command at the command prompt, you are just telling it to run a program. Even simple commands like ls, mkdir, rm and others are just small programs, usually located in a directory on your computer called /usr/bin. There are other locations on your system that often also contain executable programs; Some common ones are /usr/local/bin, /usr/local/sbin and /usr/sbin. What programs are where and why is beyond the scope of this article, but you should know that an executable program can exist pretty much anywhere on your computer: it doesn’t have to be limited to one of these directories.
When you type a command in the Linux shell, it doesn’t look for a program by that name in every directory. It only looks for the ones you specify. How does he know how to look in the directories above? It’s simple: they’re part of an environment variable called $PATH that your shell checks to know where to look. Sometimes you may want to install programs to other locations on your computer, but be able to easily run them without specifying their exact location. You can easily do this by adding a directory to your $PATH.
What is $PATH on Linux
Adding a directory to your $PATH
There are situations where you might want to add other directories to the $PATH variable. For example, some programs might be installed in different locations, or you might want to have a dedicated directory for your personal scripts, but be able to run them without specifying the absolute path to the executable files. To do this, just add the directory to your $PATH.
I hope you like the guide How to Add a Directory to $PATH in Linux. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.