You are on page 1of 90

IN-222-C1 AIX

 vi Shell

 AIX

 AIX

 AIX

1 AIX .......................................................................................................................................... 1
1.1 UNIX AIX ................................................................................................................. 1
1.2 AIX ................................................................................................................................. 1

2 AIX ...................................................................................................................... 5
2.1 ................................................................................................................................ 5
2.2 ................................................................................................................................ 7
2.3 ............................................................................................................................................ 8

3 AIX .................................................................................................................................. 9
3.1 date........................................................................................................... 9
3.2 cal..................................................................................................................................... 9
3.3 id id ................................................................................................... 10
3.4 who ................................................................... 10
3.5 finger...................................................................................................................... 10
3.6 mail ................................................................................................ 10
3.7 clear .......................................................................................... 12
3.8 echo................................................................................................................ 12
3.9 banner..................................................................................... 12
3.10 wc................................................................................. 12
3.11 ............................................................................................................................................ 12
3.12 grep ................................................................................................... 13
3.13 head & tail.................................................................................... 13
3.14 cut ...................................................................................................................... 13
3.15 sort ................................................................................................................................... 14
3.16 xlock: ............................................................................................................................... 14
3.17 lsdev -C |grep ent ............................................................................................................................. 14
3.18 lscfg -v |more : ......................................................................................... 14
3.19 lsattr -El ent0: .................................................................................................................................. 14
3.20 lslpp -l bos.net.tcp* : tcp ......................................................................... 14

i
3.21 ifconfig en1 service-IP alias ..........................................................................................................14
3.22 type command ..................................................................................................................................14
3.23 df k .................................................................................................................................................15
3.24 mount................................................................................................................................................15
3.25 uname a ..........................................................................................................................................15
3.26 hostname...........................................................................................................................................15
3.27 lspv ...................................................................................................................................................15
3.28 lsvg vgname......................................................................................................................................15
3.29 instfix i |grpe ML............................................................................................................................15
3.30 netstat -rn ....................................................................................................15
3.31 ps ef : ..............................................................................................................................................15

4 .............................................................................................................................17
4.1 ...........................................................................................................................................17
4.2 ...............................................................................................................................17
4.3 ...........................................................................................................................................17
4.4 ...........................................................................................................................................18
4.5 ...................................................................................................................19
4.5.1 ls -l .....................................................................19
4.5.2 .............................................................................................................20
4.5.3 .................................................................................................21
4.5.4 .....................................................................................................21

5 vi .........................................................................................................................................23
5.1 vi...............................................................................................................................................23
5.2 vi ................................................................................................................................23
5.3 vi...............................................................................................................................................23
5.3.1 .................................................................................................................................23
5.3.2 .................................................................................................................................24
5.3.3 .........................................................................................................................................24
5.3.4 .................................................................................................................................24
5.3.5 .................................................................................................................................24
5.3.6 .................................................................................................................................25

ii
5.3.7 vi ....................................................................................................................... 25
5.4 vi ............................................................................................................................. 25
5.4.1 vi ............................................................................................................... 25
5.4.2 $HOME/.exrc ......................................................................................... 25
5.5 vi ................................................................................................................. 25

6 SHELL .................................................................................................................................. 27
6.1 .............................................................................................................................................. 27
6.1.1 * ................................................................................................................. 27
6.1.2 ? .................................................................................................................. 27
6.1.3 [ ] [ ] .................................................................................................... 27
6.1.4 [ - ] [ - ] ........................................................................................... 28
6.1.5 ! ........................................................................................................ 28
6.2 .................................................................................................................................. 28
6.3 .............................................................................................................................................. 28
6.4 .................................................................................................................................................. 30
6.5 .......................................................................................................................................... 30
6.6 .......................................................................................................................................... 31
6.7 .............................................................................................................................................. 31
6.8 Shell .......................................................................................................................... 32
6.9 .......................................................................................................................... 32
6.9.1 ............................................................................................................ 32
6.9.2 ............................................................................................................................ 33
6.9.3 ................................................................................................................................ 33
6.9.4 ................................................................................................................................ 33
6.9.5 ............................................................................................................................ 34

7 .................................................................................................................................... 35
7.1 Shell .............................................................................................................. 35
7.1.1 /etc/profile................................................................................................................................ 35
7.1.2 /etc/enviroment ........................................................................................................................ 35
7.1.3 $HOME/.profile....................................................................................................................... 35

iii
7.2 ...............................................................................................................35
7.2.1 .........................................................................................................................35
7.2.2 .....................................................................................................................................35
7.3 ...............................................................................................................................35
7.4 .......................................................................................................................................36
7.5 ...........................................................................................................................................36

8 .........................................................................................................................................37
8.1 ...................................................................................................................................37
8.2 /etc/passwd ................................................................................................................................38
8.3 /etc/environment ........................................................................................................................38
8.4 .......................................................................................................................39
8.5 ...........................................................................................................................39
8.6 Shell......................................................................................................................40
8.7 SHELL ........................................................................................................................40

9 .........................................................................................................................................43
9.1 ...................................................................................................................................43
9.2 .......................................................................................................................................45
9.3 .......................................................................................................................47
9.4 SMIT .........................................................................................................................48
9.5 ODM ..........................................................................................................................50
9.6 ...........................................................................................................................................51

10
...........................................................................................................................53
10.1 .........................................................................................................................................53
10.2 .....................................................................................................................................54
10.3 .....................................................................................................................................54
10.4 .........................................................................................................................................55
10.5 .....................................................................................................................................57
10.6 .................................................................................................................................59
10.7 .................................................................................................................................60
10.8 .................................................................................................................................................61

iv
11 .......................................................................................................................................
63
11.1 .................................................................................................................................... 63
11.2 ............................................................................................................................ 63
11.3 ........................................................................................................................................ 63
11.4 .................................................................................................................... 63
11.5 ........................................................................................................................ 64
11.6 ........................................................................................................................................ 64
11.7 .................................................................................................................................... 65
11.8 shell ................................................................................................................. 65
11.9 deamons ................................................................................................................. 65
11.10 / ..................................................................................................................... 65
11.11 ............................................................................................................................... 65
11.12 .......................................................................................................................... 66
11.13 ...................................................................................................................................... 66
11.14 ...................................................................................................................................... 66
11.15 .......................................................................................................................... 67

