Including not only $HOME, $PWD etc but any other you have defined.
Enter the following command in a terminal to print all the environment variables:
For further information about this command, read the
To show a list including the "shell variables" you can enter the next command:
This will show you not only the shell variables, but the environment variables too.
For more information related with this topic read:
I know that this question is quite old and answered, but I think I can add a bit of useful information.
In all the methods described above, the procedure that is suggested is:
The problem of these solutions are that you are seeing the environment variables of the shell that is running into the terminal. You are not seeing the environment variables available to an application run, for example, directly by the graphic interface.
This is noticeable if, for example, you use your
To see the environment variables available to the application started directly in the graphic environment, you can do the following (in Gnome Shell, I am sure there is an equivalent method in all the other DE):
You now have a terminal with a shell that did not add any environment variables. You can use
Obviously the new shell will have the environment variables added by the system files, but that variables should be available (by inheritance) to all programs in the system anyway.
I am posting this because it's the fourth time I have to search this trick again, checking my
You can see all variables with the
If you're only interested in environment variables, use
To list the environment variables in terminal with CTRL+ALT+T you can use
for example :
hope that helps.
In bash using compgen:
env is a POSIX 7 way:
It only shows exported variables: non-exported variables are not usually considered "environment variables".
Prefer that over