TrumanWong

env

Display environment variables that already exist in the system

Supplementary instructions

env command is used to display the environment variables that already exist in the system and execute instructions in the defined environment. When this command only uses "-" as a parameter option, the function of the option "-i" is hidden. If no options or parameters are set, the current environment variables will be displayed directly.

If you use the env command to execute instructions in a new environment, the error message "such file or directory" will be prompted because the environment variable "PATH" is not defined. At this point, the user can redefine a new "PATH" or use an absolute path.

grammar

env(options)(parameters)

Options

-i: Start a new empty environment;
-u<variable name>: Delete the specified variable from the current environment.

Parameters

  • Variable definition: Define variables in the new environment. Define multiple variable definitions separated by spaces. The format is "variable name = value";
  • Specify: Specify the instructions and parameters to be executed.

Example

[root@localhost ~]# env
hostname=LinServ-1
TERM=linux
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=192.168.2.111 2705 22
SSH_TTY=/dev/pts/0
USER=root
LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01: or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32: *.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*. arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz= 01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01; 35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:
mail=/var/spool/mail/root
PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
INPUTRC=/etc/inputrc
pwd=/root
LANG=zh_CN.UTF-8
SHLVL=1
HOME=/root
logname=root
SSH_CONNECTION=192.168.2.111 2705 192.168.2.2 22
LESSOPEN=|/usr/bin/lesspipe.sh %s
G_BROKEN_FILENAMES=1
_=/bin/env