12 TCP/IP ......................................................................................................................................... 69
12.1 IP ................................................................................................................... 69
12.2 ........................................................................................................................................ 70
12.2.1 .......................................................................................................................... 70
12.2.2 .............................................................................................................................. 71
12.2.3 .......................................................................................................................... 71
12.3 ........................................................................................................................................ 72
12.3.1 .................................................................................................................. 72
12.3.2 ...................................................................................................................... 73
12.4 ........................................................................................................................ 73
12.4.1 /etc/hosts ................................................................................................................... 73
12.4.2 /etc/inetd.conf ............................................................................................................... 73
12.4.3 /etc/services................................................................................................................... 74
12.4.4 /etc/hosts.equiv ............................................................................................................. 74

v
12.4.5 /etc/ftpusers ...................................................................................................................75

13 ...................................................................................................................................77
13.1 .................................................................................................................................................77
13.1.1 ...........................................................................................................................77
13.1.2 SMIT ...............................................................................................................79
13.2 .................................................................................................................................................79
13.3 .........................................................................................................................................80

vi
1
AIX


AIX

AI

AIX IBM UNIX IBM RISC System/6000


UNIX

AIX Advanced Interactive EXecutive

1.1 UNIX AIX


60 UNIX Bell Labs

1980 Berkeley UNIX

IBM 1985 UNIX

1986 IBM AIX RT6150

1990 IBM RISC System/6000 AIX Ver.3

1994 IBM AIX Ver. 4.1

AIX4.3 32 64 64
RS/6000 AIX

AIX 5.1

1.2 AIX
Kernel()

(Shell)
Kernel C

1
IN-222-C1 AIX

1.2-1 AIX

File system()

AIX
()

1 /bin

2 /etc

3 /dev

4 /home

5 /tmp

6 /usr

7 /var

Shell()

Shell AIX AIX Shell KornBourneC


Korn ShellShell

Communications/Networking(/)

AIX BMPX channelESCONHIPPIATM


ISDNX.25SDLCFDDIToken-RingEthernet3270 Coax5250 Twinax
5080/6090Async

Text processing()

2
1 AIX

AIX VI
CDE( UNIX )

Programming Languages()

Shell AIX
CC++FORTRANPascal

System management()

AIX

On-line documentation(())

AIX () Manual Pages


commands()subroutines()files()
infoExplorer (AIX Ver. 4.3 ) Web-base (AIX Ver. 4.3 )
Booktaskcommand Manual Pages

AIX Windows environmant()

AIX Windows AIXwindows AIX Common Desktop Environment

Other utilities()

AIX DOS

Wide range of supported applications()

IBM IBM

3
2
AIX


AIX

AIX

RS/6000AIX normal(service)

2.1

Normal

POWER

1 (ROS IPL)

(POST),

/etc/rc.boot 1rc.boot ( ODM ) ,


( LVM )(rootvg)

/etc/rc.boot 2 ODM
2

/etc/init( pid ) 1

5
IN-222-C1 AIX

init /etc/inittab /etc/rc.boot 3


/tmp ODM
/etc/inittab TCP/IP NFS

/etc/inittab

init:2initdefault:

brc::sysinit:/sbin/rc.boot 3 >/dev/console 2>&1 # Phase 3 of system boot # 5

powerfail::powerfail:/etc/rc.powerfail 2>&1 | alog -tboot > /dev/console # Power


Failure Detection

rc:2:wait:/etc/rc 2>&1 | alog -tboot > /dev/console # Multi-User checks #


fbcheck:2:wait:/usr/sbin/fbcheck 2>&1 | alog -tboot > /dev/console # run /etc/firstboot

srcmstr:2:respawn:/usr/sbin/srcmstr # System Resource Controller # SRC

rctcpip:2:wait:/etc/rc.tcpip > /dev/console 2>&1 # Start TCP/IP daemons # tcpip

rcnfs:2:wait:/etc/rc.nfs > /dev/console 2>&1 # Start NFS Daemons # NFS

cron:2:respawn:/usr/sbin/cron

piobe:2:wait:/usr/lib/lpd/pio/etc/pioinit >/dev/null 2>&1 # pb cleanup

qdaemon:2:wait:/usr/bin/startsrc -sqdaemon

writesrv:2:wait:/usr/bin/startsrc -swritesrv

uprintfd:2:respawn:/usr/sbin/uprintfd

logsymp:2:once:/usr/lib/ras/logsymptom # for system dumps

infod:2:once:startsrc -s infod

diagd:2:once:/usr/lpp/diagnostics/bin/diagd >/dev/console 2>&1

dt:2:wait:/etc/rc.dt #

cons:0123456789:respawn:/usr/sbin/getty /dev/console # ASCII

/etc/inittab /etc/rc.dt lft


(CDE) xdm ASCII

6
2 AIX

5() LED
LED 3
c32 c33,
c32 (lfts ) c33 (ttys)

2.2
AIX SERVICE

Diagnostic Operating Instructions


Function Selection

FUNCTION SELECTION

ID ITEM

1. Diagnostic Routines

2. Service Aids

3. Advanced Diagnostics Routines

...

4. Initialize Terminal

99. Exit Diagnostics

To make a selection,type the number and press Enter. [4 ]

4 vt100
Function Selection

FUNCTION SELECTION

Move cursor to selection, then press Enter.

Diagnostic Routines
7
Service Aids

Advanced Diagnostics Routines

system Exerciser
IN-222-C1 AIX

Service Aids Service Aids Selection

AIX Shell Prompt root


cdrom
SERVICE

2.3
shutdown root

1 10

# shutdown +10

# shutdown - F

# halt

# shutdown now

4 1

# shutdown r

# shutdown - Fr

# reboot

6 AIX

# telinit S

# init s

# shutdown - m

8
3
AIX



AIX


3.1 date
1

$ date

Fri Jul 17 14:09:38 CDT 1998

$ date 0717142598

Fri Jul 17 14:25:56 CDT 1998

1970~2037


3.2 cal
1

$ cal 7 1998

July 1998

Sun Mon Tue Wed Thu Fri Sat

1 2 3 4

5 6 7 8 9 10 11

12 13 14 15 16 17 18

19 20 21 22 23 24 25

26 27 28 29 30 31

$ cal 1998

9
IN-222-C1 AIX

id
3.3 id

3.4 who
1

