Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [environment-variables]

A set of dynamic variables that can affect the running processes behavior and access to resources.

Filter by
Sorted by
Tagged with
0 votes
0 answers
10 views

Is /home/user/.jdks/corretto-17.0.3 a good place to set JAVA_HOME to?

After probably inconsistently 'tidying up' my development computer due to the log4j issue in December, I have pointing the JAVA_HOME environment variable to an nonexistent directory. I recently ...
user avatar
  • 31
1 vote
1 answer
55 views

What kind of shell is a gnome-terminal started by a desktop file?

I am testing running Ubuntu 22.04. I don't understand why when opening a gnome-terminal using a .desktop file $HOME/.bashrc is not read although when running the same command in an open terminal it ...
user avatar
0 votes
0 answers
13 views

Setting profile directories on Ubuntu 18.04

Have made ~/.bash_profile in my home directory, that calls the file linge-profile.rc. Have installed the latest version of Tex Live in ${HOME}/Opstk/bld/texlive/2022/bin/x86_64-linux. I put my ...
user avatar
  • 35
0 votes
0 answers
37 views

Setting PATH for updated Tex Live installation

What is the best way to add the path for an updated Tex Live installation? Using PATH="${tldir}/bin/x86_64-linux:$PATH" or PATH="$PATH:${tldir}/bin/x86_64-linux" That is, should ...
user avatar
  • 35
0 votes
1 answer
50 views

Reload environment variables without relogin to desktop

I've found multiple ways to update environment variables to an Ubuntu system with a desktop environment, some common answers are: /etc/environment /etc/profile and /etc/profile.d/*.sh $HOME/.profile $...
user avatar
-1 votes
1 answer
49 views

How to set system path(`$PATH`) to default value permanently?

i accidentally change my path to this $ echo $PATH /home/josh/snap/flutter/common/flutter/bin:/snap/bin:/snap/bin:/snap/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/...
user avatar
0 votes
0 answers
11 views

poor performance at startup related to DISPLAY env variable equal to :1 on 20.04

I've been running Ubuntu 20.04 on a fairly recent Lenovo laptop for over a year now and I have been living with an intermittent problem related to poor performance right after startup. Some examples: ...
user avatar
0 votes
0 answers
39 views

Changing the environment variables in ubuntu

I use Ubuntu 20.04.4 LTS. I want to set gfortran and c compilers as well as the OpenMPI library into the PATH and LD_LIBRARY_PATH environmental variables. I want to compile a code, and there is a ...
user avatar
1 vote
0 answers
118 views

How to avoid "Bad Escape Character" passing variable to SSH?

I have a string variable passed in from the command line that I want to use in SSH. #!/bin/bash while getopts ":b:e:" arg; do case "${arg}" in b) b="$OPTARG";; ...
user avatar
  • 11
2 votes
2 answers
286 views

Unable to change QT_QPA_PLATFORMTHEME environment variable

Xubuntu 20.04 LTS I want to change default XFCE theme for Qt applications. It's set to Fusion style on my app. I read from tutorials that I need kvantum manager and qt5ct I installed both packages ...
user avatar
  • 21
2 votes
1 answer
55 views

Read command to read enviornment variable

I have an interactive script to perform a compare of a local directory and a remote directory. I want the user to be able to provide the name of the remote user, name of the remote server and the two ...
user avatar
  • 53
1 vote
1 answer
76 views

Having trouble understanding basic variables and commands because of my understanding of the Linux environment [closed]

I'm having a hard time understanding some basic concepts about Linux. And the influence of some variables on those concepts. Those basic concepts are Virtuel environment, shell, tty. The variabele: $...
user avatar
0 votes
2 answers
67 views

Where can I store an environental variable only for utilites or scripts that run as root?

I've tried using the gnome-keyring in a headless server, but have an error, so am back to envirnmental variables. https://unix.stackexchange.com/questions/690295/error-secret-tool-cannot-create-an-...
user avatar
  • 590
1 vote
1 answer
243 views

Read from .env file and set as bash variables

How can I read an .env file and set the variables as bash variables? Currently, I'm able to read it and export them as environment variables. If the file contains the variables: DB_NAME=mydb ...
user avatar
-1 votes
0 answers
274 views

Ubuntu 20.04 DISPLAY variable should be set even after logging out to gui login screen

I am using DISPLAY env variable to set gsettings for Vino. The connection is through ssh to the server where the gui is working. If i am logged in, the display variable is automatically set to :0. ...
user avatar
0 votes
0 answers
264 views

Setting Up PostgreSQL DB with bash script using variables from .env file

I'm trying to set up PostgreSQL with a bash script which takes the variables from an .env file. My code - #!/bin/bash DB_NAME=$(grep DB_NAME .env | cut -d '=' -f 2-) DB_USER=$(grep DB_USER .env | cut ...
user avatar
0 votes
1 answer
55 views

