How to set up and change the PATH system variable?
- September 10, 2020
- Posted by: Ilhan Koral
- Category: Setup Environment
In this tutorial, we will discuss setting up the environment variables in both Windows and Linux. To make this tutorial short and clear we are going to use Windows 10 and Ubuntu as sample Operating Systems (OS). Once you understand the idea behind the scene you can set your environment variables in different systems such as Win7 or CentOs.
Overview
Environment PATH variables are values that are used to configure executable files PATH address for your PC. Even though it seems more technical it is easy to set up and they are just pointing the address of executables for OS and users. After you set up this variable your OS will be able to use this PATH to run specific programs.
Typically we don’t have to change or set up PATH variable when we install a program especially in Windows or Mac OS X. However during setting your environment for testing or development we need to set up some executables address and tell our computer when it finds this PATH. It is more common when you install programming languages such as Python, Java, or PHP on your computer.
Programs and other executable files can place in different folders, so operating systems provide kind of search storage paths that lists all programs and executable files. In this way, the OS can know where to search and find these files. The PATH is stored in an environment variable. This is a unique name and the path variable is named PATH in Linux or Path in Windows (This is not case sensitive in Windows whereas it is capital and case sensitive in Linux).
The PATH system variable can be set using different methods on Windows and on Linux. Let’s dive into each system and learn how we can set up PATH variables.
The only way to do great work is to love what you do.
– Steve Jobs
Windows
There are a lot of environment variables besides PATH variables. Taking a look at environment variables, in general, allow us to better understand the topic. In Windows, we have two different types of environment variables; global and user. See the below picture. User variables are valid only specific users who created them. So different users can have different configurations. On the other hand, global system variables, such as “%OS%” can be accessed and used by whole users. For example “%OS%” variable points to the OS kernel type which Windows belongs to. (e.g. “Windows_NT”).
Many apps add their own environment variables after installation. While some variables such as OneDrive place only in user variables, some variables such as PATH can be found both in global and user variables. Now we are going to learn how we can create or change our environment variable, to be more specific PATH variable in Windows. We will introduce you to different methods to set up your Path variable. We start with an easy method and depend on your privileges and access right you may try one of them. Some of the methods you might not able to follow if your PC security policy restricts yourself to access some settings.