$ who

$ who am i

xumin pts/0 Aug 04 16:27 (Xumin)


3.5 finger
1

$ finger

$ finger username

$ finger xumin

Login name: xumin

Directory: /home/xumin Shell: /usr/bin/ksh

On since Aug 04 16:27:09 on pts/0, 1 minute 49 seconds Idle Time from Xumin

No Plan.


3.6 mail
1

$ mail

10
3 AIX

$ mail xumin

Subject: test

hi,

this is a test.

<ctrl-d>

Cc:

$ mail

Mail [5.2 UCB] [AIX 4.1] Type ? for help.

"/var/spool/mail/xumin": 1 message 1 unread

>U 1 xumin Tue Aug 4 16:32 12/312 "test"

?t

Message 1:

From xumin Tue Aug 4 16:32:42 1998

Date: Tue, 4 Aug 1998 16:32:42 -0500 (CDT)

From: xumin

To: xumin

Subject: test

hi,

this is a test.

?q

Saved 1 message in /home/xumin/mbox

11
IN-222-C1 AIX

3.7 clear


3.8 echo
$ echo Hello!

Hello!


3.9 banner
$ banner Hello!


3.10 wc
$ cat test.file

Hello!

This is a test file.

$ wc test.file

2 6 28 test.file

3.11
Shell

<ctrl-c> --

<ctrl-d> -- ()

<ctrl-s> --

<ctrl-q> --

<ctrl-u> --

find --

$ find path expression

expression

-name --

12
3 AIX

-type --

-size --

-mtime --

-perm --

-user --

-o --

$ find . -name sum -print

sum

$ find . -perm 644 -mtime +4 -print

6444

3.12 grep
$ grep [option] pattern [file1 file2 . . .]


3.13 head & tail
$ head filename

$ tail filename

3.14 cut
1

$ cut -f number(s) -d (character) filename

$ cut -c number(s) filename

13
IN-222-C1 AIX

3.15 sort


3.16 xlock:

3.17 lsdev -C |grep ent




3.18 lscfg -v |more :
lscfg -vl ent0 :

3.19 lsattr -El ent0:


ent0

1lsattr -El mem0: mem0

2lsattr -El hdisk0: hdisk0

3lsattr -El proc0: CPU proc0 CPU

tcp
3.20 lslpp -l bos.net.tcp* :
lslpp -l cluster* : cluster

3.21 ifconfig en1 service-IP alias


en1 IP service-IP

ifconfig en1 service-IP delete : en1 IP service-IP

3.22 type command


command

14
3 AIX

3.23 df k

3.24 mount

3.25 uname a
ID OS

3.26 hostname

3.27 lspv
ID

3.28 lsvg vgname


lsvg l vgname

3.29 instfix i |grpe ML


3.30 netstat -rn

3.31 ps ef :

15
4



4.1

/dev

4.2
255
#/@_


*?></;&![]$\+-
AIX

4.3
pwd

$ pwd

/home/xumin

cd

$ cd dir_name

17
IN-222-C1 AIX

mkdir

$ mkdir dir_name

rmdir

$ rmdir dir_name

ls

$ ls

4.4
cp

$ cp source target

mv

$ mv source target

ln

$ ln source target

$ ls -l

total 5

drwxr-xr-x 4 xumin staff 512 Jul 23 15:09 info

-rw------- 1 xumin staff 630 Aug 06 10:44 mbox

-rw-r--r-- 1 xumin staff 28 Aug 04 16:52 test.file

---x------ 1 xumin staff 3 Jul 31 16:49 testfile

$ ln -s test.file test1.file

$ ls -l

total 5

drwxr-xr-x 4 xumin staff 512 Jul 23 15:09 info

-rw------- 1 xumin staff 630 Aug 06 10:44 mbox

-rw-r--r-- 1 xumin staff 28 Aug 04 16:52 test.file

lrwxrwxrwx 1 xumin staff 9 Aug 11 13:31 test1.file -> test.file

18
4

---x------ 1 xumin staff 3 Jul 31 16:49 testfile

cat

$ cat file_name

cat

pg

$ pg file_name

pg

more

$ more file_name

more

rm

$ rm file_name

4.5

4.5.1 ls -l

$ ls -l

drwxr-xr-x 4 xumin staff 512 Jul 23 15:09 info

-rw------- 1 xumin staff 630 Aug 06 10:44 mbox

-rw-r--r-- 1 xumin staff 28 Aug 04 16:52 test.file

---x------ 1 xumin staff 3 Jul 31 16:49 testfile

rwx rwx rwx


19
IN-222-C1 AIX

r --

w --

x --

r --

w --

x --

4.5.2

chmod

$ chmod mode filename

mode

u --

g --

o --

a --

- --

+ --

= --

r --

w --

x --

$ ls -l test.file

20
4

-rw-r--r-- 1 xumin staff 28 Aug 04 16:52 test.file

$ chmod o+x test.file

$ ls -l test.file

-rw-r--r-x 1 xumin staff 28 Aug 04 16:52 test.file

4.5.3

chmod

$ chmod mode filename

mode

user group other

r w x r w x r w x

400 40 4

200 20 2

100 10 1

rw-rw-r-- 664 (400+200+40+20+4)

chmod chmod 664 filename

$ ls -l test.file

-rw-r--r-x 1 xumin staff 28 Aug 04 16:52 test.file

$ chmod 664 test.file

$ ls -l test.file

-rw-rw-r-- 1 xumin staff 28 Aug 04 16:52 test.file

4.5.4

umask

$ umask mode

mode

mode

21
IN-222-C1 AIX

666-mode

777-mode

$ umask 000

$ mkdir newdir

$ ls -l

total 7

drwxr-xr-x 4 xumin staff 512 Jul 23 15:09 info

-rw------- 1 xumin staff 630 Aug 06 10:44 mbox

drwxrwxrwx 2 xumin staff 512 Aug 11 14:27 newdir

-rw-rw-rw- 1 xumin staff 21 Aug 11 14:16 newtest.file

-rw-rw-r-- 1 xumin staff 28 Aug 04 16:52 test.file

lrwxrwxrwx 1 xumin staff 9 Aug 11 13:31 test1.file -> test.file

---x------ 1 xumin staff 3 Jul 31 16:49 testfile

$ rmdir newdir

$ umask 222

$ mkdir newdir

