Can I have certain settings that are universal for all my users?
相关问题
- Is shmid returned by shmget() unique across proces
- how to get running process information in java?
- JQ: Select when attribute value exists in a bash a
- Error building gcc 4.8.3 from source: libstdc++.so
- Why should we check WIFEXITED after wait in order
If you are working on ubuntu type this command ~/.bashrc (if you are using gedit you could type gedit ~/.bashrc) then write the environment variable that you want to persist across all terminal sessions eg export variable="2015"
Your Path is set
Some interesting excerpts from the bash manpage:
So have a look at
/etc/profile
or/etc/bash.bashrc
, these files are the right places for global settings. Put something like this in them to set up an environement variable:Amazingly, Unix and Linux do not actually have a place to set global environment variables. The best you can do is arrange for any specific shell to have a site-specific initialization.
If you put it in
/etc/profile
, that will take care of things for most posix-compatible shell users. This is probably "good enough" for non-critical purposes.But anyone with a
csh
ortcsh
shell won't see it, and I don't believecsh
has a global initialization file.As well as
/etc/profile
which others have mentioned, some Linux systems now use a directory/etc/profile.d/
; any.sh
files in there will be sourced by/etc/profile
. It's slightly neater to keep your custom environment stuff in these files than to just edit/etc/profile
.Using PAM is execellent.