Locale
Get locale-specific information.
현재 로케일을 확인할 수 있다. 기본값은 "POSIX"이다.
$ locale
Usage: locale [OPTION...] NAME
or: locale [OPTION...] [-a|-m]
System information:
-a, --all-locales Write names of available locales
-m, --charmaps Write names of available charmaps
Modify output format:
-c, --category-name Write names of selected categories
-k, --keyword-name Write names of selected keywords
-v, --verbose Print more information
-?, --help Give this help list
--usage Give a short usage message
-V, --version Print program version
locale -a 로 확인해 보면 다음과 같다.
$ locale -a
C
C.UTF-8
POSIX
C.UTF-8 로 설정된 경우에도 한글 입출력은 가능하다. 한글을 설정하려면 locales패키지를 설치한 후에 localedef 명령으로 ko_KR.UTF-8을 컴파일 하면 locale -a 로 확인하면 사용가능목록에 추가된 것을 확인할 수 있다. (데비안 우분투)
$ sudo apt install locales
$ localedef -f UTF-8 -i ko_KR ko_KR.utf8
로케일의 우선 순위는 LANG < LC_* < LC_ALL 이다.
환경변수를 설정하여 한국어 UTF-8로 설정할 수 있다.
$ export LC_ALL=ko_KR.utf8