$ ls -l

total 7

drwxr-xr-x 4 xumin staff 512 Jul 23 15:09 info

-rw------- 1 xumin staff 630 Aug 06 10:44 mbox

dr-xr-xr-x 2 xumin staff 512 Aug 11 15:27 newdir

-rw-rw-rw- 1 xumin staff 21 Aug 11 14:16 newtest.file

-rw-rw-r-- 1 xumin staff 28 Aug 04 16:52 test.file

lrwxrwxrwx 1 xumin staff 9 Aug 11 13:31 test1.file -> test.file

---x------ 1 xumin staff 3 Jul 31 16:49 testfile

22
5
vi


vi

vi

5.1 vi
$ vi file_name

5.2 vi
vi

vi vi

vi

5.3 vi

5.3.1

1a

2A

3i

4I

5o

6O

23
IN-222-C1 AIX


Esc

5.3.2

1X

2dw

3d$

4d0

5dd

6:20,40d 20 40

5.3.3

1/text

2?text

5.3.4

1r

2R Esc

3s Esc

4S Esc

5.3.5

vi

1yy

2dd

3p

4P

24
5 vi

5.3.6

5.3.7 vi

1:q vi

2:q! vi()

5.4 vi
vi vi $HOME/.exrc

5.4.1 vi

:set all

:set autoindent/noautoindent

:set number/nonumber

:set list/nolist

:set showmode/noshowmode

:set tabstop=x

:set ignorecase/noignorecase

:set wrapmargin=5

vi vi

5.4.2 $HOME/.exrc

.exrc set

vi .exrc vi
.exrc

5.5 vi
vi

25
IN-222-C1 AIX

$ set -o vi

Esc vi

k --

j --

h --

l --

26
6
SHELL


Shell

Shell
Shell
Shell

6.1

6.1.1 *

$ ls

info newdir test.file testfile

mbox newtest.file test1.file wangyi

$ ls *.*

newtest.file test.file test1.file

6.1.2 ?

$ ls ????.*

test.file

6.1.3 [ ] [ ]

$ ls [mt]*

mbox test.file test1.file testfile

27
IN-222-C1 AIX

6.1.4 [ - ] [ - ]

$ ls [m-w]*

mbox newtest.file test.file test1.file testfile

newdir:

wangyi:

6.1.5 !

$ ls [!t]*

mbox newtest.file

info:

notes tmp

newdir:

wangyi:

test.file

6.2
AIX

< (<<) 0

> (>>) 1

2> (2>>) 2

6.3
AIX
()
()

$ command < filename

28
6 SHELL

$ mail xumin < test.file

$ command > filename

$ ls > out.file

$ cat out.file

info

mbox

newdir

newtest.file

out.file

test.file

test1.file

testfile

wangyi

$ command 2> filename

$ ls test2.file 2> error.out

$ cat error.out

ls: 0653-341 The file test2.file does not exist.

$ command < infile > outfile 2> errfile

$ command > outfile 2> errfile < infile

$ ls test1.file test2.file > out.file 2> error.file

$ cat out.file

test1.file

29
IN-222-C1 AIX

$ cat error.file

ls: 0653-341 The file test2.file does not exist.

$ command > outfile 2> &1

&1 out.file out.file

$ command 2> &1 > outfile

&1

6.4

$ command1 | command2

$ ls | wc -w

11

6.5
tee

tee

$ command1 | tee filename | command2

$ ls | tee out.file | wc

11 11 97

$ cat out.file

error.file

error.out

info

mbox

newdir

30
6 SHELL

newtest.file

out.file

test.file

test1.file

testfile

wangyi

6.6
AIX shell

$ command1 ; command2 ; command3

$ pwd;cd /;ls

/home/xumin

Slider.class dead.letter lost+found smit.script usr

TT_DB dev lpp testnfs var

aaaa etc mnt testxmg websm.log

adsmtest home opt testxmg2 xumin

bin info sbin tftpboot xumin_disk1

cdrom info.www share tmp

cds.types informix showcase u

core lib smit.log unix

6.7
AIX shell \ shell
>

31
IN-222-C1 AIX

6.8 Shell
shell shell

HOME -- home

TERM --

PATH --

6.9

6.9.1

$ set

~~~

~~~

HOME=/home/xumin

LANG=En_US

LOCPATH=/usr/lib/nls/loc

LOGIN=xumin

LOGNAME=xumin

MAIL=/usr/spool/mail/xumin

MAILCHECK=600

MAILMSG='[YOU HAVE NEW MAIL]'

~~~

~~~

PATH=/usr/bin:/etc:/usr/sbin:/usr/ucb:/home/xumin/bin:/usr/bin/X11:/sbin:.

PPID=69504nput

PS1='$ '

PS2='> '

32
6 SHELL

PS3='#? '

PS4='+ '

PWD=/

RANDOM=31884

SECONDS=2774

SHELL=/usr/bin/ksh

TERM=ANSI

TERM_DEFAULT=lft

TMOUT=0

TZ=CST6CDT

USER=xumin

6.9.2

$ echo $name

$ echo $HOME

/home/xumin

6.9.3

$ name=value

$ echo $xxx

$ xxx=hello!

$ echo $xxx

hello!

6.9.4

$ unset

$ unset xxx

33
IN-222-C1 AIX

$ echo $xxx

6.9.5

' ' ' '

$ now=`date`

$ echo $now

Wed Aug 12 15:23:19 CDT 1998

' ' : ' '

$ echo '$HOME'

$HOME

$ ` ` \

$ echo now is `date`

now is Wed Aug 12 15:32:41 CDT 1998

\ \

$ echo \$HOME

$HOME

34
7



Kshell

7.1 Shell

7.1.1 /etc/profile
profile

7.1.2 /etc/enviroment
profile /etc/profile

7.1.3 $HOME/.profile
profile profile

7.2

7.2.1

7.2.2

7.3
TERM

PATH

35
IN-222-C1 AIX

LANG

PS1

ENV ksh

7.4
alias

$ alias aliasname =string

unalias

$ unalias aliasname

7.5
ksh
$HOME/.sh_history 128

history 16

$ history

36
8


(
)
/etc/passwd /etc/security/passwd


SYSTEM SYSTEM



STAFFSECURITY

8.1

mkuser

passwd

chuser

lsuser

rmuser

login

chfn
Finger

