Monday, April 15, 2024
692
rated 0 times [  692] [ 0]  / answers: 1 / hits: 828125  / 2 Years ago, fri, november 12, 2021, 12:25:36

How to list all variables names and their current values?



Including not only $HOME, $PWD etc but any other you have defined.


More From » command-line

 Answers
0

For bash: (the standard shell in Ubuntu)



Enter the following command in a terminal to print all the environment variables:



printenv


For further information about this command, read the printenv man page.






To show a list including the "shell variables" you can enter the next command:



( set -o posix ; set ) | less


This will show you not only the shell variables, but the environment variables too.



For more information related with this topic read:








For zsh: (an advanced shell)



Use the following command:



( setopt posixbuiltin; set; ) | less


For more information about ZSH options, see zshoptions man page.


[#31970] Saturday, November 13, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
inaterested

Total Points: 500
Total Questions: 104
Total Answers: 92

Location: Virgin Islands (U.S.)
Member since Fri, May 7, 2021
3 Years ago
inaterested questions
Fri, Aug 12, 22, 21:24, 2 Years ago
Wed, Apr 27, 22, 17:14, 2 Years ago
Tue, Oct 26, 21, 20:41, 3 Years ago
;