How to list all the environment variables in Linux?
When I type the command
printenv it gives me lots of variables, but some variables like
PKG_CONFIG don't show up in this list.
I want to type a command that list all the environment variables including this variables (
env does list all environment variables.
LD_LIBRARY_PATH is not there, then that variable was not declared; or was declared but not
exported, so that child processes do not inherit it.
If you are setting
LD_LIBRARY_PATH in your shell start-up files, like
.bashrc make sure it is exported:
This will modify the variable.
To print it, type:
echo $LD_LIBRARY_PATH and it should show the above value.
If you're seeing nothing when you print that, then the variable might not be set.
The question in fact is a good question. when run
printenv, the output will be the system environment, but LD_LIBRARY_PATH is not belong to.
For example, if you set
a=1, you can't show it by
env. Same as LD_LIBRARY_PATH, it is used by ld.so only(ld. so – this little program that starts all your applications)