chsh Shell

who

37
IN-222-C1 AIX

8.2 /etc/passwd
/etc/passwd
ASCII
mkuser
/etc/passwd

/etc/passwd

Name:Password: UserID:PrincipleGroup:Gecos: HomeDirectory:Shell

Password (*)(!)
/etc/security/passwd (!) password
(*)

Shell login su shellKorn shell


AIX shell Bourne shell
/usr/bin/sh(Bourne shell) Bourne shell Korn shell

mkuser password (*)


passwd pwdadm (!)
/etc/passwd /etc/security/passwd

8.3 /etc/environment
/etc/environment
exec Name=Value
Name shell
.profile environment

Login /etc/passwd
HOME

/etc/environment
LANG

PATH
PATH
PATH

TZ /etc/environment
TZ

38
8

8.4
passwd /etc/security/passwd passwd
/etc/passwd Password (*)(!)

passwd

passwd

8.5
who
whoami who am I
who
(shell)

who

# who

root pts/0 Nov 17 10:20 (sv1166a.itsc.aus)

root pts/2 Nov 23 10:45 (sv1121c.itsc.aus)

root pts/3 Nov 23 10:48 (sv1121c)

# who am I

root pts/3 Nov 23 10:48 (sv1121c)

# who -r

. run-level 2 Nov 17 10:19 2 0 S

4 init

39
IN-222-C1 AIX

# who -p

rc . Nov 17 10:19 4:12 2896 id=rc

fbcheck . Nov 17 10:19 4:12 2898 id=fbcheck

srcmstr . Nov 17 10:19 4:12 2900 id=srcmstr

rctcpip . Nov 17 10:19 4:12 4648 id=rctcpip

rcnfs . Nov 17 10:19 4:12 4650 id=rcnfs

cron . Nov 17 10:19 4:12 4652 id=cron

piobe . Nov 17 10:19 4:12 4984 id=piobe

qdaemon . Nov 17 10:19 4:12 4986 id=qdaemon

writesrv . Nov 17 10:19 4:12 4988 id=writesr

uprintfd . Nov 17 10:19 4:12 4990 id=uprintf

pmd . Nov 17 10:19 4:12 8772 id=pmd

dt . Nov 17 10:19 4:12 9034 id=dt

id

8.6 Shell
chsh shell
/etc/passwd chsh
shell

chsh shell shell


shell shell chuser
, shell

8.7 SHELL
shell

PS1

PS2 shell

PS3 select

40
8

shell .env

PS1

# echo "prompt is $PS1":

prompt is $

Ready>

export PS1="Ready> "

Enter more->

export PS2="Enter more->"

select Root->

export PS3="Root->

41
9



9.1
AIX

,
adapter

/
, / sio
mca

, , sio
8fba SCSI I/O ) fda_2 I/O ), ient_6
) mca sio_2 I/O )

# lsdev -C -F "class subclass type description" | sort

adapter buc 4006 GXT150L Graphics Adapter

adapter mca sio_2 Standard I/O Planar

adapter sio 8fba Standard SCSI I/O Controller

adapter sio fda_2 Standard I/O Diskette Adapter

adapter sio ient_6 Integrated Ethernet Adapter

adapter sio keyboard_2 Keyboard Adapter

adapter sio mouse Mouse Adapter

adapter sio ppa Standard I/O Parallel Port Adapter

adapter sio s1a Standard I/O Serial Port 1

adapter sio s2a Standard I/O Serial Port 2


43
IN-222-C1 AIX

adapter sio tablet_2 Tablet Adapter

aio node aio Asynchronous I/O

bus sys mca Microchannel Bus

cdrom scsi scsd SCSI Multimedia CD-ROM Drive

disk scsi 2000mb 2.0 GB SCSI Disk Drive

diskette siofd fd Diskette Drive

if EN en Standard Ethernet Network Interface

if EN ie3 IEEE 802.3 Ethernet Network Interface

if LO lo Loopback Network Interface

ioplanar sys ioplanar_2 I/O Planar

keyboard std_k kb101 United States keyboard

lft node lft Low Function Terminal Subsystem

logical_volume lvsubclass lvtype Logical volume

logical_volume lvsubclass lvtype Logical volume

logical_volume lvsubclass lvtype Logical volume

logical_volume lvsubclass lvtype Logical volume

logical_volume lvsubclass lvtype Logical volume

logical_volume lvsubclass lvtype Logical volume

logical_volume lvsubclass lvtype Logical volume

logical_volume lvsubclass lvtype Logical volume

logical_volume vgsubclass vgtype Volume group

lvm lvm lvdd LVM Device Driver

memory sys simm 32 MB Memory SIMM

memory sys simm 32 MB Memory SIMM

memory sys simm 32 MB Memory SIMM

memory sys simm 32 MB Memory SIMM

44
9

mouse std_m mse_3b 3 button mouse

planar sys sysplanar3 System Planar

processor sys proc1 Processor

pty pty pty Asynchronous Pseudo-Terminal

rcm node rcm Rendering Context Manager Subsystem

sys node sys1 System Object

sysunit sys sysunit System Unit

tape scsi 8mm5gb 5.0 GB 8mm Tape Drive

tcpip TCPIP inet Internet Network Extension

8mm5gb SCSI
AIX ODM

9.2
ODMObject Database Management
ODM
predefined customized
(predefined) AIX
(customized)

C
/etc/objrepos ODMDIR
/etc/objrepos/CuDv
odmshow

# odmshow CuDv

class CuDv {

char name[16];

short status;

short chgstatus;

45
IN-222-C1 AIX

char ddins[16];

char location[16];

char parent[16];

char connwhere[16];

link PdDv PdDv uniquetype PdDvLn[48];

};

CuDv CuDv
00-00-0S-00 SCSI
location


CuDv

# odmget CuDv

CuDv:

name = "hdisk0"

status = "1"

chgstatus = "2"

ddins = "scdisk"

location = "00-00-0S-00"

parent = "scsi0"

connwhere = "00"

PdDvLn = "disk/scsi/1000mb"

CuDv
disk scsi 1000mb

46
9

9.3


ODM mkdevrmdev
lsdevlsattr chdev AIX
ODMcfgmgr SMIT

cfgmgr
Config_Rules

odmget Config_Rules

5GB 8mm SCSI

cfgmgr

# lsdev -C -c tape