while invoking 'gnome-terminal' from the terminal , the environment variables of the previous session has a scope in the newly opened terminal

I have opened a gnome-terminal and did this: $ export abc=abcd $ echo $abc abcd $ gnome-terminal The above commands invoked an another gnome-terminal and tried this: $ echo $abc abcd #I am not ...
user avatar
0 votes
0 answers
17 views

Updating Web Pages - Struggling with SED

I have a bunch of domains that I need to update, the structure is basically the same but the individual page names are different. Example: root-directory/review/ In the /review/ directory, there are ...
user avatar
0 votes
1 answer
181 views

Change default $PATH environment variables

I want to change default PATH Variable in bash. Also, I know can write export PATH=$PATH:/path/to/commands but it's not my solution. I want any apps uses system-call, new path can be used. For example ...
user avatar
0 votes
1 answer
100 views

How long can $DISPLAY environment variable value be?

What is the maximum length that $DISPLAY environment variable value can take? I understand that it is - hostname:displaynumber.screennumber So will it be => max($DISPLAY) = max(hostname) + max (...
user avatar
0 votes
0 answers
14 views

relative path or environment variable not works in /etc/xdg/autostart/? [duplicate]

I make a auto-start script in /etc/xdg/autostart to make our product runs when boots. the .desktop file looks like this: [Desktop Entry] Version=1.0 Name=autoStarter Exec=sh /home/myname/Commands.sh ...
user avatar
7 votes
2 answers
270 views

BASH: How can I combine two (or more) variable string manipulations in one step?

Is it possible to combine two or more string manipulation functionalities of a variable in BASH (or any other standard Linux command)? Let's say e.g. I have the variable $XDG_CURRENT_DESKTOP which ...
user avatar
  • 163
0 votes
0 answers
39 views

Random kernel loop-crashes

The kernel seems to crash loop randomly. Audio logs loop at a 2 second interval (approximate). It doesn't happen very often, but it is often enough that it has an impact. I will not post journalctl or ...
user avatar
0 votes
1 answer
183 views

How to "cd $variable" when the variable tries to add "\" before spaces (path contain spaces)?

My bash script registers its own path so it can return to its own folder after doing a cd somewhere (kinda if it explores a different forest and is able to relocate its house). And if the path have ...
user avatar
0 votes
1 answer
353 views

How can I set multiple environment variables at once

Is it possible to define multiple environment variables at once? Ideally I'd like to paste them all at once instead of setting each one separately.
user avatar
3 votes
1 answer
543 views

The command could not be located because '/bin:/usr/bin' is not included in the PATH environment variable

I've installed ubuntu 20.04.3 lts and i installed anaconda3, i had to uninstall anaconda3 since i some problem accured by just type this command #rm -f anaconda3 from root and /home/user directory. ...
user avatar
0 votes
0 answers
28 views

Ubuntu: reading local user env variable in service

I have a Linux service running on my ubuntu machine. in this machine, I need to read proxy setting environment variables ( like https_proxy, http_proxy, no_proxy, etc) values for the currently logged-...
user avatar
0 votes
0 answers
79 views

how to export VAriable from bash script, not calling the other one

I have inside my script = 1.sh: A=1, export A I made the 1.sh = 755 I know if I run: . ./1.sh then if from command line I will run echo $A it will return 1 so in that case I should have 2 files ...
user avatar
0 votes
1 answer
1k views

Can envsubst be used to replace environment variables in a given variable, not file?

I know that I can use envsubst command to replace environment variables inside a file and write it to an output file: envsubst < input.txt > output.txt However, now I only have a variable and ...
user avatar
2 votes
4 answers
2k views

The difference between "echo" and "export" an environment variable?

The environment is Ubuntu 18. If I add one line JAVA_HOME="/usr/java11" in /etc/environment, and execute source /etc/environment , I can echo this environment variable: echo $JAVA_HOME /usr/...
user avatar
  • 51
1 vote
1 answer
301 views

GPG Decrypt: Bad Session key / Variable Unset / Exclamation Mark

I am trying to decrypt a gpg file, but am continually getting the following error: gpg: decryption failed: Bad session key I realised afterwards that the gpg passphrase (which is set by a script) ...
user avatar
  • 125
6 votes
1 answer
468 views

Ubuntu Desktop: Why the .profile script is executed in an interactive non-login shell?

I understand about the difference between Interactive login and Interactive non-login According with this excellent post: Zsh/Bash startup files loading order (.bashrc, .zshrc etc.) we have the ...
user avatar
0 votes
0 answers
90 views

Environment Variables not visible in DJango

As you can see in the above image, that my environment variables are set and when I try to access them using the os module of python it works. But the moment I run my DJango application (which runs on ...
user avatar
0 votes
1 answer
105 views

Can a non-root modify environment variables?

Can a non-root (without sudo permissions) run the following command: export PATH=/tml:$PATH If so, how does it work? I thought environment variables are read-only for non-root users, while shell ...
user avatar
1 vote
3 answers
66 views

Adding to PATH for programs opened from the desktop

Ok, I know there are lots of ways to add to PATH. Each one has good reasons why you would choose a specific method vs another. However, what I don't know is in the case of a program opened from the ...
user avatar
0 votes
1 answer
254 views

Update info - how to currently set Java_home?

I'am trying to get Maven running. I have installed JDK and Maven. Thus I have been trying to set the Java_home variable for three days now, I cannot get it working. I have followed the instructions of ...
user avatar
0 votes
1 answer
454 views

How to escape whitespace in variable passed to cd

I am using WSL on windows 10 with Ubuntu. The path to a directory I use frequently includes a directory with a space in the name. I can't change that name. The path to the directory is very long: /...
user avatar
0 votes
1 answer
85 views

Set JAVA_HOME in Ubuntu without "install" the JDK

I've just downloaded and extracted the JDK archive, next moving it to my /opt directory. Inside IntelliJ, everything is working properly. I just point the path to the JDK in the settings. But I cannot ...
user avatar
0 votes
0 answers
78 views

Best place for pam_exec.so executable?

I implemented a pluggable authentication module (PAM) called checkConnections. I initially put this executable in /usr/local/sbin/ because Filesystem Hierarchy Standard says locally installed system ...
user avatar
  • 629
2 votes
1 answer
384 views

How Do I change the Environmental Variables for OpenMPI?

I have Ubuntu 20.04 installed and need to install OpenMPI 3.1.6 with gcc 8.4.0. I downloaded the tar ball from OpenMPI and installed it with the following command tar-xzf openmpi-3.1.6.tar.gz &&...
user avatar
1 vote
0 answers
182 views

VSCode remote ssh terminal not using environment variables

I'm using an Ubuntu machine as a headless dev machine. I am connecting through VSCode Remote-SSH. I open a terminal from within vscode and try to run 'go' but I get told the command cannot be found. I ...
user avatar
0 votes
0 answers
157 views

Ubuntu 20.04 gets stuck in the login loop

I can open the desktop using startx command in other tty I have tried a lot of methods: chown the Xauthority file chmod the /tmp check the /etc/environment file but all these methods do not work. ...
user avatar
0 votes
0 answers
52 views

PYTHONPATH really messed up, hoping to fix without wiping computer

I'm still figuring out how to set environment variables and paths and such, so this was bound to happen I suppose, But before trying to get started with python, I didn't know it already came installed ...
user avatar
  • 1
1 vote
1 answer
1k views

Ubuntu 20.04 setting path variable to solve laravel: command not found

I was following this solution and noticed that it's temporarily working for me. I tried doing export PATH="$PATH:$HOME/.config/composer/vendor/bin" >> ~/.bashrc and export PATH="$...
user avatar
  • 361
0 votes
0 answers
120 views

find -f results in unknown predicate in ubuntu, but works in macOS

I'm attempting to set an environment variable with the following script. find -f ./node_modules/@marcom/*/src/scss -type d -d 0 | tr $'\n' : This exact script works fine in macOS, however when I push ...
user avatar
0 votes
0 answers
117 views

How to deploy a WAR file to jetty without using sudo?

deploying this specific war file to jetty is somewhat awkward: nicholas@mordor:~/NetBeansProjects/x$ nicholas@mordor:~/NetBeansProjects/x$ sudo cp build/libs/x.war /var/lib/jetty9/webapps/ -v 'build/...
user avatar
0 votes
1 answer
249 views

how to read an enviroment variable declared in /etc/environment from bash?

How do I read or access the TRAVERSE environment variable below? nicholas@gondor:~$ nicholas@gondor:~$ printenv | grep PATH WINDOWPATH=2 PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/...
user avatar
-1 votes
1 answer
925 views

sudo: jupyter: command not found & OSError: [Errno 13] Permission denied: '/usr/local/share/jupyter'

If I try to check if jupyter is in my path or not using, I get something in return. which jupyter /home/usr/.local/bin/jupyter But when I try to install and enable an extension, I face error: sudo ...
user avatar
1 vote
1 answer
503 views

bash, set variable from script to memory

I need "set" variable from script to memory (global) and read it again in second run of this script with defined last state of this variable. Script. echo $count let "count=count+1"...
user avatar
  • 768
0 votes
1 answer
210 views

Setting the user environment variables in bash_profile

I am trying to set the user environment variables in home directory in bash_profile. But in home directory, 1)on running ls -l|grep bash_profile,no file is shown 2)For every session, I have to run ...
user avatar

1
2 3 4 5
20