env

显示,设置或删除环境变量,在修改后的环境中运行命令

语法

 env [OPTION]... [NAME=VALUE]... [COMMAND [ARGS]...]

选项

-u NAME
--unset=NAME
   如果NAME存在,从环境中删除变量NAME.

 -
 -i
 --ignore-environment
   开始一个新的空的环境.

定义在新的环境中变量 `VARIABLE=VALUE’ ,定义多个变量定义用空格隔开

实例

env

env 命令实例:

linux命令:env env envrootopen.com
linux命令:env env envrootopen.com
2018-08-10 22:33:17

linux命令:env PS4=' ${BASH_SOURCE}:${LINENO}(${FUNCNAME[0]}) ' sh -x /etc/profile /etc/profile -x sh ' ${BASH_SOURCE}:${LINENO}(${FUNCNAME[0]}) PS4=' env env PS4=' ${BASH_SOURCE}:${LINENO}(${FUNCNAME[0]}) ' sh -x /etc/profilerootopen.com
linux命令:env PS4=' ${BASH_SOURCE}:${LINENO}(${FUNCNAME[0]}) ' sh -x /etc/profile /etc/profile -x sh ' ${BASH_SOURCE}:${LINENO}(${FUNCNAME[0]}) PS4=' env env PS4=' ${BASH_SOURCE}:${LINENO}(${FUNCNAME[0]}) ' sh -x /etc/profilerootopen.com
2018-01-21 06:33:48

linux命令:env LC_CTYPE=C tr -dc "a-zA-Z0-9-_\$\?" < /dev/urandom | head -c 10 10 -c head | /dev/urandom < "a-zA-Z0-9-_\$\?" -dc tr LC_CTYPE=C env env LC_CTYPE=C tr -dc "a-zA-Z0-9-_\$\?" < /dev/urandom | head -c 10rootopen.com
linux命令:env LC_CTYPE=C tr -dc "a-zA-Z0-9-_\$\?" < /dev/urandom | head -c 10 10 -c head | /dev/urandom < "a-zA-Z0-9-_\$\?" -dc tr LC_CTYPE=C env env LC_CTYPE=C tr -dc "a-zA-Z0-9-_\$\?" < /dev/urandom | head -c 10rootopen.com
2018-06-10 02:45:48

linux命令:env PS4=' ${BASH_SOURCE:-0$}:${LINENO}(${FUNCNAME[0]}) ' sh -x /etc/profile /etc/profile -x sh ' ${BASH_SOURCE:-0$}:${LINENO}(${FUNCNAME[0]}) PS4=' env env PS4=' ${BASH_SOURCE:-0$}:${LINENO}(${FUNCNAME[0]}) ' sh -x /etc/profilerootopen.com
linux命令:env PS4=' ${BASH_SOURCE:-0$}:${LINENO}(${FUNCNAME[0]}) ' sh -x /etc/profile /etc/profile -x sh ' ${BASH_SOURCE:-0$}:${LINENO}(${FUNCNAME[0]}) PS4=' env env PS4=' ${BASH_SOURCE:-0$}:${LINENO}(${FUNCNAME[0]}) ' sh -x /etc/profilerootopen.com
2018-04-08 23:25:48

linux命令:env DISPLAY=:0 /usr/bin/gedit ~/df.txt && wmctl -a gedit gedit -a wmctl && ~/df.txt /usr/bin/gedit DISPLAY=:0 env env DISPLAY=:0 /usr/bin/gedit ~/df.txt && wmctl -a geditrootopen.com
linux命令:env DISPLAY=:0 /usr/bin/gedit ~/df.txt && wmctl -a gedit gedit -a wmctl && ~/df.txt /usr/bin/gedit DISPLAY=:0 env env DISPLAY=:0 /usr/bin/gedit ~/df.txt && wmctl -a geditrootopen.com
2018-03-19 08:12:48

linux命令:env TERM="$(ssh SRC_SRV "date"):TERM" ssh -t DST_SRV 'TS=${TERM%:*}; TERM=${TERM##*:}; export TS; date ; sudo date -s "$TS"; date' date' "$TS"; -s date sudo ; date TS; export TERM=${TERM##*:}; 'TS=${TERM%:*}; DST_SRV -t ssh "date"):TERM" SRC_SRV TERM="$(ssh env env TERM="$(ssh SRC_SRV "date"):TERM" ssh -t DST_SRV 'TS=${TERM%:*}; TERM=${TERM##*:}; export TS; date ; sudo date -s "$TS"; date'rootopen.com
linux命令:env TERM="$(ssh SRC_SRV "date"):TERM" ssh -t DST_SRV 'TS=${TERM%:*}; TERM=${TERM##*:}; export TS; date ; sudo date -s "$TS"; date' date' "$TS"; -s date sudo ; date TS; export TERM=${TERM##*:}; 'TS=${TERM%:*}; DST_SRV -t ssh "date"):TERM" SRC_SRV TERM="$(ssh env env TERM="$(ssh SRC_SRV "date"):TERM" ssh -t DST_SRV 'TS=${TERM%:*}; TERM=${TERM##*:}; export TS; date ; sudo date -s "$TS"; date'rootopen.com
2018-01-26 09:27:48

Linux的Bash命令行(A-Z排序)