rmt0 Available 00-00-0S-1,0 5.0 GB 8mm Tape Drive

availableundefineddefined
available undefined cfgmgr
defined
available cfgmgr

cfgmgr
cfgmgr
cfgmgr defined
cfgmgr

47
IN-222-C1 AIX

9.4
SMIT

SMIT smit device

Devices

Move cursor to desired item and press Enter.

Install/Configure Devices Added After IPL

Printer/Plotter

TTY

Asynchronous Adapters

PTY

Console

Fixed Disk

Disk Array

Enter 8mm
Tape Drive

Tape Drive

Move cursor to desired item and press Enter.

List All Defined Tape Drives

List All Supported Tape Drives

Add a Tape Drive

Change / Show Characteristics of a Tape Drive

Remove a Tape Drive

Configure a Defined Tape Drive

Generate Error Report

Trace a Tape Drive

48
9

Add a Tape Drive

Tape Drive Type

Move cursor to desired item and press Enter.

1200mb-c scsi 1.2 GB 1/4-Inch Tape Drive

150mb scsi 150 MB 1/4-Inch Tape Drive

3490e scsi 3490E Autoloading Tape Drive

4mm2gb scsi 2.0 GB 4mm Tape Drive

IBM SCSI ost


scsi Other SCSI Tape Drive SCSI 8mm5gb scsi
5.0 GB 8mm Tape Drive

Parent Adapter

Move cursor to desired item and press Enter.

scsi0 Available 00-00-0S Standard SCSI I/O Controller

scsi0 Available 00-00-0S Standard SCSI I/O Controller

Add a Tape Drive

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[Entry Fields]

Tape Drive type 8mm5gb

Tape Drive interface scsi

Description 5.0 GB 8mm Tape Drive

Parent adapter scsi0

* CONNECTION address [] +

49
IN-222-C1 AIX

BLOCK size (0=variable length) [1024] +#

Use DEVICE BUFFERS during writes yes +

Use EXTENDED file marks no +

DENSITY setting #1 140 +

DENSITY setting #2 20 +

Use data COMPRESSION yes +

CONNECTION address SCSI


SMIT cfgmgr

SCSI ID 6
CONNECTION
address 6,0 Enter SMIT mkdev

9.5 ODM
IBM

# lsdev -P | grep -i other

printer osp rs232 Other serial printer

printer osp rs422 Other serial printer

printer opp parallel Other parallel printer

tape ost scsi Other SCSI Tape Drive

cdrom oscd scsi Other SCSI CD-ROM Drive

cdrom scsd scsi Other SCSI CD-ROM Drive

disk osdisk scsi Other SCSI Disk Drive

disk scsd scsi Other SCSI Disk Drive

rwoptical osomd scsi Other SCSI Read/Write Optical

rwoptical scsd scsi Other SCSI Read/Write Optical

50
9

SMIT
cfgmgr


Kernel Extensions and Device Programming Concepts

9.6
cfgmgr
defined defined
rmdev rmdev

# rmdev -l Name

Name lsdev C
8mm

# rmdev -l rmt0

rmt0
defined

# rmdev -d -l rmt0

SMIT smit device


51
10



10.1

/dev
/etc /etc
/usr/bin
/export
/home /u
/lost+found fsck
/mnt
/sbin /usr AIX
/sbin
/tmp
/usr /usr
ASCII
/usr
/usr/bin /bin
/usr/include
/usr/lib /lib
/usr/sbin
/usr/share
/usr/share/dict Spell /usr/dict
/usr/share/man /usr/man
/var
/var/adm /usr/adm
/var/preserve vi /usr/preserve
/var/spool /usr/spool
/var/tmp /usr /usr/tmp
/tftpboot
/usr/lpp
/var/spool/mail /usr/mail
/usr/lib/lpd AIX /usr/lpd

53
IN-222-C1 AIX

10.2
AIX LVM
LVM UNIX
LVM
PV
VG
PP
LVLP

10.3


32 AIX4.3.2 128

4MB

4MB
64 256MB

AIX UNIX JFS



AIX i

fsck

JFS Unix HFS


54
10

JFS 4K BSD 512


JFS LZ

10.4
RS/6000


hdisk<x>x
hdisk0 hdisk1
LVM SMIT chdev

SMIT smit makdsk

Disk Type

Move cursor to desired item and press Enter.

[TOP]

1000mb scsi 1.0 GB SCSI Disk Drive

1000mb16bit scsi 1.0 GB SCSI Disk Drive

1000mb16bitde scsi 1.0 GB 16 Bit Differential SCSI Disk Drive

1000mbde scsi 1.0 GB Differential SCSI Disk Drive

1100mb scsi 1.1 GB SCSI Disk Drive

.......

IBM SCSI
Disk Type osdisk Parent
Adapter Add a Disk CONNECTION
address SCSI

Add a Disk

Type or select values in entry fields.

55
IN-222-C1 AIX

Press Enter AFTER making all desired changes.

[Entry Fields]

Disk type osdisk

Disk interface scsi

Description Other SCSI Disk Drive

Parent adapter scsi0

SCSI 0SCSI
4 4,0 ASSIGN physical volume identifier
yes Enter PV
PVID

PV VG
LVM

rootvgrootvg
rootvg


rootvg hdisk1 rootvg
SMITsmit extendvg extendvg

# extendvg -f rootvg hdisk1

hdisk1 datavg SMITsmit


mkvg mkvg

# mkvg -f -y datavg hdisk1

varyonvg

# varyonvg datavg

hdisk1 datavg lsvg

# lsvg

rootvg

56
10

datavg

lspv

# lspv

hdisk0 0004038485e2483a rootvg

hdisk1 000013403f203af5 datavg

16 PVID

datavg

10.5
LV LV
LVM

mklv SMIT
smit
mklv rootvg datavg

Add a Logical Volume

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[TOP] [Entry Fields]

Logical volume NAME []

* VOLUME GROUP name rootvg

* Number of LOGICAL PARTITIONS []


#

PHYSICAL VOLUME names [] +

Logical volume TYPE []

57
IN-222-C1 AIX

POSITION on physical volume middle +

RANGE of physical volumes minimum +

MAXIMUM NUMBER of PHYSICAL VOLUMES [] #

to use for allocation

Number of COPIES of each logical 1 +

partition

Mirror Write Consistency? yes +

