|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
List All Environment Variables Command
Время создания: 27.03.2017 10:02
Текстовые метки: linux variable environment global
Раздел: Linux
Запись: Velonski/mytetra-database/master/base/1490590978qyv6uv9dib/text.html на raw.githubusercontent.com
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
You can use any one of the following command to display the environment variables and their values. a) printenv command – Print all or part of environment. b) env command – Print all exported environment or run a program in a modified environment. c) set command – Print the name and value of each shell variable. Examples I recommend that you use the printenv command:
OR
OR
Sample outputs: Fig.01: Command to see a list of all currently defined environment variables in a Linux bash terminal A list of the commonly used variables in Linux
set and env command You can use the env / set command too:
Sample outputs: HOME=/home/vivek vivek@nas01:~$ env TERM=xterm-256color SHELL=/bin/bash XDG_SESSION_COOKIE=9ee90112ba2cb349f07bfe2f00002e46-1381581541.324726-906214463 SSH_CLIENT=192.168.1.6 60190 22 SSH_TTY=/dev/pts/1 USER=vivek MAIL=/var/mail/vivek PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games PWD=/home/vivek LANG=en_IN SHLVL=1 HOME=/home/vivek LANGUAGE=en_IN:en LOGNAME=vivek SSH_CONNECTION=192.168.1.6 60190 192.168.1.10 22 _=/usr/bin/env A note about env/set command The env will only display a list of environment variables that have been exported and it will not show all bash variables. The set command allows you to change the values of shell options and set the positional parameters, or to display the names and values of shell variables. If no options or arguments are supplied, set displays the names and values of all shell variables and functions, sorted according to the current locale, in a format that may be reused as input for setting or resetting the currently-set variables. Hence, I recommend that you use printenv command to dump the list of all shell variables on screen. To save the list of all shell environment variables to a file, enter:
Use the grep command to search for particular variable:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Так же в этом разделе:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|