Questions tagged [environment-variables]

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

Environment variables in determine the behavior and access in the system. Some of the settings are contained within configuration settings and others are determined by user input. The shell keeps track of all the settings in the environment, that builds every time it starts a session with variables, defining system properties.

Shell variables are shown with the set command:

$ set
BASH=/bin/bash
BASHOPTS=checkwinsize:cmdhist:complete_fullquote:expand_aliases:extglob:extquote:force_fignore:histappend:interactive_comments:progcomp:promptvars:sourcepath
BASH_ALIASES=()
BASH_ARGC=()
BASH_ARGV=()
BASH_CMDS=()

Common environment variables

PATH – a list of directory paths. When the user types a command without providing the full path, this list is checked to see whether it contains a path that leads to the command.

HOME – dictates where a user's home directory is located in the filesystem.

TERM – specifies the type of computer terminal or terminal emulator being used (e.g. xterm-256color)

SHELL - default shell

PWD - prints current working directory

MAIL – used to indicate where a user's mail is to be found

To show an environment variable use the command echo $<environment-variable> (e.g. echo $PATH).

1025 questions
979
votes
17 answers

How to add a directory to the PATH?

How do I add a directory to the $PATH in Ubuntu and make the changes permanent?
justingrif
  • 11,060
182
votes
8 answers

How do I set environment variables?

I'm trying to set up Apache Tomcat on my pc, and it wants me to set up an environment variable for CATALINA_HOME. Does any know how to do this?
jumpnett
  • 5,975
53
votes
1 answer

How to permanently set an environment variable

I am completely new to Ubuntu, and I would permanently set an environment variable. I have read here that I have to set ~/.profile, but I don't know how to apply it. In my case I would permanently set export PATH="/home/name/anaconda/bin:$PATH", how…
Simone
  • 633
46
votes
4 answers

Setting global environment variable for everyone

If I set a variable in /etc/environment, it only seems to apply to administrators while in sudo su. How can I get the variables to apply to everyone? Especially when they are in terminal? Do the settings in /etc/enviroment not apply to bash?
Mick.D
  • 461
30
votes
2 answers

What are "$PATH" and "~/bin"? How can I have personal scripts?

What is $PATH? How can I have commands/programs which are only available for me? I have seen this path ~/bin mentioned before, but what is it used for, and how do I use it?
Roger Pate
18
votes
3 answers

I have a problem when using "export" command

When I put sudo "export PROXY_LOCAL_NET_IP=10.113.35.108" I get the following error: sudo: export: command not found What should I do to resolve this problem?
Dady
  • 662
18
votes
2 answers

Where can I find documentation on the /etc/environment file format?

From System-wide environment variables: /etc/environment - This file is specifically meant for system-wide environment variable settings. It is not a script file, but rather consists of assignment expressions, one per line. Specifically, this file…
McDowell
  • 383
17
votes
2 answers

Difference between $LOGNAME and logname

When the echo $LOGNAME and logname commands run normally, I get identical results from them: pandya@pandya-desktop:~$ echo $LOGNAME pandya pandya@pandya-desktop:~$ logname pandya Is there any difference between them?
Pandya
  • 35,771
  • 44
  • 128
  • 188
15
votes
1 answer

How to reload variables from /etc/environment without re-logging in?

How to reload variables from /etc/environment without re-logging in? source /etc/environment in bash works for program run through terminal, but running programs through shortcuts at GUI does not work.
YOU
  • 255
14
votes
4 answers

changing /etc/environment did not affect my environment variables

I'm trying to install Euler expert system following these instructions. To add the environment variable I edited my /etc/environment to become as follows: …
9
votes
4 answers

Set LD_LIBRARY_PATH for applications started from the desktop

I have Qt Creator installed on Ubuntu 10.04 LTS. When I launch Qt Creator from the desktop I can build the application I am working on but cannot run or debug it. After struggling quite a bit I found that LD_LIBRARY_PATH is not set for…
dwj
  • 191
9
votes
5 answers

Possible to add all subdirectories when adding a directory to $PATH

When adding some directory to $PATH by PATH=~/my_program/bin:”${PATH}” is it true that only executables directly under the directory will be found via $PATH, but other executables under its subdirectores will not? is it possible to make all…
Tim
  • 25,177
8
votes
3 answers

The $PATH added to .bash_profile is not working after reboot

I am new to Ubuntu! And I am trying to setup manually Maven by adding Maven directory into $PATH. I created .bash_profile file in my home directory. The file contains this: export PATH=/opt/devel/tools/apache-maven-3.3.3/bin:$PATH And then on a…
Tuna
  • 195
8
votes
1 answer

Why is /usr/local/games after /usr/games in the default PATH?

The default value of the PATH environment variable in Ubuntu (13.10, at least) for an administrator (user in the sudo group) after logging in to the desktop environment…
user180409
8
votes
1 answer

libxml2.so.2 No version information available

I repeatedly get the following error when using GRASS GIS and I think a few other programs: /usr/local/lib/libxml2.so.2: no version information available ... As far as I can tell I have libxml2 installed…
Paul
  • 277
1
2 3 4 5 6