Allocate each logical partition copy yes +

Mirror Write Consistency? yes +

Allocate each logical partition copy yes +

on a SEPARATE physical volume?

RELOCATE the logical volume during yes +

reorganization?

Logical volume LABEL []

MAXIMUM NUMBER of LOGICAL PARTITIONS [128]

Enable BAD BLOCK relocation? yes +

SCHEDULING POLICY for writing logical parallel +

partition copies

Enable WRITE VERIFY? no +

File containing ALLOCATION MAP []

Stripe Size? [Not Striped] +

SMIT * VOLUME GROUP


4MB
128 512MB
lv01
data

58
10

10.6
crfs smit crfs
SMIT

Add a File System

Move cursor to desired item and press Enter.

Add a Journaled File System

Add a Journaled File System on a Previously Defined Logical Volume

Add a CD-ROM File System

Add a Journaled File System on a


Previously Defined Logical Volume

Add a Journaled File System on a Previously Defined Logical Volume

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[Entry Fields]

* LOGICAL VOLUME name +

* MOUNT POINT []

Mount AUTOMATICALLY at system restart? no +

PERMISSIONS read/write +

Mount OPTIONS [] +

Start Disk Accounting? no +

Fragment Size (bytes) 4096 +

Number of bytes per inode 4096 +

Compression algorithm no +

LOGICAL VOLUME MOUNT POINT


Mount AUTOMATICALLY at system restart

59
IN-222-C1 AIX

yes
data
/usr/local/data
/usr/local/data



mount

# mount /usr/local/data

data /usr/local/data AIX


/usr/local/data
/etc/filesystems

/usr/local/data:

dev = /dev/data

vfs = jfs

log = /dev/hd8

mount = true

check = true

options = rw

account = false

mount /etc/filesystems /usr/local/data


dev /dev/data
/usr/local/data

10.7
paging

1 SMIT

# smit mkps

60
10

2 rootvg

VOLUME GROUP name

Move cursor to desired item and press Enter.

rootvg

Add Another Paging Space

type or select values in entry fields.

Press Enter AFTER making all desired changes.

[Entry Fields]

Volume group name rootvg

SIZE of paging space (in logical partitions) [] #

PHYSICALvolumename +

Start using this paging space NOW? no +

Use this paging space each time the system is no +

RESTARTED?

4MB
yes

smit chps smit rmps


smit mkps

10.8

61
IN-222-C1 AIX

5
AIX

6 mount

SMIT
SMIT

62
11



11.1
AIX

11.2

11.3
ps

ps UID( ID)PID( ID)PPID(


ID)C(cpu )STIME()TTY()TIME()
CMD()

$ ps -f

UID PID PPID C STIME TTY TIME CMD

Xumin 15044 26436 0 17:17:15 pts/1 0:00 -ksh

Xumin 27412 15044 6 17:18:04 pts/1 0:00 ps -f

11.4


63
IN-222-C1 AIX

$ command

$ command &

11.5
nice nice

$ nice [-lncrement | -n lncrement]

renice nice

11.6

(1) ctrl-c

(2) kill

kill

kill

$ kill [ -Signalnumber | -Signalname ] Processes

$ kill ProcessesID

$ kill -9 ProcessesID

ProcessesID ps

64
11

11.7
nohup nohup
nohup.out

$ nohup command &

$ nohup ls -R /&

11.8 shell
<ctrl-z>

jobs

fg

bg

bg fg kill %jobnumberjobnumber
jobs

11.9 deamons
deamon qdeamon(
)cron()errdeamon()

11.10 /

ID ID

11.11
ps AIX AT&T BSD ps
BSD ,

# ps alx

AT&T

# ps -elf
65
IN-222-C1 AIX

ps PRI NI nice priorities


, priorities 0 127 ,

11.12
nice nice 0 39 ,
nice nice Increment
nice -n Increment
nice 10 10

# nice -10 CommandName()

10

# nice CommandName

renice -n renice

# renice Priority -p PID

-p

11.13
AIX kill AIX kill /usr/bin/kill shell
kill
TERM HUP kill -l

# kill l

AIX killall

# killall Signal

11.14

AIX topas ,sar, vmstat iostat
UNIX

66
11

topas

, (
), ps
ps
topas

sar

, CPU ,
, ,, ,

vmstat

CPU

iostat

I/O

11.15
cron crontab
/var/spool/cron/crontabs root crontab
rootAIX AT&T crontab

( 0 59 )

( 0 23 )

( 1 31 )

( 1 12 )

( 0 6 )

shell

AIX crontab crontab -e crontab


EDITOR
crontab

67
IN-222-C1 AIX

crontab spool /var/spool/cron


AIX /usr/spool
/var/spool

68
12
TCP/IP


TCP/IP

UNIX TCP/IP ifconfig route,


AIX SMIT
/etc/rc.net ODM

12.1 IP
TCP/IP AIX IP
SMIT
SMIT

# smit mktcpip

Available Network Interfaces ,


bootup cfgmgr ODM

Minimum Configuration & Startup , HOSTNAME


Internet ADDRESS START Now bootup
TCP/IP


Network MASK , AIX IP CABLE
Type bnc dix tp

----------------------------------------------------------------------

Minimum Configuration & Startup

To Delete existing configuration data, please use Further Configuration menus

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[Entry Fields]

69
IN-222-C1 AIX

* HOSTNAME [a2410bjv]

* Internet ADDRESS (dotted decimal) [15.24.48.58]

Network MASK (dotted decimal) [255.255.248.0]

* Network INTERFACE en0

NAMESERVER

Internet ADDRESS (dotted decimal) [15.41.144.101]

DOMAIN Name [nsr.hp.com]

Default GATEWAY Address [15.24.55.253]

(dotted decimal or symbolic name)

Your CABLE Type N/A +

START Now no +

----------------------------------------------------------------------

# smit hostname

Hostname Set the Hostname

HOSTNAME

12.2

12.2.1

# smit mkroute

DESTINATION Address Default GATEWAY Address


Destination Type net hostMETRIC 1

----------------------------------------------------------------------

70
12 TCP/IP

Add Static Route

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[Entry Fields]

Destination TYPE net +

* DESTINATION Address []

(dotted decimal or symbolic name)

* Default GATEWAY Address []

(dotted decimal or symbolic name)

