What is the proper location for user defined environment variables? [duplicate]
This question already has an answer here:
Where to declare environment variables?
4 answers
What is the proper location for user defined environment variables in Ubuntu?
My first guess would be ~/.profile
. Ubuntu already creates that file which conditionally sources ~/.bashrc
and does some other things. That can't be it.
My second guess would be ~/.bashrc
. Ubuntu also creates that and it contains even more than ~/.profile
.
18.04 environment-variables
marked as duplicate by Community♦ 4 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
Where to declare environment variables?
4 answers
What is the proper location for user defined environment variables in Ubuntu?
My first guess would be ~/.profile
. Ubuntu already creates that file which conditionally sources ~/.bashrc
and does some other things. That can't be it.
My second guess would be ~/.bashrc
. Ubuntu also creates that and it contains even more than ~/.profile
.
18.04 environment-variables
marked as duplicate by Community♦ 4 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
I put my aliases, functions and variables in~/.bashrc
– WinEunuuchs2Unix
6 hours ago
add a comment |
This question already has an answer here:
Where to declare environment variables?
4 answers
What is the proper location for user defined environment variables in Ubuntu?
My first guess would be ~/.profile
. Ubuntu already creates that file which conditionally sources ~/.bashrc
and does some other things. That can't be it.
My second guess would be ~/.bashrc
. Ubuntu also creates that and it contains even more than ~/.profile
.
18.04 environment-variables
This question already has an answer here:
Where to declare environment variables?
4 answers
What is the proper location for user defined environment variables in Ubuntu?
My first guess would be ~/.profile
. Ubuntu already creates that file which conditionally sources ~/.bashrc
and does some other things. That can't be it.
My second guess would be ~/.bashrc
. Ubuntu also creates that and it contains even more than ~/.profile
.
This question already has an answer here:
Where to declare environment variables?
4 answers
18.04 environment-variables
18.04 environment-variables
asked 6 hours ago
cpburnzcpburnz
437725
437725
marked as duplicate by Community♦ 4 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Community♦ 4 hours ago
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
I put my aliases, functions and variables in~/.bashrc
– WinEunuuchs2Unix
6 hours ago
add a comment |
I put my aliases, functions and variables in~/.bashrc
– WinEunuuchs2Unix
6 hours ago
I put my aliases, functions and variables in
~/.bashrc
– WinEunuuchs2Unix
6 hours ago
I put my aliases, functions and variables in
~/.bashrc
– WinEunuuchs2Unix
6 hours ago
add a comment |
1 Answer
1
active
oldest
votes
From: What are the functional differences between .profile .bash_profile and .bashrc
.bash_profile
and .bashrc
are specific to bash
, whereas .profile
is read by many shells in the absence of their own shell-specific config files. (.profile
was used by the original Bourne shell.) .bash_profile
or .profile
is read by login shells, along with .bashrc
; subshells read only .bashrc
. (Between job control and modern windowing systems, .bashrc
by itself doesn't get used much. If you use screen
or tmux
, screens/windows usually run subshells instead of login shells.)
The idea behind this was that one-time setup was done by .profile
(or shell-specific version thereof), and per-shell stuff by .bashrc
. For example, you generally only want to load environment variables once per session instead of getting them whacked any time you launch a subshell within a session, whereas you always want your aliases (which aren't propagated automatically like environment variables are).
Other notable shell config files:
/etc/bash_profile
(fallback /etc/profile
) is read before the user's .profile
for system-wide configuration, and likewise /etc/bashrc
in subshells (no fallback for this one). Many systems including Ubuntu also use an /etc/profile.d
directory containing shell scriptlets, which are .
(source
)-ed from /etc/profile
; the fragments here are per-shell, with *.sh
applying to all Bourne/POSIX compatible shells and other extensions applying to that particular shell.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
From: What are the functional differences between .profile .bash_profile and .bashrc
.bash_profile
and .bashrc
are specific to bash
, whereas .profile
is read by many shells in the absence of their own shell-specific config files. (.profile
was used by the original Bourne shell.) .bash_profile
or .profile
is read by login shells, along with .bashrc
; subshells read only .bashrc
. (Between job control and modern windowing systems, .bashrc
by itself doesn't get used much. If you use screen
or tmux
, screens/windows usually run subshells instead of login shells.)
The idea behind this was that one-time setup was done by .profile
(or shell-specific version thereof), and per-shell stuff by .bashrc
. For example, you generally only want to load environment variables once per session instead of getting them whacked any time you launch a subshell within a session, whereas you always want your aliases (which aren't propagated automatically like environment variables are).
Other notable shell config files:
/etc/bash_profile
(fallback /etc/profile
) is read before the user's .profile
for system-wide configuration, and likewise /etc/bashrc
in subshells (no fallback for this one). Many systems including Ubuntu also use an /etc/profile.d
directory containing shell scriptlets, which are .
(source
)-ed from /etc/profile
; the fragments here are per-shell, with *.sh
applying to all Bourne/POSIX compatible shells and other extensions applying to that particular shell.
add a comment |
From: What are the functional differences between .profile .bash_profile and .bashrc
.bash_profile
and .bashrc
are specific to bash
, whereas .profile
is read by many shells in the absence of their own shell-specific config files. (.profile
was used by the original Bourne shell.) .bash_profile
or .profile
is read by login shells, along with .bashrc
; subshells read only .bashrc
. (Between job control and modern windowing systems, .bashrc
by itself doesn't get used much. If you use screen
or tmux
, screens/windows usually run subshells instead of login shells.)
The idea behind this was that one-time setup was done by .profile
(or shell-specific version thereof), and per-shell stuff by .bashrc
. For example, you generally only want to load environment variables once per session instead of getting them whacked any time you launch a subshell within a session, whereas you always want your aliases (which aren't propagated automatically like environment variables are).
Other notable shell config files:
/etc/bash_profile
(fallback /etc/profile
) is read before the user's .profile
for system-wide configuration, and likewise /etc/bashrc
in subshells (no fallback for this one). Many systems including Ubuntu also use an /etc/profile.d
directory containing shell scriptlets, which are .
(source
)-ed from /etc/profile
; the fragments here are per-shell, with *.sh
applying to all Bourne/POSIX compatible shells and other extensions applying to that particular shell.
add a comment |
From: What are the functional differences between .profile .bash_profile and .bashrc
.bash_profile
and .bashrc
are specific to bash
, whereas .profile
is read by many shells in the absence of their own shell-specific config files. (.profile
was used by the original Bourne shell.) .bash_profile
or .profile
is read by login shells, along with .bashrc
; subshells read only .bashrc
. (Between job control and modern windowing systems, .bashrc
by itself doesn't get used much. If you use screen
or tmux
, screens/windows usually run subshells instead of login shells.)
The idea behind this was that one-time setup was done by .profile
(or shell-specific version thereof), and per-shell stuff by .bashrc
. For example, you generally only want to load environment variables once per session instead of getting them whacked any time you launch a subshell within a session, whereas you always want your aliases (which aren't propagated automatically like environment variables are).
Other notable shell config files:
/etc/bash_profile
(fallback /etc/profile
) is read before the user's .profile
for system-wide configuration, and likewise /etc/bashrc
in subshells (no fallback for this one). Many systems including Ubuntu also use an /etc/profile.d
directory containing shell scriptlets, which are .
(source
)-ed from /etc/profile
; the fragments here are per-shell, with *.sh
applying to all Bourne/POSIX compatible shells and other extensions applying to that particular shell.
From: What are the functional differences between .profile .bash_profile and .bashrc
.bash_profile
and .bashrc
are specific to bash
, whereas .profile
is read by many shells in the absence of their own shell-specific config files. (.profile
was used by the original Bourne shell.) .bash_profile
or .profile
is read by login shells, along with .bashrc
; subshells read only .bashrc
. (Between job control and modern windowing systems, .bashrc
by itself doesn't get used much. If you use screen
or tmux
, screens/windows usually run subshells instead of login shells.)
The idea behind this was that one-time setup was done by .profile
(or shell-specific version thereof), and per-shell stuff by .bashrc
. For example, you generally only want to load environment variables once per session instead of getting them whacked any time you launch a subshell within a session, whereas you always want your aliases (which aren't propagated automatically like environment variables are).
Other notable shell config files:
/etc/bash_profile
(fallback /etc/profile
) is read before the user's .profile
for system-wide configuration, and likewise /etc/bashrc
in subshells (no fallback for this one). Many systems including Ubuntu also use an /etc/profile.d
directory containing shell scriptlets, which are .
(source
)-ed from /etc/profile
; the fragments here are per-shell, with *.sh
applying to all Bourne/POSIX compatible shells and other extensions applying to that particular shell.
answered 6 hours ago
WinEunuuchs2UnixWinEunuuchs2Unix
46.4k1189180
46.4k1189180
add a comment |
add a comment |
I put my aliases, functions and variables in
~/.bashrc
– WinEunuuchs2Unix
6 hours ago