IBM AIX操作系统常用命令
第一章 IBM小型机硬件配置信息查询命令
1.小型机机型查询命令
# prtconf |grep Model
System Model: IBM,7038-6M2
2.小型机CPU信息查询
# lsdev -Cc processor
proc0 Available 00-00 Processor
proc1 Available 00-01 Processor
proc2 Available 00-02 Processor
proc3 Available 00-03 Processor
显示处理器的状态、数量、设备逻辑名称
# lsattr -El proc0
state enable Processor state False
type PowerPC_POWER4 Processor type False
frequency 1452000000 Processor Speed False
3.小型机内存信息查询
# lsdev -Cc memory
mem0 Available 00-00 Memory
L2cache0 Available 00-00 L2 Cache
# lsattr -El mem0
size 4096 Total amount of physical memory in Mbytes False
goodsize 4096 Amount of usable physical memory in Mbytes False
4.小型机硬盘信息查询
# lsdev -Cc disk
hdisk0 Available 1Z-08-00-8,0 16 Bit LVD SCSI Disk Drive
hdisk1 Available 1Z-08-00-9,0 16 Bit LVD SCSI Disk Drive
hdisk2 Available 14-08-L SSA Logical Disk Drive
hdisk3 Available 14-08-L SSA Logical Disk Drive
# lsattr -El hdisk0
pvid 0058e08d80035d6e0000000000000000 Physical volume identifier False
queue_depth 3 Queue DEPTH False
size_in_mb 36400 Size in Megabytes False
5.小型机网卡信息查询
# lsdev -Cc adapter|grep ent
ent0 Available 1c-08 10/100 Mbps Ethernet PCI Adapter II (1410ff01)
ent1 Available 1j-08 10/100 Mbps Ethernet PCI Adapter II (1410ff01)
ent2 Available 1n-08 10/100 Mbps Ethernet PCI Adapter II (1410ff01)
ent3 Available 11-08 10/100 Mbps Ethernet PCI Adapter II (1410ff01)
ent4 Available 1A-08 10/100 Mbps Ethernet PCI Adapter II (1410ff01)
ent5 Available 1D-08 10/100 Mbps Ethernet PCI Adapter II (1410ff01)
# lsattr -El ent0
busmem 0xe4030000 Bus memory address False
rom_mem 0xe4000000 ROM memory address False
busintr 101 Bus interrupt level False
intr_priority 3 Interrupt priority False
txdesc_que_sz 512 TX Descriptor Queue Size True
rxdesc_que_sz 512 RX Descriptor Queue Size True
tx_que_sz 8192 Software TX Queue Size True
rxbuf_pool_sz 1024 Receive Buffer Pool Size True
media_speed Auto_Negotiation Media Speed True
use_alt_addr no Enable Alternate Ethernet Address True
alt_addr 0x000000000000 Alternate Ethernet Address True
tx_preload 1520 TX Preload Value True
ipsec_offload no IPsec Offload True
chksum_offload yes Enable hardware transmit and receive checksum True
large_send no Enable TCP Large Send Offload True
slih_hog 10 Interrupt Events per Interrupt True
rx_hog 1000 RX Descriptors per RX Interrupt True
poll_link no Enable Link Polling True
poll_link_timer 500 Time interval for Link Polling True
6.小型机SCSI卡信息查询
# lsdev -Cc adapter | grep scsi
scsi0 Available 1Z-08 Wide/Ultra-3 SCSI I/O Controller
scsi1 Available 1Z-09 Wide/Ultra-3 SCSI I/O Controller
7.小型机光纤卡信息查询
# lsdev -Cc adapter | grep fcp
8.小型机SSA卡信息查询
# lsdev -Cc adapter | grep ssa
ssa0 Available 14-08 IBM SSA 160 SerialRAID Adapter (14109100)
# lsattr -El ssa0
ucode 14109100.05.c4 Name of adapter code download file False
bus_io_addr 0x1ec00 Bus I/O address False
bus_mem_start 0xe8000000 Bus memory address False
bus_mem_start2 0xe8928000 Bus memory address False
bus_mem_start3 0xe8900000 Bus memory address False
bus_mem_start4 0xe8800000 Bus memory address False
bus_intr_level 117 Bus interrupt level False
intr_priority 3 Interrupt priority False
daemon true Enable the SSA adapter daemon True
host_address Host Address for Adapter True
scat_gat_pages 8 Pages allocated for scatter/gather True
poll_threshold 0x100 IO Polling threshold True
dma_mem 0x400000 DMA bus memory length True
9. 小型机磁带机信息查询
# lsdev -Cc tape
rmt0 Available 1Z-08-00-0,0 Differential SCSI 4mm Tape Drive
10.小型机软驱信息查询
# lsdev -Cc diskette
fd0 Available 01-D1-00-00 Diskette Drive
11.小型机RS232 卡端口
# lsdev -Cc tty
tty0 Available 01-S1-00-00 Asynchronous Terminal
12.小型机光驱信息查询
# lsdev -Cc cdrom
cd0 Available 1Z-08-00-1,0 16 Bit LVD SCSI DVD-ROM Drive
13.小型机硬件平台是否是64位
# bootinfo -y
64
第二章 IBM小型机系统信息查询命令
1.主机名称查询
# hostname
p650a
2.操作系统版本、补丁信息查询
# oslevel -r
5100-09
# instfix -i|grep ML
All filesets for 5.1.0.0_AIX_ML were found.
All filesets for 5100-01_AIX_ML were found.
All filesets for 5100-02_AIX_ML were found.
All filesets for 5100-03_AIX_ML were found.
All filesets for 5100-04_AIX_ML were found.
All filesets for 5100-05_AIX_ML were found.
All filesets for 5100-06_AIX_ML were found.
All filesets for 5100-07_AIX_ML were found.
All filesets for 5100-08_AIX_ML were found.
All filesets for 5100-09_AIX_ML were found.
3.系统安装软件信息查询
# lslpp –l
Fileset Level State Description
----------------------------------------------------------------------------
Path: /usr/lib/objrepos
IMNSearch.bld.DBCS 2.3.1.15 COMMITTED NetQuestion DBCS Buildtime
Modules
IMNSearch.bld.SBCS 2.3.1.15 COMMITTED NetQuestion SBCS Buildtime
Modules
IMNSearch.msg.en_US.rte.com
2.3.1.0 COMMITTED Text Search Messages - U.S.
English
。。。。。。
4.系统物理硬盘信息查询
# lspv
hdisk0 0058e08d80035d6e rootvg
hdisk1 005d3c1d4fe48639 rootvg
hdisk2 005d3c1d6b7b53c0 datavg
hdisk3 005d3c1d6b7ba3aa testvg
# lspv -l hdisk1
hdisk1:
LV NAME LPs PPs DISTRIBUTION MOUNT POINT
hd5 1 1 01..00..00..00..00 N/A
hd6 8 8 00..08..00..00..00 N/A
jfslog1 2 2 00..02..00..00..00 N/A
hd8 1 1 00..00..01..00..00 N/A
hd4 1 1 00..00..01..00..00 /
hd2 73 73 00..00..73..00..00 /usr
hd9var 10 10 00..00..10..00..00 /var
hd3 1 1 00..00..01..00..00 /tmp
hd1 1 1 00..00..01..00..00 /home
hd10opt 1 1 00..00..01..00..00 /opt
testnewlv 2 2 00..00..02..00..00 /test
# lspv -p hdisk0
hdisk0:
PP RANGE STATE REGION LV NAME TYPE MOUNT POINT
1-1 used outer edge hd5 boot N/A
2-109 free outer edge
110-117 used outer middle hd6 paging N/A
118-143 used outer middle lg_dumplv sysdump N/A
144-145 used outer middle testnewlv jfs /test
146-217 free outer middle
218-218 used center hd8 jfs2log N/A
219-219 used center hd4 jfs2 /
220-276 used center hd2 jfs2 /usr
277-286 used center hd9var jfs2 /var
287-287 used center hd3 jfs2 /tmp
288-288 used center hd1 jfs2 /home
289-289 used center hd10opt jfs2 /opt
290-305 used center hd2 jfs2 /usr
306-325 free center
326-433 free inner middle
434-542 free inner edge
5.逻辑卷查询命令
# lslv -l hd3
hd3:/tmp
PV COPIES IN BAND DISTRIBUTION
hdisk0 001:000:000 100% 000:000:001:000:000
hdisk1 001:000:000 100% 000:000:001:000:000
6.卷组查询命令
# lsvg
datavg
rootvg
testvg
列出系统上所有定义的卷组名称
# lsvg -o
testvg
rootvg
列出系统上已经激活的卷组名称
# lsvg –l VGname
# lsvg -l rootvg
rootvg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
hd5 boot 1 2 2 closed/syncd N/A
hd6 paging 8 16 2 open/syncd N/A
hd8 jfs2log 1 2 2 open/syncd N/A
hd4 jfs2 1 2 2 open/syncd /
hd2 jfs2 73 146 2 open/syncd /usr
hd9var jfs2 10 20 2 open/syncd /var
hd3 jfs2 1 2 2 open/syncd /tmp
hd1 jfs2 1 2 2 open/syncd /home
hd10opt jfs2 1 2 2 open/syncd /opt
lg_dumplv sysdump 26 26 1 open/syncd N/A
testnewlv jfs 2 4 2 open/syncd /test
jfslog1 jfslog 2 2 1 open/syncd N/A
列出rootvg中所包含逻辑卷的信息
# lsvg –p VGname
# lsvg -p rootvg
rootvg:
PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION
hdisk0 active 542 417 108..72..20..108..109
hdisk1 active 542 441 108..98..18..108..109
列出rootvg中所包含PhysicalDisk的信息
7.文件系统查询命令
# df -k
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd4 65536 44084 33% 2861 22% /
/dev/hd2 4784128 1144188 77% 73987 23% /usr
/dev/hd9var 655360 601916 9% 839 1% /var
/dev/hd3 65536 59348 10% 104 1% /tmp
/dev/hd1 65536 65048 1% 24 1% /home
/proc - - - - - /proc
/dev/hd10opt 65536 55768 15% 457 4% /opt
/dev/testnewlv 131072 126912 4% 17 1% /test
/dev/lv00 16384 15820 4% 17 1% /testdr
# lsfs
Name Nodename Mount Pt VFS Size Options Auto Accounting
/dev/hd4 -- / jfs2 131072 -- yes no
/dev/hd1 -- /home jfs2 131072 -- yes no
/dev/hd2 -- /usr jfs2 9568256 -- yes no
/dev/hd9var -- /var jfs2 1310720 -- yes no
/dev/hd3 -- /tmp jfs2 131072 -- yes no
/proc -- /proc procfs -- -- yes no
/dev/hd10opt -- /opt jfs2 131072 -- yes no
/dev/lv00 -- /testdr jfs 32768 rw no no
/dev/testnewlv -- /test jfs 262144 rw no no
8.交换区信息查询命令
# lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type
hd6 hdisk0 rootvg 512MB 1 yes yes lv
列出交换区设备信息
# lsps -s
Total Paging Space Percent Used
512MB 1%
列出交换区使用率
9.主机IP地址查询
# ifconfig -a
en0: flags=7e080863,10<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD,CHECKSUM_SUPPORT,PSEG>
inet 10.110.157.156 netmask 0xfffffe00 broadcast 10.110.157.255
en1: flags=7e080863,10<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD,CHECKSUM_SUPPORT,PSEG>
inet 192.168.111.1 netmask 0xfffffe00 broadcast 192.168.111.255
en2: flags=7e080863,10<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD,CHECKSUM_SUPPORT,PSEG>
inet 192.168.112.1 netmask 0xfffffe00 broadcast 192.168.113.255
en3: flags=7e080863,10<UP,BROADCAST,NOTRAILERS,RUNNING,SIMPLEX,MULTICAST,GROUPRT,64BIT,CHECKSUM_OFFLOAD,CHECKSUM_SUPPORT,PSEG>
inet 10.10.10.1 netmask 0xffffff00 broadcast 10.10.10.255
# netstat -in
Name Mtu Network Address Ipkts Ierrs Opkts Oerrs Coll
en0 1500 link#2 0.2.55.3a.47.9c 419521 0 140863 0 0
en0 1500 10.110.156 10.110.157.156 419521 0 140863 0 0
en1 1500 link#3 0.d.60.a.3c.fe 264262 0 1604 0 0
en1 1500 192.168.110 192.168.111.1 264262 0 1604 0 0
en2 1500 link#4 0.d.60.a.3a.ae 268920 0 7548 0 0
en2 1500 192.168.112 192.168.112.1 268920 0 7548 0 0
en3 1500 link#5 0.d.60.a.10.fc 0 0 8 0 0
en3 1500 10.10.10 10.10.10.1 0 0 8 0 0
en4 1500 link#6 0.d.60.a.4b.94 0 0 1097 0 0
en4 1500 192.168.110 192.168.110.12 0 0 1097 0 0
lo0 16896 link#1 25536 0 25671 0 0
lo0 16896 127 127.0.0.1 25536 0 25671 0 0
lo0 16896 ::1 25536 0 25671 0 0
10.当前进程查询
# ps –ef
查询系统中运行的所有进行的信息
11.用户信息查询
# logname
root
# id
uid=0(root)gid=0(system) groups=2(bin),3(sys),7(security),8(cron),10(audit),11(lp)
# env
12.显示HACMP状态
# /usr/es/sbin/cluster/clstat
# lssrc -g cluster
Subsystem Group PID Status
clsmuxpdES cluster 884930 active
clstrmgrES cluster 688246 active
clinfoES cluster 598106 active
12. 系统运行级查询
# who -r
. run-level 2 Feb 16 15:09 2 0 S
显示当前的运行级是2以及前一个运行级0
13.查看系统已经运行时间
# uptime
03:34PM up 1 day, 1:37, 6 users, load average: 0.00, 0.00, 0.00
显示系统到目前为止的运行时间
14.显示登陆用户信息
# last
15.显示启动设备信息
# bootlist -m normal -o
rmt0
hdisk0
hdisk1
cd0
主机正常启动时引导设备列表
# bootlist –m service –o
服务状态引导设备列表
16.关闭系统命令
# shutdown –r
关闭系统后马上使用reboot在启动系统
# shutdown –F
快速关闭系统
17.查看系统启动log信息
# alog –o –t boot
显示系统启动信息
# alog –o –t console
显示系统console输出的信息
18.查看crontab 配置信息
# crontab –l
19.查询系统路由信息
# netstat –rn
显示网络的网卡、路由、网关信息
20.查看用户历史命令列表
# history
缺省输出15行的历史记录,显示更多的历史记录,如下例
# history -100
21.查看系统时间
# date
Fri Feb 17 15:56:31 BEIST 2006
22.查看tcpip参数
# no –a
23.查看系统license情况
# lslicense
Maximum number of fixed licenses is 1024.
Floating licensing is disabled.
24.查看系统错误日志
# errpt
# errpt –a
详细输出每项报错的内容
# errpt –a –j IDENTIFIER
按照特定的IDENTIFIER显示详细的报错信息
25.清除日志记录
# errclear XX (XX是保留最近日志的天数)
26.系统dump设备查询
# sysdumpdev –l
primary /dev/lg_dumplv
secondary /dev/sysdumpnull
copy directory /var/adm/ras
forced copy flag TRUE
always allow dump TRUE
dump compression OFF
27.性能监控
# vmstat
kthr memory page faults cpu
----- ----------- ------------------------ ------------ -----------
r b avm fre re pi po fr sr cy in sy cs us sy id wa
2 1 256197 219169 0 0 0 0 0 0 463 56691 447 1 6 92 0
# vmstat 2 10
每2秒采集一次信息,一共采集10次
28.系统I/O设备性能监控
# iostat
tty: tin tout avg-cpu: % user % sys % idle % iowait
0.0 3.9 1.1 6.3 92.5 0.1
Disks: % tm_act Kbps tps Kb_read Kb_wrtn
hdisk0 0.2 3.3 0.5 1829245 2837571
hdisk1 0.0 0.0 0.0 345 0
hdisk4 0.0 2.9 0.2 3230952 847486
hdisk5 0.0 3.0 0.0 2031108 2211568
hdisk2 0.0 0.1 0.0 63414 13652
cd0 0.0 0.0 0.0 0 0
29.系统内存监控
# svmon
size inuse free pin virtual
memory 1048560 197816 850744 119378 164288
pg space 131072 1002
work pers clnt lpage
pin 119131 0 247 0
in use 164305 48 33463 0
30.系统软件和硬件信息查询
# prtconf
31.测试网络的连通性
# ping 10.110.157.157
第三章 配置主机常用命令
1.更改主机名称
# smitty mkhostname
* HOSTNAME (symbolic name of your machine) [ ]
2.增加、删除用户命令
# smitty mkuser
* User NAME [ ]
UserID [ ]
ADMINISTRATIVE USER? false
Primary GROUP [ ]
Group SET [ ]
# smitty rmuser
* User NAME [ ]
Remove AUTHENTICATION information? yes
3.增加、删除组命令
# smitty mkgroup
* Group NAME [ ]
ADMINISTRATIVE group? alse
Group ID [ ]
USER list [ ]
ADMINISTRATOR list [ ]
输入相应的name, user id
# smitty rmgroup
Group NAME [ ]
输入所要删除group的名字
4.删除硬盘设备
# rmdev –l hdisk0
# rmdev –dl hdisk0
5.增加、删除文件系统
# smitty crjfs
àAdd a Standard Journaled File System
à选择相应的VG
Volume group name datavg
* SIZE of file system (in 512-byte blocks) []
* 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
Allocation Group Size (MBytes) 8
# smitty rmjfs
*FILE SYSTEM name [ ]
Remove Mount Point no
输入文件系统的名字
6.增加、删除、扩大逻辑卷
# smitty mklv
* VOLUME GROUP name []
首先输入VG的名字,然后进入下面步骤
Logical volume NAME []
* VOLUME GROUP name rootvg
* Number of LOGICAL PARTITIONS []
PHYSICAL VOLUME names []
Logical volume TYPE []
# smitty rmlv
LOGICAL VOLUME name []
输入LV的名字
# smitty extendlv
* LOGICAL VOLUME name hd6
* Number of ADDITIONAL logical partitions []
PHYSICAL VOLUME names []
POSITION on physical volume middle
RANGE of physical volumes minimum
MAXIMUM NUMBER of PHYSICAL VOLUMES [32]
to use for allocation
Allocate each logical partition copy yes
on a SEPARATE physical volume?
File containing ALLOCATION MAP []
7.创建、删除卷组
# smitty mkvg
VOLUME GROUP name []
Physical partition SIZE in megabytes 4
* PHYSICAL VOLUME names []
Activate volume group AUTOMATICALLY yes
at system restart?
Volume Group MAJOR NUMBER []
Create VG Concurrent Capable? no
Auto-varyon in Concurrent Mode? no
LTG Size in kbytes 128
输入VG的名字,以及PV的名字
# smitty reducevg
àRemove a Physical Volume from a Volume Group
* VOLUME GROUP name []
输入VG的名字
8.卷组操作命令
# extendvg VGname hdiskX
将hdiskX加入VGname中
# reducevg VGname hdiskX
将hdiskX中VGname中除去
# importvg -y VGname hdiskX
将hdiskX所在的VG以VGname的名字导入当前主机
# exportvg VGname
将VGname的配置信息从当前主机导出
# varyonvg VGname
将VGname在当前主机激活
# varyoffvg VGname
将Vgname置成非激活的状态
9.文件系统管理命令
# smitty crfs
Add a Journaled File System
Add an Enhanced Journaled File System
Add a CDROM File System
选择相应的文件系统进行创建
# smitty chfs
Change / Show Characteristics of a Journaled File System
Change / Show Characteristics of an Enhanced Journaled File System
Change / Show Characteristics of a CDROM File System
# smitty rmfs
Remove a Journaled File System
Remove an Enhanced Journaled File System
Remove a CDROM File System
# smitty mount
Mount a File System
à Mount a File System
FILE SYSTEM name []
输入文件系统的名字
# smitty unmount
à Unmount a File System
NAME of file system to unmount []
# smitty fsck
NAME of file system
-OR-
TYPE of file system
FAST check? no
输入文件系统的名字,对此文件系统进行一致性检查
# df -k
列出当前文件系统以及每个文件系统的使用空间情况
10.Paging space 管理命令
# smitty mkps
Volume group name datavg
SIZE of paging space (in logical partitions) []
PHYSICAL VOLUME name
Start using this paging space NOW? no
Use this paging space each time the system is no
RESTARTED?
输入paging spaces 的大小以及是否在系统启动的时候启动
# smitty chps
Paging space name hd6
Volume group name rootvg
Physical volume name hdisk0
NUMBER of additional logical partitions []
Or NUMBER of logical partitions to remove []
Use this paging space each time the system is yes
RESTARTED?
输入增加的Logical Partition的数量
# smitty rmps
PAGING SPACE name []
输入paging space的名字
# swapon –a
激活所有paging space
# swapoff DeviceName
11.SRC操作命令
# startsrc -s subsystem_name
启动子系统的相关进程
# startsrc -g group_name
启动一组子系统的相关进程
# lssrc –a
列出所有系统资源组的信息
12.系统设备配置命令
# cfgmgr –v
13.查找文件命令
# find / -name filename –print
14.更改文件或目录的访问权限
# chmod 777 XXX (XXX代表所要查找文件的名字)
15.更改文件或目录的owner及group
# chown username :groupname XXX (XXX代表文件或目录的名字)
16.系统调试工具
# diag
àDiagnostic Routines
Advanced Diagnostics Routines
Task Selection
Resource Selection
17.操作系统备份命令
# smitty mksysb
* Backup DEVICE or FILE []
Create MAP files? no
EXCLUDE files? no
List files as they are backed up? no
Generate new /image.data file? yes
EXPAND /tmp if needed? no
Disable software packing of backup? no
Number of BLOCKS to write in a single output []
(Leave blank to use a system default)
输入目标设备或者文件
18.HACMP操作命令
# smitty clstart
* Start now, on system restart or both now
Start Cluster Services on these nodes [p650a]
BROADCAST message at startup? true
Startup Cluster Information Daemon? true
Reacquire resources after forced down ? false
# smitty clstop
* Stop now, on system restart or both now
Stop Cluster Services on these nodes [p650a]
BROADCAST cluster shutdown? true
* Shutdown mode graceful
19.改变用户口令
# passwd user-name
20.配置IP地址
# smitty mktcpip
21.NFS操作命令
# smitty mknfs
* START NFS now, on system restart or both both
启动NFS系统后台进程,可以选择是现在重启还是在系统重启时启动这些进程
# smitty mknfsexp
* PATHNAME of directory to export []
* MODE to export directory read-write
HOSTS & NETGROUPS allowed client access []
Anonymous UID [-2]
HOSTS allowed root access []
HOSTNAME list. If exported read-mostly []
Use SECURE option? no
Public filesystem? no
* EXPORT directory now, system restart or both both
PATHNAME of alternate Exports file []
配置NFS server 向客户端导出的目录
# smitty chnfsexp
* PATHNAME of exported directory []
更改或显示已经到处的目录的属性
# smitty rmnfsexp
* PATHNAME of exported directory to be removed []
删除NFS server上面已经导出的目录
# smitty mknfsmnt
安装一个NFS文件系统
# showmount –e NFS_Server
显示NFS server导出的文件系统
22. 安装软件
# smitty install_latest
* INPUT device / directory for software [ ]
输入安装文件所在的光盘或者路径
23.删除软件
# smitty remove
* SOFTWARE name []
PREVIEW only? (remove operation will NOT occur) yes
REMOVE dependent software? no
EXTEND file systems if space needed? no
DETAILED output? No
输入软件包的名字或者通过F4列表选择
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26366371/viewspace-2131569/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/26366371/viewspace-2131569/