hp unix常用命令
绝世美人儿
621次浏览
2020年07月29日 19:06
最佳经验
本文由作者推荐
致橡树原文-自诩
# model
9000/861/D270
2,CPU个数
# top
LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS
0.15 0.4% 0.0% 0.6% 99.0% 0.0% 0.0% 0.0% 0.0%
3,硬盘个数
# ioscan -funC disk
Class I H/W Path Driver S/W State H/W Type Description
=====================================================================
disk 0 8/16/5.2.0 sdisk CLAIMED DEVICE TOSHIBA CD-ROM XM-5701TA
/dev/dsk/c2t2d0 /dev/rdsk/c2t2d0
disk 5 8/16/5.5.0 sdisk CLAIMED DEVICE SEAGATE ST34572N
/dev/dsk/c2t5d0 /dev/rdsk/c2t5d0
disk 1 8/16/5.6.0 sdisk CLAIMED DEVICE SEAGATE ST34572N
/dev/dsk/c2t6d0 /dev/rdsk/c2t6d0
其中disk0为光驱,disk5和disk1为硬盘
4,硬盘大小信息
# diskinfo /dev/rdsk/c2t5d0
SCSI describe of /dev/rdsk/c2t5d0:
vendor: SEAGATE
product id: ST34572N
type: direct access
size: 4194157 Kbytes
bytes per sector: 512
5,查看操作系统版本和license
# uname -a
HP-UX d270_2 B.10.20 E 9000/861 2012683578 8-user license
# uname -S sanfran(设定主机名为sanfran)
6,查看系统内存
# dmesg
Memory Information:
physical page size = 4096 bytes, logical page size = 4096 bytes
Physical: 131072 Kbytes, lockable: 83712 Kbytes, available: 99212 Kbytes
7,查看文件系统
# bdf
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol3 83733 18876 56483 25% /
/dev/vg00/lvol1 47829 22800 20246 53% /stand
/dev/vg00/lvol8 768541 254843 436843 37% /var
/dev/vg00/lvol7 797845 374901 343159 52% /usr
/dev/vg00/lvol4 30597 3087 24450 11% /tmp
/dev/vg00/lvol6 797845 347249 370811 48% /opt
/dev/vg00/lvol5 19861 81 17793 0% /home
8,查看卷组、卷组所包括的逻辑卷以及该卷组所包括的物理磁盘
# vgdisplay -v vg00
9,查看网卡状态
# lanscan
Hardware Station Crd Hardware Net-Interface NM MAC HP DLPI Mjr
Path Address In# State NameUnit State ID Type Support Num
8/16/6 0x0060B0A3981C 0 UP lan0 UP 4 ETHER Yes 52
8/20/5/1 0x0060B0588479 1 UP btlan01 DOWN 5 ETHER Yes 77
8/20/5/2 0x0060B058747F 2 UP btlan02 UP 6 ETHER Yes 77
10,查看网卡的名字、IP地址、网关、子网掩码等配置信息
# more /etc/.d/netconf
ROUTE_DESTINATION[1]="default"
ROUTE_MASK[1]=""
ROUTE_GATEWAY[1]=172.16.10.254
ROUTE_COUNT[1]=1
IP_ADDRESS[2]=192.168.1.2
SUBNET_MASK[2]=255.255.255.0
INTERFACE_NAME[2]=btlan02
BROADCAST_ADDRESS[2]=192.168.1.255
LANCONFIG_ARGS[2]="ether"
11,配置IP地址
# ifconfig lan0 172.16.10.225 255.255.255.0
12,查看网卡的地址
# ifconfig lan0
lan0: flags=863
inet 172.16.10.225 netmask ffffff00 broadcast 192.1.1.255
13,查看路由
信息
# netstat -an
Active Internet connections (including servers)
Proto Recv-Q Send-Q Local Address Foreign Address (state)
tcp 0 0 172.16.10.225.4294 172.16.10.225.1712 TIME_WAIT
tcp 0 0 192.168.1.2.4252 192.168.1.2.4253 ESTABLISHED
tcp 0 0 192.168.1.2.4253 192.168.1.2.4252 ESTABLISHED
tcp 0 0 *.4252 *.* LISTEN
tcp 0 0 192.168.1.2.4162 192.168.1.2.4251 ESTABLISHED
tcp 0 0 192.168.1.2.4251 192.168.1.2.4162 ESTABLISHED
tcp 0 0 172.16.10.225.4250 172.16.10.123.6001 ESTABLISHED
tcp 0 0 172.16.10.225.4249 172.16.10.123.6001 ESTABLISHED
tcp 0 0 192.168.1.2.4247 192.168.1.2.4248 ESTABLISHED
tcp 0 0 192.168.1.2.4248 192.168.1.2.4247 ESTABLISHED
tcp 0 0 *.4247 *.* LISTEN
14,配置路由信息,例如:
# /usr/sbin/route add default 20.08.28.98 1
还可以直接修改/etc/.d/netconf文件来增加路由(SUN里面是修改/etc/defaultroute文件)
# route delete default 128.1.0.1
15,有用的诊断工具mstm
用来收集所有的硬件信息,比如一共有哪些内存插口,每块现有的内存条多大,还可以查几个内存条等等
16,重启计算机
# reboot
# shutdown
17,关闭计算机
# shutdown -hy 0
# init 0
18,查看系统的运行级别
# who -r
. run-level 3 Oct 25 14:46 3 0 S
19,看当前的登录名
# logname
root
20,看登陆用户在干什么
# whodo
Thu Oct 27 11:33:58 EAT 2005
HP-UX
root 0 Oct 27 11:30
9773 0:00 sh
9849 0:00 whodo
9852 0:00 awk
9854 0:00 sort
9856 0:00 awk
9857 0:00 ps
root console Oct 25 14:48
1193 0:00 sh
root dtremote Oct 27 10:11
zp1 ttyp1 Oct 27 10:12
6377 0:00 telnetd
6378 0:00 sh
21,查看进程
# ps -ef | grep zp1
zp1 6378 6377 0 10:12:29 ttyp1 0:00 -sh
22,查看光驱
# ioscan -funC disk
Class I H/W Path Driver S/W State H/W Type Description
=====================================================================
disk 0 8/16/5.2.0 sdisk CLAIMED DEVICE TOSHIBA CD-ROM XM-5701TA
/dev/dsk/c2t2d0 /dev/rdsk/c2t2d0
disk 5 8/16/5.5.0 sdisk CLAIMED DEVICE SEAGATE ST34572N
/dev/dsk/c2t5d0 /dev/rdsk/c2t5d0
disk 1 8/16/5.6.0 sdisk CLAIMED DEVICE SEAGATE ST34572N
/dev/dsk/c2t6d0 /dev/rdsk/c2t6d0
23,日志文件的查询
/var/adm/syslog/ //系统常用信息,如配置、修改、启动、关闭等信息
/var/adm/syslog/ //电子邮件信息
/var/adm/syslog/swinstall.
件
# crontab -r:删除cron文件中制定的所有规划
45,使用swapon命令
# swapon /dev/vg01/myswap:将整个卷设定为swap,在这样的情况下不允许这个卷的任何部分用做其他用途.如果将这个卷设为swap之前还有数据,那么可以用参数-f强制性将所有数据清除
# swapon -e /dev/dsk/c0t1d0:允许磁盘上的文件和swap共存,还可以事先划定一定空间给swap,比如说newfs -R 200 /dev/rdsk/c0t1d0
# swapon /dev/dsk/c0t2d0:将整块磁盘设定为swap
# swapon -p 4 -l 4M /myfs1:指定将/myfs1设定为文件系统分区,-p参数是设定这个swap的优先权,-l参数确保swap的空间不超出4M
# swapon -a:启动/etc/fstab文件里面所有swap
46,安装光盘里面的patches,步骤如下:
1,对系统做全备份
2,# ioscan -funC disk(判断放入光驱里磁盘的名称)
3,# mkdir /patchCD(创建挂载点)
4,# mount /dev/dsk/cxtxdx /patchCD(执行挂载)
5,# ls /patchCD
6,more /patchCD/
7,swinstall -s /patchCD/GOLDQPK11i -x autoreboot=true -x patch_match_target=true
47,ndd相关命令
# ndd -get /dev/ip ip_check_subnet_addr:check the current value
# ndd -set /dev/ip ip_check_subnet_addr 0:enable all-0/all-1 subnets
# ndd -set /dev/ip ip_check_subnet_addr 1:disable all-0/all-1 subnets