How can I change the Path environment variable in the LXDE in 64-bit, openSUSE Leap, 42.1?

  1. How can one set the Path environment variable in the Lightweight, X Windows System Version 11 (X11), Desktop Environment (LXDE), which might have some overlap with the K Desktop Environment (KDE) Platform 4.14.10, in a 64-bit openSUSE Leap 42.1? Please include the file in which to set the Path variable, the directory path of that file, for example /etc/…, and the command for doing so.

  2. If an environment variable were to be redefined within the KDE, would the LXDE “inherit” that definition from the KDE within the same, openSUSE Linux operating system?

Suggestion: Please open a “general-use-of-openSUSE-Linux-software” subforum in which questions like mine may be appropriately asked. Thanks.

You would normally set the path that you want in a shell startup script such as “.profile” or “.bashrc” in your home directory. I’m currently using “csh” (really “tcsh”) instead of “bash”, so I set it in “.cshrc”.

Normal X startup of your session launches your shell before starting anything else. You can define environment values there.

If you want system wide then you look at /etc/profile and /etc/profile.d/ directory.

If just user, then it’s the ~/.profile and export the new PATH;

export PATH=$PATH:/some/new/path

To test your changes source .profile

. .profile
echo $PATH

You can see all the variables in use with the env command so best compare the env output when logged into the Desktop Environments (DE).

Thanks to all of you who kindly took some time to post something in this online “thread.” In the Lightweight, X Windows System Version 11 (X11), Desktop Environment (LXDE) in 64-bit openSUSE Leap 42.1 Linux operating system in my home directory when viewing even hidden files in my Konqueror Web browser and file manager I found the files .profile and .bashrc. In the directory /etc/profile.d I did not find any files named just profile, .profile, bashrc, or .bashrc. In the directory /etc I found the files named bash.bashrc and profile. Within those two files I found instructions to not make changes in order to avoid them being lost in a system upgrade and to instead when using the Bourne again shell (bash) to make changes in /etc/bash.bashrc.local or /etc/profile.local. Since those files don’t currently exist in my /etc directory, I presume the procedure for changing the PATH environmental variable in a system-wide fashion for both the K Desktop Environment (KDE) and the LXDE would be to as a superuser in the /etc directory make the new file profile.local or bash.bashrc.local and within that file to input a line reading something like


to enable /some/new/path to be a directory in the system-wide PATH environment variable. Please confirm or correct me if what I wrote here is correct or not.

Here is a correction to and a rewriting of my earlier suggestion.–Please open a forum with a title of something like “General Use of openSUSE Linux Software” in which questions like mine may be appropriately asked. Thanks.

Hi, the .profile file does not exist by default. So if you want to make your change for your user only, create a .profile in your home directory. You can do this e.g. by typing

nano ~/.profile

. Then proceed as malcolmlewis pointed out.

If you are creating or defining a new environmental variable for your entire system,

  1. Although the file /etc/profile already exists, any upgrades will replace this file and your custom edits to this file will be lost. For this reason, you should create a new file** /etc/profile.local** which contains your custom edits.

  2. An alternative to creating a profile.local file that contains your variables is to create a script file in /etc/profile.d/ which contains your variables. The file can be named anything you wish because all files in this directory are read on boot. Use any of the existing files in that directory as templates for creating your new file.

If you are creating or defining a new environmental variable for an individual User (not system-wide),
Then it’s generally recommended to edit a bashrc file in your home directory. You can also modify a file** ~/.profile** which should already exist and has numerous lines which can be commented out to enable various settings or create your own.