[AIX 운영 체제와 장치 관리 28] 사용자 환경 — 시작 파일, lscfg·lscons·tty·lsdisp·lsfont·lskbd·lslpp·stty·env·printenv, 환경 사용자 정의(/etc/environment·profile·.env·AIXwindows), 프롬프트
https://archive.horanglab.com/posts/aix-osdev-28
핵심 정리
- 로그인할 때
/etc/environment→/etc/profile→$HOME/.profile순서로 한 번 실행하고,.profile이ENV=$HOME/.env를 내보내면.env는 새 셸이나 창을 열 때마다 실행합니다. /etc/environment는 모든 프로세스의 기본 환경(HOME, LANG, NLSPATH, LOCPATH, PATH, TZ)을,/etc/profile은 시스템 전체 기본값(내보낼 변수, umask, 터미널 종류, 메일 알림)을 정합니다.lscfg(-l,-v로 VPD),lscons,tty,lsdisp,lsfont,lskbd,lslpp -l -a,stty -a,env,printenv로 시스템과 환경 정보를 봅니다.- xinit는
$XINITRC→$HOME/.xinitrc→/usr/lib/X11/$LANG/xinitrc→/usr/lpp/X11/defaults순서로 시작 스크립트를 찾습니다. Alt-Ctrl-Shift-!는 AIXwindows 동작을 기본값으로 되돌립니다. - 셸 변수는 export로 자식 셸에만 내려가며 부모로는 올라가지 않습니다. 제어 키와 프롬프트 변경은
.profile이나.env에 넣어야 로그아웃 뒤에도 유지됩니다.
| 항목 | 내용 |
|---|---|
| 버전 | AIX 6.1 (5.3판과 거의 같음) |
| 원문 | Operating system and device management — 5.3판 306319쪽, 6.1판 299312쪽 |
| 관련 명령어 | lscfg, lscons, tty, lsdisp, lsfont, lskbd, lslpp, stty, env, printenv, aixterm, export, chfont, xinit, mwm |
| 관련 파일 | /etc/environment, /etc/profile, $HOME/.profile, $HOME/.env, $HOME/.xinitrc, $HOME/.Xdefaults, $HOME/.mwmrc |
로그인 이름마다 자기 시스템 환경이 있습니다.
시스템 환경은 세션에서 실행되는 모든 프로세스에 공통인 정보를 저장하는 영역입니다. 여러 명령으로 시스템 정보를 볼 수 있습니다.
영어 원문
User environment
Each login name has its own system environment.
The system environment is an area where information that is common to all processes running in a session is stored. You can use several commands to display information about your system.
사용자 환경 파일과 사용자 정의 절차
다음 파일과 절차는 사용자가 시스템 환경을 맞추는 데 도움이 됩니다.
시스템 시작 파일
| 파일 | 설명 |
|---|---|
/etc/profile |
로그인할 때 시스템이 실행하는 명령이 든 시스템 파일 |
/etc/environment |
모든 프로세스의 기본 환경을 지정하는 변수가 든 시스템 파일 |
$HOME/.profile |
홈 디렉터리의 파일로, 로그인할 때 시스템 /etc/profile보다 우선하는 명령이 들어 있습니다. .profile 파일 절을 봅니다. |
$HOME/.env |
홈 디렉터리의 파일로, 시스템 /etc/environment보다 우선하며 모든 프로세스의 기본 환경을 지정하는 변수가 들어 있습니다. .env 파일 절을 봅니다. |
AIXwindows 시작 파일
| 파일 | 설명 |
|---|---|
$HOME/.xinitrc |
AIXwindows를 시작할 때 뜨는 창과 응용 프로그램을 제어하는 홈 디렉터리 파일 |
$HOME/.Xdefaults |
AIXwindows 자원의 시각적·동작 측면을 제어하는 홈 디렉터리 파일 |
$HOME/.mwmrc |
창 관리자의 키 바인딩, 마우스 버튼 바인딩, 메뉴 정의를 정의하는 홈 디렉터리 파일 |
사용자 정의 절차
| 항목 | 설명 |
|---|---|
| PS1 | 일반 시스템 프롬프트 |
| PS2 | 추가 입력 시스템 프롬프트 |
| PS3 | root 시스템 프롬프트(원문 그대로) |
| chfont | 시스템을 다시 시작할 때 디스플레이가 쓸 글꼴을 바꿉니다. |
| stty | 워크스테이션 운영 매개변수를 설정, 재설정, 보고합니다. |
영어 원문
User environment files and customization procedures
These files and procedures help the user customize the system environment.
System startup files
- /etc/profile — System file that contains commands that the system executes when you log in.
- /etc/environment — System file that contains variables specifying the basic environment for all processes.
$HOME/.profile— File in your home directory that contains commands that override the system /etc/profile when you log in. For more information, see .profile file.$HOME/.env— File in your home directory that overrides the system /etc/environment and contains variables specifying the basic environment for all processes. For more information, see .env file.
AIXwindows startup files
$HOME/.xinitrc— File in your home directory that controls the windows and applications that start up when you start AIXwindows. For more information, see .xinitrc file.$HOME/.Xdefaults— File in your home directory that controls the visual or behavioral aspect of AIXwindows resources. For more information, see “.Xdefaults file” on page 308.$HOME/.mwmrc— File in your home directory that defines key bindings, mouse button bindings, and menu definitions for your window manager. For more information, see “.mwmrc file” on page 309.
Customization procedures
- PS1 — Normal system prompt
- PS2 — More input system prompt
- PS3 — Root system prompt
- chfont — Changes the font used by a display at system restart
- stty — Sets, resets, and reports workstation operating parameters
시스템 장치 목록(lscfg 명령)
현재 구성에서 찾은 각 장치의 이름, 위치, 설명을 보려면 lscfg 명령을 씁니다. 목록은 장치 위치로 정렬됩니다.
예를 들어 시스템에 구성된 장치를 나열하려면 프롬프트에서 다음을 입력합니다.
lscfg
시스템은 다음과 비슷한 출력을 보여 줍니다.
INSTALLED RESOURCE LIST
The following resources are installed on your machine.
+/- = Added/Deleted from Diagnostic Test List.
* = NOT Supported by Diagnostics.
Model Architecture: chrp
Model Implementation: Multiple Processor, PCI bus
+ sysplanar0 00-00 CPU Planar
+ fpa0 00-00 Floating Point Processor
+ mem0 00-0A Memory Card
+ mem1 00-0B Memory Card
+ ioplanar0 00-00 I/O Planar
+ rs2320 00-01 RS232 Card
+ tty0 00-01-0-01 RS232 Card Port
- tty1 00-01-0-02 RS232 Card Port
..
..
..
장치 목록은 장치 위치만으로 정렬되지 않고 부모/자식 계층으로 정렬됩니다. 부모에 자식이 여럿이면 자식은 장치 위치로 정렬됩니다. 자식의 장치 위치가 같으면 소프트웨어가 얻은 순서로 보여 줍니다. 특정 장치의 정보를 보려면 -l 플래그를 씁니다. 예를 들어 sysplanar0 장치의 정보를 나열하려면 프롬프트에서 다음을 입력합니다.
lscfg -l sysplanar0
시스템은 다음과 비슷한 출력을 보여 줍니다.
DEVICE LOCATION DESCRIPTION
sysplanar0 00-00 CPU Planar
lscfg 명령으로 부품 번호, 일련 번호, 엔지니어링 변경 수준 같은 중요 제품 데이터(VPD)도 볼 수 있습니다. 어떤 장치는 VPD를 자동으로 모아 시스템 구성에 더하고, 다른 장치는 직접 입력합니다. 데이터 앞의 ME는 직접 입력한 데이터라는 뜻입니다.
예를 들어 시스템에 구성된 장치의 VPD를 나열하려면 프롬프트에서 다음을 입력합니다.
lscfg -v
시스템은 다음과 비슷한 출력을 보여 줍니다.
INSTALLED RESOURCE LIST WITH VPD
The following resources are installed in your machine.
Model Architecture: chrp
Model Implementation: Multiple Processor, PCI bus
sysplanar0 00-00 CPU Planar
Part Number.........342522
EC Level............254921
Serial Number.......353535
fpa0 00-00 Floating Point Processor
mem0 00-0A Memory Card
EC Level............990221
.
.
.
전체 구문은 Commands Reference, Volume 3의 lscfg 명령을 봅니다.
영어 원문
System devices list (lscfg command)
To display the name, location, and description of each device found in the current configuration, use the lscfg command. The list is sorted by device location.
For example, to list the devices configured in your system, at the prompt, type the following:
lscfg
The system displays output similar to the following:
(17줄짜리 예는 위 한글 본문에 그대로 실었습니다.)
The device list is not sorted by device location alone. It is sorted by the parent/child hierarchy. If the parent has multiple children, the children are sorted by device location. If the children have the same device location, they are displayed in the order in which they were obtained by the software. To display information about a specific device, you can use the -l flag. For example, to list the information on device
sysplanar0, at the prompt, type the following
lscfg -l sysplanar0
The system displays output similar to the following:
DEVICE LOCATION DESCRIPTION
sysplanar0 00-00 CPU Planar
You can also use the lscfg command to display vital product data (VPD), such as part numbers, serial numbers, and engineering change levels. For some devices, the VPD is collected automatically and added to the system configuration. For other devices, the VPD is typed manually. An ME preceding the data indicates that the data was typed manually.
For example, to list VPD for devices configured in your system, at the prompt, type the following:
lscfg -v
The system displays output similar to the following:
(14줄짜리 예는 위 한글 본문에 그대로 실었습니다.)
See the lscfg command in the Commands Reference, Volume 3 for the complete syntax.
콘솔 이름 보기
현재 콘솔 장치의 이름을 표준 출력(보통 화면)에 쓰려면 lscons 명령을 씁니다.
예를 들어 프롬프트에서 다음을 입력합니다.
lscons
시스템은 다음과 비슷한 출력을 보여 줍니다.
/dev/lft0
전체 구문은 lscons 명령을 봅니다.
영어 원문
Displaying console names
To write the name of the current console device to standard output (usually your screen), use the lscons command.
For example, at the prompt, type the following:
lscons
The system displays output similar to the following:
/dev/lft0
See the lscons command for the complete syntax.
터미널 이름 보기(tty 명령)
터미널 이름을 보려면 tty 명령을 씁니다.
예를 들어 프롬프트에서 다음을 입력합니다.
tty
시스템은 다음과 비슷한 정보를 보여 줍니다.
/dev/tty06
이 예에서 tty06은 터미널 이름이고, /dev/tty06은 이 터미널과의 인터페이스가 든 장치 파일입니다.
전체 구문은 Commands Reference, Volume 5의 tty 명령을 봅니다.
영어 원문
Displaying the terminal name (tty command)
To display the name of your terminal, use the tty command.
For example, at the prompt, type the following:
tty
The system displays information similar to the following:
/dev/tty06
In this example, tty06 is the name of the terminal, and /dev/tty06 is the device file that contains the interface to this terminal.
See the tty command in the Commands Reference, Volume 5 for the complete syntax.
쓸 수 있는 디스플레이 나열(lsdisp 명령)
시스템에서 지금 쓸 수 있는 디스플레이를 각각의 식별 이름, 슬롯 번호, 디스플레이 이름, 설명과 함께 나열하려면 lsdisp 명령을 씁니다.
예를 들어 쓸 수 있는 모든 디스플레이를 나열하려면 다음을 입력합니다.
lsdisp
다음은 출력 예입니다. 목록은 슬롯 번호 오름차순으로 나옵니다.
Name Slot Name Description
ppr0 00-01 POWER_G4 Midrange Graphics Adapter
gda0 00-03 colorgda Color Graphics Display Adapter
ppr1 00-04 POWER_Gt3 Midrange Entry Graphics Adapter
전체 구문은 Commands Reference, Volume 3의 lsdisp 명령을 봅니다.
영어 원문
Listing available displays (lsdisp command)
To list the displays currently available on your system, providing a display identification name, slot number, display name, and description of each of the displays, use the lsdisp command.
For example, to list all available displays, type the following:
lsdisp
The following is an example of the output. The list displays in ascending order according to slot number.
Name Slot Name Description
ppr0 00-01 POWER_G4 Midrange Graphics Adapter
gda0 00-03 colorgda Color Graphics Display Adapter
ppr1 00-04 POWER_Gt3 Midrange Entry Graphics Adapter
See the lsdisp command in the Commands Reference, Volume 3 for the complete syntax.
쓸 수 있는 글꼴 나열(lsfont 명령)
디스플레이에서 쓸 수 있는 글꼴 목록을 보려면 lsfont 명령을 씁니다.
예를 들어 디스플레이에서 쓸 수 있는 모든 글꼴을 나열하려면 다음을 입력합니다.
lsfont
다음은 글꼴 식별자, 파일 이름, 글리프 크기, 글꼴 인코딩을 보여 주는 출력 예입니다.
FONT FILE GLYPH FONT
ID NAME SIZE ENCODING
==== ============== ===== =========
0 Erg22.iso1.snf 12x30 ISO8859-1
1 Erg11.iso1.snf 8x15 ISO8859-1
전체 구문은 Commands Reference, Volume 3의 lsfont 명령을 봅니다.
영어 원문
Listing available fonts (lsfont command)
To display a list of the fonts available to your display, use the lsfont command.
For example, to list all fonts available to the display, type the following:
lsfont
The following is an example of the output, showing the font identifier, file name, glyph size, and font encoding:
FONT FILE GLYPH FONT
ID NAME SIZE ENCODING
==== ============== ===== =========
0 Erg22.iso1.snf 12x30 ISO8859-1
1 Erg11.iso1.snf 8x15 ISO8859-1
See the lsfont command in the Commands Reference, Volume 3 for the complete syntax.
현재 소프트웨어 키보드 맵 나열(lskbd 명령)
시스템에 적재된 현재 소프트웨어 키보드 맵의 절대 경로 이름을 보려면 lskbd 명령을 씁니다.
예를 들어 현재 키보드 맵을 나열하려면 다음을 입력합니다.
lskbd
다음은 lskbd 명령이 보여 주는 목록의 예입니다.
The current software keyboard map = /usr/lib/nls/loc/C.lftkeymap
영어 원문
Listing the current software keyboard map (lskbd command)
To display the absolute path name of the current software keyboard map loaded into the system, use the lskbd command.
For example, to list your current keyboard map, type the following:
lskbd
The following is an example of the listing displayed by the lskbd command:
The current software keyboard map = /usr/lib/nls/loc/C.lftkeymap
설치된 소프트웨어 제품 나열(lslpp 명령)
시스템에 있는 소프트웨어 제품 정보를 보려면 lslpp 명령을 씁니다.
예를 들어 시스템의 모든 소프트웨어 제품을 나열하려면 프롬프트에서 다음을 입력합니다.
lslpp -l -a
다음은 출력 예입니다.
Fileset Level State Description
-------------------- ------- -------- -----------------
Path: /usr/lib/objrepos
X11_3d.gl.dev.obj APPLIED AIXwindows/3D GL
Development Utilities
Fonts
X11fnt.oldX.fnt APPLIED AIXwindows Miscellaneous
X Fonts
X11mEn_US.msg APPLIED AIXwindows NL Message
files
.
.
.
목록이 아주 길면 윗부분이 화면 밖으로 밀려날 수 있습니다. 한 페이지(화면)씩 보려면 lslpp 명령을 pg 명령으로 파이프합니다. 프롬프트에서 다음을 입력합니다.
lslpp -l -a | pg
전체 구문은 Commands Reference, Volume 3의 lslpp 명령을 봅니다.
영어 원문
Listing available software products (lslpp command)
To display information about software products available on your system, use the lslpp command.
For example, to list all the software products in your system, at the system prompt, type the following:
lslpp -l -a
The following is an example of the output:
(13줄짜리 예는 위 한글 본문에 그대로 실었습니다.)
If the listing is very long, the top portion may scroll off the screen. To display the listing one page (screen) at a time, use the lslpp command piped to the pg command. At the prompt, type the following:
lslpp -l -a | pg
See the lslpp command in the Commands Reference, Volume 3 for the complete syntax.
터미널의 제어 키 할당 목록(stty 명령)
터미널 설정을 보려면 stty 명령을 씁니다. 특히 터미널이 어떤 키를 제어 키로 쓰는지 눈여겨봅니다.
예를 들어 프롬프트에서 다음을 입력합니다.
stty -a
시스템은 다음과 비슷한 정보를 보여 줍니다.
.
.
.
intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D;
eol = ^@ start = ^Q; stop = ^S; susp = ^Z; dsusp = ^Y;
reprint = ^R discard = ^O; werase = ^W; lnext = ^V
.
.
.
이 예에서 intr = ^C; quit = ^\; erase = ^H; 같은 줄이 제어 키 설정입니다. ^H 키는 Backspace 키이며 지우기 기능을 하도록 설정돼 있습니다.
목록이 아주 길면 윗부분이 화면 밖으로 밀려날 수 있습니다. 한 페이지씩 보려면 stty 명령을 pg 명령으로 파이프합니다. 프롬프트에서 다음을 입력합니다.
stty -a | pg
전체 구문은 Commands Reference, Volume 5의 stty 명령을 봅니다.
관련 개념
- 포그라운드 프로세스 취소 — 포그라운드 프로세스를 시작한 뒤 끝내지 않기로 했다면 INTERRUPT(보통 Ctrl-C나 Ctrl-Backspace)를 눌러 취소할 수 있습니다.
영어 원문
List of control key assignments for your terminal (stty command)
To display your terminal settings, use the stty command. Note especially which keys your terminal uses for control keys.
For example, at the prompt, type the following:
stty -a
The system displays information similar to the following:
.
.
.
intr = ^C; quit = ^\; erase = ^H; kill = ^U; eof = ^D;
eol = ^@ start = ^Q; stop = ^S; susp = ^Z; dsusp = ^Y;
reprint = ^R discard = ^O; werase = ^W; lnext = ^V
.
.
.
In this example, lines such as intr = ^C; quit = ^\; erase = ^H; display your control key settings. The ^H key is the Backspace key, and it is set to perform the erase function.
If the listing is very long, the top portion may scroll off the screen. To display the listing one page (screen) at a time, use the stty command piped to the pg command. At the prompt, type the following:
stty -a | pg
See the stty command in the Commands Reference, Volume 5 for the complete syntax.
Related concepts
Foreground process cancellation If you start a foreground process and then decide that you do not want it to finish, you can cancel it by pressing INTERRUPT. This is usually Ctrl-C or Ctrl-Backspace.
환경 변수 나열(env 명령)
현재 환경 변수를 보려면 env 명령을 씁니다. 모든 프로세스가 접근할 수 있는 환경 변수를 전역 변수라고 합니다.
예를 들어 모든 환경 변수와 값을 나열하려면 다음을 입력합니다.
env
다음은 출력 예입니다.
TMPDIR=/usr/tmp
myid=denise
LANG=En_US
UNAME=barnard
PAGER=/bin/pg
VISUAL=vi
PATH=/usr/ucb:/usr/lpp/X11/bin:/bin:/usr/bin:/etc:/u/denise:/u/denise/bin:/u/bin1
MAILPATH=/usr/mail/denise?denise has mail !!!
MAILRECORD=/u/denise/.Outmail
EXINIT=set beautify noflash nomesg report=1 showmode showmatch
EDITOR=vi
PSCH=>
HISTFILE=/u/denise/.history
LOGNAME=denise
MAIL=/usr/mail/denise
PS1=denise@barnard:${PWD}>
PS3=#
PS2=>
epath=/usr/bin
USER=denise
SHELL=/bin/ksh
HISTSIZE=500
HOME=/u/denise
FCEDIT=vi
TERM=lft
MAILMSG=**YOU HAVE NEW MAIL. USE THE mail COMMAND TO SEE YOUR PWD=/u/denise
ENV=/u/denise/.env
목록이 아주 길면 윗부분이 화면 밖으로 밀려납니다. 한 페이지씩 보려면 env 명령을 pg 명령으로 파이프합니다. 프롬프트에서 다음을 입력합니다.
env | pg
전체 구문은 Commands Reference, Volume 2의 env 명령을 봅니다.
영어 원문
Listing environment variables (env command)
To display your current environment variables, use the env command. An environment variable that is accessible to all your processes is called a global variable.
For example, to list all environment variables and their associated values, type the following:
env
The following is an example of the output:
(27줄짜리 예는 위 한글 본문에 그대로 실었습니다.)
If the listing is very long, the top portion scrolls off the screen. To display the listing one page (screen) at a time, use the env command piped to the pg command. At the prompt, type the following:
env | pg
See the env command in the Commands Reference, Volume 2 for the complete syntax.
환경 변수 값 보기(printenv 명령)
환경 변수 값을 보려면 printenv 명령을 씁니다.
Name 매개변수를 지정하면 요청한 변수의 값만 출력합니다. 지정하지 않으면 현재 환경 변수를 모두 한 줄에 Name=Value 하나씩 보여 줍니다.
예를 들어 MAILMSG 환경 변수의 현재 설정을 알아보려면 다음을 입력합니다.
printenv MAILMSG
명령은 MAILMSG 환경 변수의 값을 돌려줍니다. 예:
YOU HAVE NEW MAIL
전체 구문은 Commands Reference, Volume 4의 printenv 명령을 봅니다.
영어 원문
Displaying an environment variable value (printenv command)
To display the values of environment variables, use the printenv command.
If you specify the Name parameter, the system only prints the value associated with the variable you requested. If you do not specify the Name parameter, the printenv command displays all current environment variables, showing one Name =Value sequence per line.
For example, to find the current setting of the MAILMSG environment variable, type the following:
printenv MAILMSG
The command returns the value of the MAILMSG environment variable. For example:
YOU HAVE NEW MAIL
See the printenv command in the Commands Reference, Volume 4 for the complete syntax.
양방향 언어(aixterm 명령)
aixterm 명령은 양방향 언어인 아랍어와 히브리어를 지원합니다.
양방향 언어는 왼쪽에서 오른쪽, 오른쪽에서 왼쪽 두 방향으로 읽고 쓸 수 있습니다. 아랍어나 히브리어 로케일을 지정해 창을 열면 아랍어와 히브리어 응용 프로그램을 쓸 수 있습니다.
전체 구문은 Commands Reference, Volume 1의 aixterm 명령을 봅니다.
영어 원문
Bidirectional languages (aixterm command)
The aixterm command supports Arabic and Hebrew, which are bidirectional languages.
Bidirectional languages have the ability to be read and written in two directions: from left to right and from right to left. You can work with Arabic and Hebrew applications by opening a window specifying an Arabic or Hebrew locale.
See the aixterm command in the Commands Reference, Volume 1 for the complete syntax.
사용자 환경과 시스템 정보 명령 요약
다음은 사용자 환경과 시스템 정보에 쓰는 명령입니다.
| 명령 | 설명 |
|---|---|
| aixterm | 양방향 언어로 작업할 수 있게 합니다. |
| env | 현재 환경을 보여 주거나 명령 실행 환경을 설정합니다. |
| lscfg | 장치의 진단 정보를 보여 줍니다. |
| lscons | 현재 콘솔 이름을 보여 줍니다. |
| lsdisp | 시스템에서 지금 쓸 수 있는 디스플레이를 나열합니다. |
| lsfont | 디스플레이가 쓸 수 있는 글꼴을 나열합니다. |
| lskbd | 시스템에 지금 적재된 키보드 맵을 나열합니다. |
| lslpp | 소프트웨어 제품을 나열합니다. |
| printenv | 환경 변수 값을 보여 줍니다. |
| stty | 시스템 설정을 보여 줍니다. |
| tty | 터미널의 전체 경로 이름을 보여 줍니다. |
영어 원문
Command summary for user environment and system information
The following are commands for user environment and system information.
- aixterm — Enables you work with bidirectional languages
- env — Displays the current environment or sets the environment for the execution of a command
- lscfg — Displays diagnostic information about a device
- lscons — Displays the name of the current console
- lsdisp — Lists the displays currently available on the system
- lsfont — Lists the fonts available for use by the display
- lskbd — Lists the keyboard maps currently loaded in the system
- lslpp — Lists software products
- printenv — Displays the values of environment variables
- stty — Displays system settings
- tty — Displays the full path name of your terminal
사용자 환경 사용자 정의
운영 체제는 사용자 환경의 동작과 모양을 맞출 수 있는 여러 명령과 초기화 파일을 제공합니다.
시스템에서 쓰는 응용 프로그램의 일부 기본 자원도 맞출 수 있습니다. 기본값은 프로그램이 시작할 때 적용됩니다. 기본값을 바꾸면 새 기본값이 효과를 내도록 프로그램을 끝냈다가 다시 시작해야 합니다.
Common Desktop Environment의 동작과 모양을 맞추는 방법은 Common Desktop Environment 1.0: Advanced User's and System Administrator's Guide를 봅니다.
시스템 시작 파일
로그인하면 셸은 설정해 둔 초기화 파일을 읽은 뒤 사용자 환경을 정합니다. 사용자 환경의 특성은 환경 변수에 준 값으로 정해집니다. 이 환경은 로그아웃할 때까지 유지됩니다.
셸은 운영 체제에 로그인할 때 두 종류의 프로파일 파일을 씁니다. 파일에 든 명령을 평가한 뒤 실행해 시스템 환경을 설정합니다.
두 파일은 기능이 비슷하지만 /etc/profile 파일은 시스템의 모든 사용자에 대한 프로파일 변수를 제어하고 .profile 파일은 자기 환경을 맞추게 합니다.
셸은 먼저 /etc/environment 파일의 명령을 실행해 시스템 환경을 설정하고 /etc/profile 파일의 명령을 평가합니다. 그런 다음 홈 디렉터리에 .profile 파일이 있는지 확인해 있으면 실행합니다. .profile 파일은 환경 파일이 있는지도 지정합니다. 환경 파일(보통 .env)이 있으면 그 파일을 실행해 환경 변수를 설정합니다.
/etc/environment, /etc/profile, .profile 파일은 로그인할 때 한 번 실행합니다. 반면 .env 파일은 새 셸이나 창을 열 때마다 실행합니다.
/etc/environment 파일
로그인할 때 운영 체제가 처음 쓰는 파일은 /etc/environment 파일입니다. 이 파일에는 모든 프로세스의 기본 환경을 지정하는 변수가 들어 있습니다.
새 프로세스가 시작하면 exec 서브루틴이 Name=Value 꼴의 문자열 배열을 쓸 수 있게 합니다. 이 문자열 배열을 환경이라고 합니다. 문자열 하나가 정의하는 각 이름을 환경 변수나 셸 변수라고 합니다. exec 서브루틴은 환경 전체를 한 번에 설정할 수 있게 합니다.
로그인하면 시스템은 로그인 프로파일 .profile을 읽기 전에 /etc/environment 파일에서 환경 변수를 설정합니다. 다음 변수가 기본 환경을 이룹니다.
| 변수 | 설명 |
|---|---|
| HOME | 사용자의 로그인(HOME) 디렉터리 전체 경로 이름. login 프로그램이 /etc/passwd 파일에 지정한 이름으로 설정합니다. |
| LANG | 현재 적용 중인 로케일 이름. 설치할 때 /etc/profile 파일(원문 그대로)에서 처음 설정합니다. |
| NLSPATH | 메시지 카탈로그의 전체 경로 이름 |
| LOCPATH | 국가 언어 지원 표 위치의 전체 경로 이름 |
| PATH | sh, time, nice, nohup 같은 명령이 경로 이름이 불완전한 명령을 찾을 때 찾는 디렉터리 순서 |
| TZ | 시간대 정보. 시스템 로그인 프로파일인 /etc/profile 파일(원문 그대로)이 처음 설정합니다. |
/etc/environment 파일에 관한 자세한 정보는 Files Reference를 봅니다.
/etc/profile 파일
로그인할 때 운영 체제가 두 번째로 쓰는 파일은 /etc/profile 파일입니다.
/etc/profile 파일은 다음과 같은 시스템 전체 기본 변수를 제어합니다.
- 내보낼 변수
- 파일 생성 마스크(umask)
- 터미널 종류
- 새 메일이 왔음을 알리는 메일 메시지
시스템 관리자가 시스템의 모든 사용자를 위해 /etc/profile 파일을 구성하며, 시스템 관리자만 이 파일을 바꿀 수 있습니다.
다음은 전형적인 /etc/profile 파일의 예입니다.
#Set file creation mask
umask 022
#Tell me when new mail arrives
MAIL=/usr/mail/$LOGNAME
#Add my /bin directory to the shell search sequence
PATH=/usr/bin:/usr/sbin:/etc::
#Set terminal type
TERM=lft
#Make some environment variables global
export MAIL PATH TERM
/etc/profile 파일에 관한 자세한 정보는 Files Reference를 봅니다.
.profile 파일
.profile 파일은 홈($HOME) 디렉터리에 있으며 개인 작업 환경을 맞추게 합니다.
.profile 파일은 숨김 파일이므로 ls -a 명령으로 나열합니다.
login 프로그램이 LOGNAME(로그인 이름)과 HOME(로그인 디렉터리) 변수를 환경에 더한 뒤 $HOME/.profile 파일이 있으면 그 명령을 실행합니다. .profile 파일에는 /etc/profile 파일에서 설정한 변수보다 우선하는 개인 프로파일이 들어 있습니다. .profile 파일은 내보낼 환경 변수와 터미널 모드를 설정하는 데 자주 씁니다. .profile 파일을 고쳐 환경을 맞출 수 있습니다. .profile 파일로 다음 기본값을 제어합니다.
- 열 셸
- 프롬프트 모양
- 키보드 소리
다음은 전형적인 .profile 파일의 예입니다.
PATH=/usr/bin:/etc:/home/bin1:/usr/lpp/tps4.0/user::
epath=/home/gsc/e3:
export PATH epath
csh
이 예는 경로 변수 두 개(PATH와 epath)를 정의하고 내보낸 뒤 C 셸(csh)을 엽니다.
.profile 파일(없으면 /etc/profile 파일)로 로그인 셸 변수를 정할 수도 있습니다. 다른 셸 환경도 맞출 수 있습니다. 예를 들어 .cshrc 파일과 .kshrc 파일로 각각 C 셸과 Korn 셸이 시작할 때의 환경을 맞춥니다.
.env 파일
.profile에 다음 줄이 있으면 운영 체제가 로그인할 때 네 번째로 쓰는 파일은 .env 파일입니다. export ENV=$HOME/.env
.env 파일로 개인 작업 환경 변수를 맞춥니다. .env 파일은 숨김 파일이므로 ls -a 명령으로 나열합니다. ls 명령에 관한 자세한 내용은 ls를 봅니다. .env 파일에는 /etc/environment 파일에서 설정한 변수보다 우선하는 개인 사용자 환경 변수가 들어 있습니다. .env 파일을 고쳐 환경 변수를 원하는 대로 맞출 수 있습니다.
다음은 전형적인 .env 파일의 예입니다.
export myid=`id | sed -n -e ’s/).*$//’ -e ’s/^.*(//p’`
#set prompt: login & system name & path
if [ $myid = root ]
then typeset -x PSCH=’#:\${PWD}> ’
PS1="#:\${PWD}> "
else typeset -x PSCH=’>’
PS1="$LOGNAME@$UNAME:\${PWD}> "
PS2=">"
PS3="#?"
fi
export PS1 PS2 PS3
#setup my command aliases
alias ls="/bin/ls -CF" \
d="/bin/ls -Fal | pg" \
rm="/bin/rm -i" \
up="cd .."
참고: .env 파일을 고칠 때 새로 만든 환경 변수가 MAIL, PS1, PS2, IFS 같은 표준 변수와 충돌하지 않게 합니다.
AIXwindows 시작 파일
컴퓨터 시스템마다 X 서버와 AIXwindows를 시작하는 방법이 다릅니다.
그래서 시작하는 방법은 시스템 관리자에게 물어봅니다. 보통 X 서버와 AIXwindows는 로그인할 때 자동으로 실행되는 셸 스크립트에서 시작합니다. 그러나 X 서버나 AIXwindows, 또는 둘 다를 직접 시작해야 할 수도 있습니다.
로그인했는데 디스플레이가 창 없이 단일 터미널로 동작하면 다음을 입력해 X 서버를 시작할 수 있습니다.
xinit
참고: 이 명령을 입력하기 전에 포인터가 시스템 프롬프트가 있는 창 안에 있는지 확인합니다.
이 명령으로 X 서버가 시작되지 않으면 실행 프로그램이 든 X11 디렉터리가 검색 경로에 있는지 시스템 관리자에게 확인합니다. 알맞은 경로는 시스템마다 다를 수 있습니다.
로그인했는데 테두리 없는 창이 하나 이상 있으면 다음을 입력해 AIXwindows 창 관리자를 시작할 수 있습니다.
mwm &
AIXwindows는 응용 프로그램을 만드는 프로그래머와 사용자 모두가 맞출 수 있으므로, 마우스 버튼이나 다른 기능이 이 문서에서 읽은 것과 다르게 동작할 수 있습니다. 다음 네 키를 함께 누르고 있으면 AIXwindows 환경을 기본 동작으로 되돌릴 수 있습니다.
Alt-Ctrl-Shift-!
이 키 조합을 다시 누르면 맞춘 동작으로 돌아갑니다. 시스템이 이 키 조합을 허용하지 않으면 기본 루트 메뉴에서도 기본 동작을 되살릴 수 있습니다.
.xinitrc 파일
xinit 명령은 시작할 X 클라이언트 프로그램을 나열한, 사용자가 맞출 수 있는 셸 스크립트 파일을 씁니다. 홈 디렉터리의 .xinitrc 파일이 AIXwindows를 시작할 때 뜨는 창과 응용 프로그램을 제어합니다.
xinit 명령은 다음 순서로 셸 스크립트를 씁니다.
- 먼저
$XINITRC환경 변수를 찾아 AIXwindows를 시작합니다. $XINITRC환경 변수가 없으면$HOME/.xinitrc셸 스크립트를 찾습니다.$HOME/.xinitrc셸 스크립트가 없으면/usr/lib/X11/$LANG/xinitrc셸 스크립트를 시작합니다./usr/lib/X11/$LANG/xinitrc가 없으면/usr/lpp/X11/defaults/$LANG/xinitrc셸 스크립트를 찾습니다. 그것도 없으면/usr/lpp/X11/defaults/xinitrc셸 스크립트를 찾습니다.xinitrc셸 스크립트는 mwm(AIXwindows 창 관리자), aixterm, xclock 같은 명령을 시작합니다.
xinit 명령은 다음을 합니다.
- 현재 디스플레이에서 X 서버를 시작합니다.
$DISPLAY환경 변수를 설정합니다.xinitrc파일을 실행해 X 클라이언트 프로그램을 시작합니다.
다음은 xinitrc 파일에서 맞출 수 있는 부분의 예입니다.
# This script is invoked by /usr/lpp/X11/bin/xinit
.
.
.
#***************************************************************
# Start the X clients. Change the following lines to *
# whatever command(s) you desire! *
# The default clients are an analog clock (xclock), an lft *
# terminal emulator (aixterm), and the Motif Window Manager *
# (mwm). *
#****************************************************************
exec mwm
.Xdefaults 파일
AIXwindows 인터페이스에서 작업한다면 .Xdefaults 파일로 이 인터페이스를 맞출 수 있습니다. AIXwindows에서는 색과 글꼴 같은 시각적 특성의 선호를 지정할 수 있습니다.
창 기반 응용 프로그램(원문은 Windows operating system based application)의 모양과 동작은 대부분 자원이라는 변수 묶음으로 제어합니다. 자원의 시각적·동작 측면은 할당된 값이 정합니다. 자원 값에는 여러 종류가 있습니다. 예를 들어 색을 제어하는 자원에는 DarkSlateBlue나 Black 같은 미리 정의된 값을, 크기를 지정하는 자원에는 숫자 값을 할당합니다. 어떤 자원은 부울 값(True나 False)을 받습니다.
홈 디렉터리에 .Xdefaults 파일이 없으면 아무 텍스트 편집기로 만들 수 있습니다. 홈 디렉터리에 이 파일이 생기면 원하는 대로 자원 값을 설정할 수 있습니다. Xdefaults.tmpl이라는 기본 예제 파일이 /usr/lpp/X11/defaults 디렉터리에 있습니다.
다음은 전형적인 .Xdefaults 파일의 일부입니다.
*AutoRaise: on
*DeIconifyWarp: on
*warp:on
*TitleFont:andysans12
*scrollBar: true
*font: Rom10.500
Mwm*menu*foreground: black
Mwm*menu*background: CornflowerBlue
Mwm*menu*RootMenu*foreground: black
Mwm*menu*RootMenu*background: CornflowerBlue
Mwm*icon*foreground: grey25
Mwm*icon*background: LightGray
Mwm*foreground: black
Mwm*background: LightSkyBlue
Mwm*bottomShadowColor: Blue1
Mwm*topShadowColor: CornflowerBlue
Mwm*activeForeground: white
Mwm*activeBackground: Blue1
Mwm*activeBottomShadowColor: black
Mwm*activeTopShadowColor: LightSkyBlue
Mwm*border: black
Mwm*highlight:white
aixterm.foreground: green
aixterm.background: black
aixterm.fullcursor: true
aixterm.ScrollKey: on
aixterm.autoRaise: true
aixterm.autoRaiseDelay: 2
aixterm.boldFont:Rom10.500
aixterm.geometry: 80x25
aixterm.iconFont: Rom8.500
aixterm.iconStartup: false
aixterm.jumpScroll: true
aixterm.reverseWrap: true
aixterm.saveLines: 500
aixterm.scrollInput: true
aixterm.scrollKey: false
aixterm.title: AIX
.mwmrc 파일
맞추고 싶은 기능은 대부분 .Xdefaults 파일의 자원으로 설정할 수 있습니다. 그러나 창 관리자의 키 바인딩, 마우스 버튼 바인딩, 메뉴 정의는 .Xdefaults 파일의 자원이 가리키는 보조 파일 .mwmrc에 지정합니다.
홈 디렉터리에 .mwmrc 파일이 없으면 다음과 같이 복사할 수 있습니다.
cp /usr/lib/X11/system.mwmrc .mwmrc
.mwmrc 파일은 system.mwmrc 파일의 시스템 전체 효과보다 우선하므로 사용자의 지정이 다른 사용자의 지정을 방해하지 않습니다.
다음은 전형적인 system.mwmrc 파일의 일부입니다.
# DEFAULT mwm RESOURCE DESCRIPTION FILE (system.mwmrc)
#
# menu pane descriptions
#
# Root Menu Description
Menu RootMenu
{ "Root Menu" f.title
no-label f.separator
"New Window" f.exec "aixterm &"
"Shuffle Up" f.circle_up
"Shuffle Down" f.circle_down
"Refresh" f.refresh
no-label f.separator
"Restart" f.restart
"Quit" f.quit_mwm
}
# Default Window Menu Description
Menu DefaultWindowMenu MwmWindowMenu
{ "Restore" _R Alt<Key>F5 f.normalize
"Move" _M Alt<Key>F7 f.move
"Size" _S Alt<Key>F8 f.resize
"Minimize" _n Alt<Key>F9 f.minimize
"Maximize" _x Alt<Key>F10 f.maximize
"Lower" _L Alt<Key>F3 f.lower
no-label f.separator
"Close" _C Alt<Key>F4 f.kill
}
# no acclerator window menu
Menu NoAccWindowMenu
{
"Restore" _R f.normalize
"Move" _M f.move
"Size" _S f.resize
"Minimize" _n f.minimize
"Maximize" _x f.maximize
"Lower" _L f.lower
no-label f.separator
"Close" _C f.kill
}
Keys DefaultKeyBindings
{
Shift<Key>Escape icon|window f.post_wmenu
Meta<Key>space icon|window f.post_wmenu
Meta<Key>Tab root|icon|window f.next_key
Meta Shift<Key>Tab root|icon|window f.prev_key
Meta<Key>Escape root|icon|window f.next_key
Meta Shift<Key>Escape root|icon|window f.prev_key
Meta Ctrl Shift<Key>exclam root|icon|window f.set_behavior
}
#
# button binding descriptions
#
Buttons DefaultButtonBindings
{
<Btn1Down> frame|icon f.raise
<Btn3Down> frame|icon f.post_wmenu
<Btn1Down> root f.menu RootMenu
<Btn3Down> root f.menu RootMenu
Meta<Btn1Down> icon|window f.lower
Meta<Btn2Down> window|icon f.resize
Meta<Btn3Down> window f.move
}
Buttons PointerButtonBindings
{
<Btn1Down> frame|icon f.raise
<Btn2Down> frame|icon f.post_wmenu
<Btn3Down> frame|icon f.lower
<Btn1Down> root f.menu RootMenu
Meta<Btn2Down> window|icon f.resize
Meta<Btn3Down> window|icon f.move
}
#
# END OF mwm RESOURCE DESCRIPTION FILE
#
셸 변수 내보내기(export 셸 명령)
지역 셸 변수는 그것을 만든 셸만 아는 변수입니다. 새 셸을 시작하면 이전 셸의 변수를 모릅니다. 새로 여는 셸이 이전 셸의 변수를 쓰게 하려면 변수를 내보내 전역으로 만듭니다.
export 명령으로 지역 변수를 전역으로 만들 수 있습니다. 지역 셸 변수를 자동으로 전역으로 만들려면 .profile 파일에서 내보냅니다.
참고: 변수는 자식 셸로 내보낼 수 있지만 부모 셸로 올려 보낼 수는 없습니다.
다음 예를 봅니다.
- 지역 셸 변수 PATH를 전역으로 만들려면 다음을 입력합니다.
export PATH
- 내보낸 모든 변수를 나열하려면 다음을 입력합니다.
export
시스템은 다음과 비슷한 정보를 보여 줍니다.
DISPLAY=unix:0
EDITOR=vi
ENV=$HOME/.env
HISTFILE=/u/denise/.history
HISTSIZE=500
HOME=/u/denise
LANG=En_US
LOGNAME=denise
MAIL=/usr/mail/denise
MAILCHECK=0
MAILMSG=**YOU HAVE NEW MAIL.
USE THE mail COMMAND TO SEE YOUR MAILPATH=/usr/mail/denise?denise has mail !!!
MAILRECORD=/u/denise/.Outmail
PATH=/usr/ucb:/usr/lpp/X11/bin:/bin:/usr/bin:/etc:/u/denise:/u/denise/bin:/u/bin1
PWD=/u/denise
SHELL=/bin/ksh
기본 글꼴 바꾸기(chfont 명령)
시스템을 시작할 때의 기본 글꼴을 바꾸려면 chfont나 smit 명령을 씁니다. 글꼴 팔레트는 시스템이 쓸 수 있는 글꼴을 정의하고 식별하는 데 쓰는 파일입니다.
참고: chfont 명령을 실행하려면 root 권한이 있어야 합니다.
chfont 명령
chfont 명령 쓰는 예는 다음과 같습니다.
- 활성 글꼴을 글꼴 팔레트의 다섯째 글꼴로 바꾸려면 다음을 입력합니다.
chfont -a5
- 글꼴을 같은 크기의 이탤릭, 로만, 볼드체로 바꾸려면 다음을 입력합니다.
chfont -n /usr/lpp/fonts/It114.snf /usr/lpp/fonts/Bld14.snf /usr/lpp/fonts/Rom14.snf
전체 구문은 Commands Reference, Volume 1의 chfont 명령을 봅니다.
smit 명령
chfont 명령은 smit로도 실행할 수 있습니다.
활성 글꼴을 고르려면 다음을 입력합니다.
smit chfont
글꼴 팔레트를 고르려면 다음을 입력합니다.
smit chfontpl
제어 키 바꾸기(stty 명령)
터미널이 제어 키로 쓰는 키를 바꾸려면 stty 명령을 씁니다.
제어 키 변경은 로그아웃할 때까지 유효합니다. 영구적으로 하려면 .profile 파일에 넣습니다.
다음 예를 봅니다.
- Ctrl-Z를 인터럽트 키로 지정하려면 다음을 입력합니다.
stty intr ^Z
intr와 ^Z 사이에 공백을 꼭 넣습니다.
- 모든 제어 키를 기본값으로 되돌리려면 다음을 입력합니다.
stty sane
- 현재 설정을 보려면 다음을 입력합니다.
stty -a
전체 구문은 Commands Reference, Volume 5의 stty 명령을 봅니다.
시스템 프롬프트 바꾸기
시스템 프롬프트를 바꿀 수 있습니다.
셸은 다음 프롬프트 변수를 씁니다.
| 변수 | 쓰임 |
|---|---|
| PS1 | 일반 시스템 프롬프트로 쓰는 프롬프트 |
| PS2 | 셸이 입력을 더 기다릴 때 쓰는 프롬프트 |
| PS3 | root 권한이 있을 때 쓰는 프롬프트(원문 그대로) |
해당 셸 변수 값을 바꾸면 어떤 프롬프트 문자든 바꿀 수 있습니다. 프롬프트 변경은 로그아웃할 때까지 유효합니다. 영구적으로 하려면 .env 파일에 넣습니다.
다음 예를 봅니다.
- PS1 변수의 현재 값을 보려면 다음을 입력합니다.
echo "prompt is $PS1"
시스템은 다음과 비슷한 정보를 보여 줍니다.
prompt is $
- 프롬프트를
Ready>로 바꾸려면 다음을 입력합니다.
PS1="Ready> "
- 계속 프롬프트를
Enter more->로 바꾸려면 다음을 입력합니다.
PS2="Enter more->"
- root 프롬프트를
Root->로 바꾸려면 다음을 입력합니다.
PS3="Root-> "
영어 원문
User environment customization
The operating system provides various commands and initialization files that enable you to customize the behavior and the appearance of your user environment.
You can also customize some of the default resources of the applications you use on your system. Defaults are initiated by the program at startup. When you change the defaults, you must exit and then restart the program for the new defaults take effect.
For information about customizing the behavior and appearance of the Common Desktop Environment, see the Common Desktop Environment 1.0: Advanced User's and System Administrator's Guide.
System startup files
When you log in, the shell defines your user environment after reading the initialization files that you have set up. The characteristics of your user environment are defined by the values given to your environment variables. You maintain this environment until you log out of the system.
The shell uses two types of profile files when you log in to the operating system. It evaluates the commands contained in the files and then executes the commands to set up your system environment.
The files have similar functions, except that the /etc/profile file controls profile variables for all users on a system, whereas the .profile file allows you to customize your own environment.
The shell first runs the commands to set up your system environment in the /etc/environment file and then evaluates the commands contained in the /etc/profile file. After these files are run, the system then checks to see if you have a .profile file in your home directory. If the .profile file exists, the system runs this file. The .profile file will specify if an environment file also exists. If an environment file exists (usually named .env), the system then runs this file and sets up your environment variables.
The /etc/environment, /etc/profile, and .profile files are run once at login time. The .env file, on the other hand, is run every time you open a new shell or a window.
/etc/environment file:
The first file that the operating system uses at login time is the /etc/environment file. The /etc/environment file contains variables specifying the basic environment for all processes.
When a new process begins, the exec subroutine makes an array of strings available that have the form Name=Value. This array of strings is called the environment. Each name defined by one of the strings is called an environment variable or shell variable. The exec subroutine allows the entire environment to be set at one time.
When you log in, the system sets environment variables from the /etc/environment file before reading your login profile, named .profile. The following variables make up the basic environment:
- HOME — The full path name of the user's login or
HOMEdirectory. Theloginprogram sets this to the name specified in the/etc/passwdfile. - LANG — The locale name currently in effect. The LANG variable is initially set in the
/etc/profilefile at installation time. - NLSPATH — The full path name for message catalogs.
- LOCPATH — The full path name of the location of National Language Support tables.
- PATH — The sequence of directories that commands, such as sh, time, nice and nohup, search when looking for a command whose path name is incomplete.
- TZ — The time zone information. The TZ environment variable is initially set by the
/etc/profilefile, the system login profile.
For detailed information about the /etc/environment file, see the Files Reference.
/etc/profile file:
The second file that the operating system uses at login time is the /etc/profile file.
The /etc/profile file controls system-wide default variables, such as:
Export variables
File creation mask (umask)
Terminal types
Mail messages to indicate when new mail has arrived
The system administrator configures the /etc/profile file for all users on the system. Only the system administrator can change this file.
The following example is a typical /etc/profile file:
#Set file creation mask
umask 022
#Tell me when new mail arrives
MAIL=/usr/mail/$LOGNAME
#Add my /bin directory to the shell search sequence
PATH=/usr/bin:/usr/sbin:/etc::
#Set terminal type
TERM=lft
#Make some environment variables global
export MAIL PATH TERM
For detailed information about the /etc/profile file, see the Files Reference .
.profile file:
The .profile file is present in your home ($HOME) directory and lets you customize your individual working environment.
Because the .profile file is hidden, use the ls -a command to list it.
After the login program adds the LOGNAME (login name) and HOME (login directory) variables to the environment, the commands in the $HOME/.profile file are executed if the file is present. The .profile file contains your individual profile that overrides the variables set in the /etc/profile file. The .profile file is often used to set exported environment variables and terminal modes. You can customize your environment by modifying the .profile file. Use the .profile file to control the following defaults:
Shells to open
Prompt appearance
Keyboard sound
The following example is a typical .profile file:
PATH=/usr/bin:/etc:/home/bin1:/usr/lpp/tps4.0/user::
epath=/home/gsc/e3:
export PATH epath
csh
This example has defined two path variables (PATH and epath), exported them, and opened a C shell (csh).
You can also use the .profile file (or if it is not present, the /etc/profile file) to determine login shell variables. You can also customize other shell environments. For example, use the .cshrc file and .kshrc file to customize a C shell and a Korn shell, respectively, when each type of shell is started.
.env file:
A fourth file that the operating system uses at login time is the .env file, if your .profile contains the following line: export ENV=$HOME/.env
The .env file lets you customize your individual working environment variables. Because the .env file is hidden, use the ls -a command to list it. For more information about the ls command, see ls. The .env file contains the individual user environment variables that override the variables set in the /etc/environment file. You can customize your environment variables as desired by modifying your .env file.
The following example is a typical .env file:
(16줄짜리 예는 위 한글 본문에 그대로 실었습니다.)
Note: When modifying the .env file, ensure that newly created environment variables do not conflict with standard variables such as MAIL, PS1, PS2, and IFS.
AIXwindows startup files
Different computer systems have different ways of starting the X Server and AIXwindows.
Because different computer systems have different ways of starting the X Server and AIXwindows, consult with your system administrator to learn how to get started. Usually, the X Server and AIXwindows are started from a shell script that runs automatically when you log in. You might, however, find that you need to start the X Server or AIXwindows, or both.
If you log in and find that your display is functioning as a single terminal with no windows displayed, you can start the X Server by typing the following:
xinit
Note: Before entering this command, make sure that the pointer rests within a window that has a system prompt.
If this command does not start the X Server, check with your system administrator to ensure that your search path contains the X11 directory containing executable programs. The appropriate path might differ from one system to another.
If you log in and find one or more windows without frames, you can start AIXwindows Window Manager by typing the following:
mwm &
Because AIXwindows permits customization both by programmers writing AIXwindows applications and by users, you might find that mouse buttons or other functions do not operate as you might expect from reading this documentation. You can reset your AIXwindows environment to the default behavior by pressing and holding the following four keys:
Alt-Ctrl-Shift-!
You can return to the customized behavior by pressing this key sequence again. If your system does not permit this combination of keystrokes, you can also restore default behavior from the default root menu.
.xinitrc file:
The xinit command uses a customizable shell script file that lists the X Client programs to start. The .xinitrc file in your home directory controls the windows and applications that start when you start AIXwindows.
The xinit command works with shell scripts in the following order:
The xinit command first looks for the
$XINITRCenvironment variable to start AIXwindows.If the
$XINITRCenvironment variable is not found, the xinit command looks for the$HOME/.xinitrcshell script.If the
$HOME/.xinitrcshell script is not found, the xinit command starts the/usr/lib/X11/$LANG/ xinitrcshell script.If
/usr/lib/X11/$LANG/xinitrcis not found, it looks for the/usr/lpp/X11/defaults /$LANG/xinitrcshell script. If that script is not found, it searches for the/usr/lpp/X11/defaults/xinitrcshell script.The
xinitrcshell script starts commands, such as the mwm (AIXwindows Window Manager), aixterm, and xclock commands.
The xinit command performs the following operations:
Starts an X Server on the current display
Sets up the
$DISPLAYenvironment variableRuns the
xinitrcfile to start the X Client programs
The following example shows the part of the xinitrc file you can customize:
# This script is invoked by /usr/lpp/X11/bin/xinit
.
.
.
#***************************************************************
# Start the X clients. Change the following lines to *
# whatever command(s) you desire! *
# The default clients are an analog clock (xclock), an lft *
# terminal emulator (aixterm), and the Motif Window Manager *
# (mwm). *
#****************************************************************
exec mwm
.Xdefaults file:
If you work in an AIXwindows interface, you can customize this interface with the .Xdefaults file. AIXwindows allows you to specify your preferences for visual characteristics, such as colors and fonts.
Many aspects of Windows operating system based application's appearance and behavior are controlled by sets of variables called resources. The visual or behavioral aspect of a resource is determined by its assigned value. There are several different types of values for resources. For example, resources that control color can be assigned predefined values such as DarkSlateBlue or Black. Resources that specify dimensions are assigned numeric values. Some resources take Boolean values (True or False).
If you do not have a .Xdefaults file in your home directory, you can create one with any text editor. After you have this file in your home directory, you can set resource values in it as you wish. A sample default file called Xdefaults.tmpl is in the /usr/lpp/X11/defaults directory.
The following example shows part of a typical .Xdefaults file:
(38줄짜리 예는 위 한글 본문에 그대로 실었습니다.)
.mwmrc file:
Most of the features that you want to customize can be set with resources in your .Xdefaults file. However, key bindings, mouse button bindings, and menu definitions for your window manager are specified in the supplementary .mwmrc file, which is referenced by resources in the .Xdefaults file.
If you do not have a .mwmrc file in your home directory, you can copy it as follows:
cp /usr/lib/X11/system.mwmrc .mwmrc
Because the .mwmrc file overrides the system-wide effects of the system.mwmrc file, your specifications do not interfere with the specifications of other users.
The following example shows part of a typical system.mwmrc file:
(74줄짜리 예는 위 한글 본문에 그대로 실었습니다.)
Exporting shell variables (export shell command)
A local shell variable is a variable known only to the shell that created it. If you start a new shell, the old shell's variables are unknown to it. If you want the new shells that you open to use the variables from an old shell, export the variables to make them global.
You can use the export command to make local variables global. To make your local shell variables global automatically, export them in your .profile file.
Note: Variables can be exported down to child shells but not exported up to parent shells.
See the following examples:
- To make the local shell variable PATH global, type the following:
export PATH
- To list all your exported variables, type the following:
export
The system displays information similar to the following:
(16줄짜리 예는 위 한글 본문에 그대로 실었습니다.)
Changing the default font (chfont command)
To change the default font at system startup, use the chfont or smit command. A font palette is a file that the system uses to define and identify the fonts it has available.
Note: To run the chfont command, you must have root authority.
chfont command
See the following examples on how to use the chfont command:
- To change the active font to the fifth font in the font palette, type the following:
chfont -a5
- To change the font to an italic, roman, and bold face of the same size, type the following:
chfont -n /usr/lpp/fonts/It114.snf /usr/lpp/fonts/Bld14.snf /usr/lpp/fonts/Rom14.snf
See the chfont command in the Commands Reference, Volume 1 for the complete syntax.
smit command
The chfont command can also be run using smit.
To select the active font, type the following:
smit chfont
To select the font palette, type the following:
smit chfontpl
Changing control keys (stty command)
To change the keys that your terminal uses for control keys, use the stty command.
Your changes to control keys remain in effect until you log out. To make your changes permanent, place them in your .profile file.
See the following examples:
- To assign Ctrl-Z as the interrupt key, type the following:
stty intr ^Z
Be sure to place a space character between intr and ^Z.
- To reset all control keys to their default values, type the following:
stty sane
- To display your current settings, type the following:
stty -a
See the stty command in the Commands Reference, Volume 5 for the complete syntax.
Changing your system prompt
You can change your system prompt.
Your shell uses the following prompt variables:
- PS1 — Prompt used as the normal system prompt
- PS2 — Prompt used when the shell expects more input
- PS3 — Prompt used when you have root authority
You can change any of your prompt characters by changing the value of its shell variable. Your prompt changes remain in effect until you log out. To make your changes permanent, place them in your .env file.
See the following examples:
- To display the current value of the PS1 variable, type the following:
echo "prompt is $PS1"
The system displays information similar to the following:
prompt is $
- To change your prompt to
Ready>, type the following:
PS1="Ready> "
- To change your continuation prompt to
Enter more->, type the following:
PS2="Enter more->"
- To change your root prompt to
Root->, type the following:
PS3="Root-> "