Skip to content

Environment variable

An environment variable is a dynamic-named value that can affect the way running processes will behave on a computer.

They are part of the environment in which a process runs. For example, a running process can query the value of the TEMP environment variable to discover a suitable location to store temporary files, or the HOME or USERPROFILE variable to find the directory structure owned by the user running the process.

They were introduced in their modern form in 1979 with Version 7 Unix, so are included in all Unix operating system flavors and variants from that point onward including Linux and macOS. From PC DOS 2.0 in 1982, all succeeding Microsoft operating systems including Microsoft Windows, and OS/2 also have included them as a feature, although with somewhat different syntax, usage and standard variable names.

환경 변수(環境 變數)는 프로세스가 컴퓨터에서 동작하는 방식에 영향을 미치는, 동적인 값들의 모임이다.

Categories

Softwares

  • Infisical - 환경변수를 암호화하여 팀과 공유하는 오픈소스

Common

PATH

콜론으로 구분된 디렉터리 목록을 포함하며 셸은 이름에 슬래시가 포함되지 않는 명령을 검색한다. 도스, OS/2, 윈도우의 %PATH% 변수와 동일하다.

HOME

사용자의 홈 디렉터리의 위치를 포함한다. getpwuid, getuid와 같은 C 함수를 통해 현재 사용자의 홈 디렉터리를 찾아낼 수 있으나 다양한 셸 스크립트(및 다른 컨텍스트)에서 편의를 위해 $HOME이 자주 사용된다.

DISPLAY

This variable is used to indicate to graphical applications where to display the actual graphical user interface, the value consists of 3 parts: A host-name followed by a colon (:), a display number followed by a dot (.) and a screen number. The host-name part can be used to have the graphical output sent to a remote machine over the network. It can be omitted when the output is meant for an X server running on the local machine. The display number allows selecting among multiple X servers running on the same machine (Ubuntu uses multiple X servers to enable multiple graphical desktop sessions). Although the screen number is used to select among multiple physical screen that are managed by the same X server, it is rarely set to anything other than "0" nowadays. Manually setting the "DISPLAY" environment variable's value is rarely needed nowadays since it can be automatically and intelligently adjusted by many applications such as "GDM" and "SSH" when needed.

X1 프로그램이 기본적으로 사용할 디스플레이 식별자를 포함한다.

Example:

:0.0
localhost:10.0
terminal01:0.0

Unix

$PWD
현재 디렉터리의 변수 지점. pwd 명령어를 변수 없이 호출할 때의 출력과 동일하다.
$LD_LIBRARY_PATH
동적 링커가 있는 수많은 유닉스 시스템에서 다른 모든 디렉터리를 찾기 전에 exec 이후 프로세스 이미지를 빌드할 때 동적 링커가 공유 오브젝트를 검색할 대상인 콜론 구분 디렉터리 목록을 포함한다.
$LANG, $LC_ALL, $LC_...
$LANG은 기본 로케일을 설정하기 위해 사용된다. 이를테면 로케일 값이 pt_BR이라면 언어는 (브라질) 포르투갈어로 설정된다.
각기 다른 지역화 관점은 개개의 $LC_- 변수($LC_CTYPE, $LC_COLLATE, $LC_DATE 등)들에 의해 제어된다.
$LC_ALL을 사용하면 모든 관점에 동일한 로케일을 강제하는데 사용할 수 있다.
$TZ
시간대를 참조한다. 시간대 자체를 지정하거나 파일을 참조(/usr/share/zoneinfo에서)시킴으로써 여러 형식으로 사용이 가능하다.

Windows

  • %ALLUSERSPROFILE%
  • %APPDATA%
  • %COMPUTERNAME%
  • %COMSPEC% - C:\Windows\System32\cmd.exe
  • %HOMEDRIVE% - C:
  • %HOMEPATH%
  • %PATH%
  • %PATHEXT%
  • %PROGRAMFILES%
  • %PROMPT%
  • %SYSTEMDRIVE%
  • %SYSTEMROOT%
  • %TEMP%%TMP%
  • %USERNAME%
  • %USERPROFILE%
  • %WINDIR%

잘 알려진

Favorite site