env is a shell command for Linux, Unix, and Unix-like operating systems. It can print a list of the current environment variables, or to run another program in a custom environment without modifying the current one.

Description

If env is run without any options, it prints the variables of the current environment. Otherwise, env sets each NAME to VALUE and executes COMMAND.

  • Description
  • Syntax
  • Examples
  • Related commands
  • Linux commands help

Syntax

env [OPTION]… [-] [NAME=VALUE]… [COMMAND [ARG]…]

Options

Examples

env

Executing env with no options displays the current environment variables and their values. Output looks similar to the following:

HOME=/computerhope/public_html PATH=/usr/local/bin: LOGNAME=admin HZ=100 TERM=vt100 TZ=MST7MDT SHELL=/bin/csh MAIL=/var/mail/computerhope _INIT_UTS_PLATFORM=SUNW,SPARCstation-10 _INIT_UTS_RELEASE=5.7 _INIT_UTS_SYSNAME=SunOS _INIT_UTS_VERSION=Generic_106541-08 EDITOR=pico -t OPENWINHOME=/usr/openwin MANPATH=/usr/man:/usr/local/man:/usr/openwin/man LD_LIBRARY_PATH=/usr/local/lib:/usr/openwin/lib PAGER=more

Below is brief description of some commonly-used environment variables:

csh — The C shell command interpreter.ksh — The Korn shell command interpreter.logname — Return a user’s login name.printenv — Print all or part of the environment.sh — The Bourne shell command interpreter.