* METRIC (number of hops to destination gateway) [1] #

----------------------------------------------------------------------

12.2.2

SMIT

# smit rmroute

12.2.3

SMIT

# smit fshrttbl

----------------------------------------------------------------------

Flush Routing Table

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[Entry Fields]

Flush Routing Table in the Current Running System yes +

71
IN-222-C1 AIX

Flush Routing Table in the Configuration Data Base no +

(effective in the next system restart)

----------------------------------------------------------------------

ODM ,
ODM Flush Routing Table in the Configuration Data Base
YES

12.3
cfgmgr

12.3.1

SMIT

# smit chinet

Available Network Interfaces


BROADCAST ADDRESS , AIX

----------------------------------------------------------------------

Change / Show a Standard Ethernet Interface

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[Entry Fields]

Network Interface Name en0

INTERNET ADDRESS (dotted decimal) [15.24.48.58]

Network MASK (hexadecimal or dotted decimal) [255.255.248.0]

Current STATE up +

Use Address Resolution Protocol (ARP)? yes +

BROADCAST ADDRESS (dotted decimal) []

72
12 TCP/IP

----------------------------------------------------------------------

12.3.2

SMIT

# smit inet

Remove a Network Interface

SMIT

12.4

12.4.1 /etc/hosts

SMIT /etc/hosts /etc/hosts


SMIT

# smit hostent

----------------------------------------------------------------------

Hosts Table (/etc/hosts)

Move cursor to desired item and press Enter.

List All Hosts

Add a Host

Change / Show Characteristics of a Host

Remove a Host

----------------------------------------------------------------------

12.4.2 /etc/inetd.conf

SMIT /etc/inetd.conf ODM

# smit inetdconf

----------------------------------------------------------------------

73
IN-222-C1 AIX

inetd Subservers

Move cursor to desired item and press Enter.

List All inetd Subservers

Add an inetd Subserver

Change / Show Characteristics of an inetd Subserver

Remove an inetd Subserver

----------------------------------------------------------------------

/etc/inetd.conf ODM
/etc/inetd.conf refresh -s inetd

12.4.3 /etc/services

SMIT /etc/services

# smit inetserv

----------------------------------------------------------------------

Services (/etc/services)

Move cursor to desired item and press Enter.

List All Services

Add a Service

Change / Show Characteristics of a Service

Remove a Service

----------------------------------------------------------------------

/etc/services

12.4.4 /etc/hosts.equiv

SMIT /etc/hosts.equiv

# smit hostsequiv

74
12 TCP/IP

----------------------------------------------------------------------

Host Access (/etc/host.equiv)

Move cursor to desired item and press Enter.

List All Remote Hosts

Add a Remote Host

Remove a Remote Host

----------------------------------------------------------------------

/etc/hosts.equiv

12.4.5 /etc/ftpusers

/etc/ftpusers ftp SMIT

# smit ftpusers

----------------------------------------------------------------------

Restrict File Transfer Program Users (/etc/ftpusers)

Move cursor to desired item and press Enter.

Show All Restricted Users

Add a Restricted User

Remove a Restricted User

----------------------------------------------------------------------

75
13



5GB 8-mm /dev/rmt0

13.1
SMIT

13.1.1

AIX backup restore UNIX


tarcpiodd pax

13.1.1.1

AIX backup i-node i-node


AIX i-node

# backup -f Device -DumpLevel -u File system

Device

DumpLevel 09 0
n n- 1
backup 9

-u backup /etc/dumpdates
unmount fsck,
MOUNT ,

backup

1/home

# umount /home
77
IN-222-C1 AIX

# fsck /home

# backup - f /dev/rmt0 - O - u /home

# mount /home

2 0

# backup - f /dev/rmt0 - 1 - u /

/home
backup
lsfs r

13.1.1.2

-i

# backup f Device i

1.-fDevicebackup /dev/rfd0

2. backup
backup Ctrl-D
find cat

-q backup

# backup - f /dev/rmt0 - iq

/.profile

/etc/profile

/home

^D

# backup -f /dev/rmt0 < /tmp/filelist -iq

# cat /tmp/filelist | backup -f /dev/rmt0 -iq

# find /home - print|backup - f /dev/rmt0 - iq

78
13

/home 2
/home /tmp/filelist ,

# find $(</tmp/filelist )- print|backup - f /dev/rmt0 iq

backup , -v
tee

# find $(< /tmp/filelist) -print | backup -f /dev/rmt0 -iqv >\ /var/adm/backed.up.files

# find $(< /tmp/filelist) -print | backup -f /dev/rmt0 -iqv | tee |\ var/adm/backed.up.files

13.1.2 SMIT

smit backfilesys

smit backfile

13.2
restore i-node
backup i-node

# restore -f Device -r

# restore -f Device -x

i-node

# restore -f /dev/rmt0 -r

unmount restore

i-node -i restore

# restore -f /dev/rmt0 -i

79
IN-222-C1 AIX

# restore -f /dev/rmt0 -x

# restore - f /dev/rmt0 - xv

/home/partlist

# restore - f /dev/rmt0 - xv /home/partlist

/home

# restore - f /dev/rmt0 - xv - d /home


-T
,

backup /archive/backup1

#restore - f /archive/backup1 - T

# restore - f /dev/rmt0 - T

./home/partlist

SMIT smit restfile


smit restfilesys

13.3
mksysb AIX

, , mksysb mksysb
, IP

# smit mksysb

80
13

---------------------------------------------------------------------------------------------------------

Back Up the System

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[TOP] [Entry Fields]

WARNING: Execution of the mksysb command will

result in the loss of all material

previously stored on the selected

output medium. This command backs

up only rootvg volume group.

* Backup DEVICE or FILE [] +/

Create MAP files? no +

EXCLUDE files? no +

Make BOOTABLE backup? yes +

(Applies only to tape)

EXPAND /tmp if needed? no +

(Applies only to bootable tape)

Number of BLOCKS to write in a single output [] #

(Leave blank to use a system default)

---------------------------------------------------------------------------------------------------------

, /dev/rmt0,
FORCE increase of work space if needed yes

mksysb (rootvg) AIX 4 savevg


SMIT smit savevg , datavg

# savevg - i datavg

81
IN-222-C1 AIX

/dev/rmt0-f

restvg smit restvg , /dev/rmt0


# restvg q

82

You might also like