1、如何查看cpu的状态?
# psrinfo -v (root权限)
- # psrinfo -v
- Status of virtual processor 0 as of: 03/20/2012 17:16:26
- on-line since 03/19/2012 13:37:54.
- The i386 processor operates at 3000 MHz,
- and has an i387 compatible floating point processor.
- Status of virtual processor 1 as of: 03/20/2012 17:16:26
- on-line since 03/19/2012 13:37:59.
- The i386 processor operates at 3000 MHz,
- and has an i387 compatible floating point processor.
# mpstat 可以列出多cpu负载的状态
- # mpstat
- CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
- 0 13 0 3 473 173 299 4 19 3 0 5095 1 0 0 99
- 1 14 0 2 244 59 328 4 19 2 0 4851 1 0 0 99
# 显示cpu使用率最高的进程
- # ps -eo pid,pcpu,args | sort +1n
- 0 0.0 sched
- 1 0.0 /usr/sbin/init
- 2 0.0 pageout
- 3 0.0 fsflush
- 5 0.0 zpool-rpool
- 6 0.0 kmem_task
- 7 0.0 intrd
- 8 0.0 vmtasks
# 显示内存占用率最高的进程
- # ps -eo pid,vsz,args | sort +1n
- 0 0 sched
- 2 0 pageout
- 3 0 fsflush
- 5 0 zpool-rpool
- 6 0 kmem_task
- 7 0 intrd
- 8 0 vmtasks
- 184 0 zpool-myrpool
- 878 0 nfs4cbd_kproc
- 883 0 lockd_kproc
- PID VSZ COMMAND
- 2008 0 nfsd_kproc
- .........
# 显示当前的运行级别
- # who -rH
- NAME LINE TIME IDLE PID COMMENTS
- . run-level 3 Mar 8 15:48 3 0 S
# 显示当前用户信息
- # who am i
# 获得系统信息
- # uname -X
- System = SunOS
- Node = ${HOSTNAME}
- Release = 5.11
- KernelID = 11.1
- Machine = sun4v
- BusType = <unknown>
- Serial = <unknown>
- Users = <unknown>
- OEM# = 0
- Origin# = 1
- NumCPU = 16
# 网卡的信息
- # netstat -np
- Net to Media Table: IPv4
- Device IP Address Mask Flags Phys Addr
- ------ -------------------- --------------- -------- ---------------
- net0 10.113.193.238 255.255.255.255 SPLA 00:14:4f:2a:97:e0
- net0 10.113.193.227 255.255.255.255 00:03:ba:51:b6:59
- net0 10.113.193.231 255.255.255.255 00:14:4f:2a:cc:42
- net0 10.113.193.221 255.255.255.255 00:14:4f:1f:cf:04
- net0 10.113.193.211 255.255.255.255 00:1e:68:04:43:ee
- net0 10.113.193.202 255.255.255.255 00:c0:9f:49:d8:ee
- net0 10.113.193.32 255.255.255.255 00:09:3d:13:c1:ec
- net0 10.113.193.33 255.255.255.255 00:23:8b:76:e9:92
- net0 10.113.193.29 255.255.255.255 00:14:4f:3e:98:6f
- net0 10.113.193.2 255.255.255.255 00:d0:00:65:ec:00
- net0 10.113.193.3 255.255.255.255 00:d0:02:d4:30:00
- net0 10.113.193.1 255.255.255.255 00:00:0c:07:ac:c1
- net0 10.113.193.75 255.255.255.255 00:0c:29:88:c6:74
- kstat -c net|grep name
- name: chipid class: net
- name: driverinfo class: net
- name: phydata class: net
- name: phys class: net
- name: statistics class: net
- name: chipid class: net
- name: driverinfo class: net
- name: phydata class: net
- name: phys class: net
- name: statistics class: net
- name: chipid class: net
- name: driverinfo class: net
- name: phydata class: net
- name: phys class: net
- name: statistics class: net
- name: chipid class: net
- name: driverinfo class: net
- name: phydata class: net
- name: phys class: net
- name: statistics class: net
- name: mac_rx_hwlane0 class: net
- name: mac_rx_ring0 class: net
- name: mac_rx_hwlane0 class: net
- name: mac_rx_ring0 class: net
- name: mac_rx_hwlane0 class: net
- name: mac_rx_hwlane1 class: net
- name: mac_rx_hwlane2 class: net
- name: mac_rx_hwlane3 class: net
- name: mac_rx_ring0 class: net
- name: mac_rx_ring1 class: net
- name: mac_rx_ring2 class: net
- name: mac_rx_ring3 class: net
- name: mac_rx_hwlane0 class: net
- name: mac_rx_hwlane1 class: net
- name: mac_rx_hwlane2 class: net
- name: mac_rx_hwlane3 class: net
- name: mac_rx_ring0 class: net
- name: mac_rx_ring1 class: net
- name: mac_rx_ring2 class: net
- name: mac_rx_ring3 class: net
- name: ip6stat class: net
- name: ipdrop class: net
- name: ipsec_stat class: net
- name: ipstat class: net
- name: inbound class: net
- name: outbound class: net
- name: ah_stat class: net
- name: esp_stat class: net
- name: net0 class: net
- name: net1 class: net
- name: net2 class: net
- name: net3 class: net
- name: net4 class: net
- name: lo0 class: net
- name: link class: net
- name: link class: net
- name: link class: net
- name: link class: net
- name: sctpstat class: net
- name: sdpstat class: net
- name: strstat class: net
- name: tcpstat class: net
- name: tcpstat_g class: net
- name: udpstat class: net
- name: phys class: net
- name: link class: net
2、如何查看内存?
# prtconf | grep 'Memory' 可以查看内存的多少. (root权限)
- # prtconf | grep 'Memory'
- Memory size: 3932 Megabytes
# /usr/platform/sun4v/sbin/prtdiag | grep 'Memory'
- # /usr/platform/sun4v/sbin/prtdiag
- System Configuration: Oracle Corporation sun4v Sun Fire(TM) T1000
- Memory size: 1852 Megabytes
- ================================ Virtual CPUs ================================
- CPU ID Frequency Implementation Status
- ------ --------- ---------------------- -------
- 0 1000 MHz SUNW,UltraSPARC-T1 on-line
- 1 1000 MHz SUNW,UltraSPARC-T1 on-line
- 2 1000 MHz SUNW,UltraSPARC-T1 on-line
- 3 1000 MHz SUNW,UltraSPARC-T1 on-line
- 4 1000 MHz SUNW,UltraSPARC-T1 on-line
- 5 1000 MHz SUNW,UltraSPARC-T1 on-line
- 6 1000 MHz SUNW,UltraSPARC-T1 on-line
- 7 1000 MHz SUNW,UltraSPARC-T1 on-line
- 8 1000 MHz SUNW,UltraSPARC-T1 on-line
- 9 1000 MHz SUNW,UltraSPARC-T1 on-line
- 10 1000 MHz SUNW,UltraSPARC-T1 on-line
- 11 1000 MHz SUNW,UltraSPARC-T1 on-line
- 12 1000 MHz SUNW,UltraSPARC-T1 on-line
- 13 1000 MHz SUNW,UltraSPARC-T1 on-line
- 14 1000 MHz SUNW,UltraSPARC-T1 on-line
- 15 1000 MHz SUNW,UltraSPARC-T1 on-line
- ========================= IO Configuration =========================
- IO
- Location Type Slot Path Name Model
- ----------- ----- ---- --------------------------------------------- ------------------------- ----------
- MB/NET0 PCIE MB /pci@7c0/pci@0/network@4 network-pci14e4,1668
- MB/NET1 PCIE MB /pci@7c0/pci@0/network@4,1 network-pci14e4,1668
- MB/NET2 PCIX MB /pci@7c0/pci@0/pci@8/network@1 network-pci108e,1648
- MB/NET3 PCIX MB /pci@7c0/pci@0/pci@8/network@1,1 network-pci108e,1648
- MB/PCIX PCIX MB /pci@7c0/pci@0/pci@8/scsi@2 scsi-pci1000,50 LSI,1064
3、如何动态添加swap分区?
# $su - root ----- 成为超级用户
# mkfile 100m /home/swapfile ----- 创建100m的Swap文件
# /usr/sbin/swap -a /path/filename ----- 激活Swap文件
# /usr/sbin/swap -l ----- 验证swap文件
# /usr/sbin/swap -d /path/filename ----- 取消swap文件
# rm -rf /home/swapfile ----- 删除swap文件
4、如何查看当前网卡是以何种速率起来的?
# dmesg |grep link
- # dmesg | grep link
- .[ID 435574 kern.info] NOTICE: e1000g0 link up, 100 Mbps, full duplex
5、如何使用光、软驱?
一般情况下用:
# /etc/init.d/volmgt start
# volcheck
以上方法不行,用:
# /etc/init.d/volmgt stop
# mount -F hsfs -o ro /dev/dsk/c0t6d0s0 /cdrom --挂接光驱
# mount -F pcfs /dev/diskette0 /floppy --挂接软驱
solaris定义系统磁盘文件系统说明:
ufs – UNIX文件系统。
zfs - 是Solaris缺省的文件系统。
hsfs – 高密度CD-ROM文件系统,是只读文件系统。
pcfs – PC文件系统,支持DOS格式化的软盘
6、SCSI设备的命名规则是什么?
带有总线控制器的硬盘的使用,下面列出了总线控制器的硬盘命名习惯:
cWtXdYsZ
c Logical controller number
t Physical bus target number
d Drive number
s Slice (or partition) number (0 to 7)
例如:
/dev/rdsk/c0t0d0s0 该原始接口对应第一个控制器的第一个SCSI目标地址的第一个硬盘的第一片(根)
/dev/rdsk/c0t0d0s2 该原始接口对应第一个控制器的第一个SCSI目标地址上的第一个硬盘的第三片(表示整上硬盘)
7、如何查看硬盘的使用情况?
# df -k 可以看到已安装的文件系统的空间大小及剩余空间大小。
# quota -v 查看用户的磁盘空间信息,如果你用quota限制了用户空间大小的话。
# du -sk * 查看目录的使用情况
# du -k | sort -n 可以迅速发现那个目录是最大的。
8、如何查看硬盘物理信息?
# format 这个命令也可以查看硬盘的类型和分区的详细情况
- # format
- Searching for disks...done
- AVAILABLE DISK SELECTIONS:
- 0. c2t0d0 <SUN80G cyl 65533 alt 2 hd 16 sec 149>
- /pci@7c0/pci@0/pci@8/scsi@2/sd@0,0
# iostat -E 看硬盘的大小和型号
- # iostat -E
- sd1 Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
- Vendor: ATA Product: HITACHI HDS7280S Revision: A6CA Serial No:
- Size: 80.03GB <80026361856 bytes>
- Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
- Illegal Request: 295 Predictive Failure Analysis: 0
# prtvtoc /dev/rdsk/c0t0d0s0 显示某个磁盘的分区状况
- # prtvtoc /dev/dsk/c2t0d0s0
- * /dev/dsk/c2t0d0s0 partition map
- *
- * Dimensions:
- * 512 bytes/sector
- * 149 sectors/track
- * 16 tracks/cylinder
- * 2384 sectors/cylinder
- * 65535 cylinders
- * 65533 accessible cylinders
- *
- * Flags:
- * 1: unmountable
- * 10: read-only
- *
- * Unallocated space:
- * First Sector Last
- * Sector Count Sector
- * 0 2384 2383
- *
- * First Sector Last
- * Partition Tag Flags Sector Count Sector Mount Directory
- 0 2 00 2384 156228288 156230671
- 2 5 01 0 156230672 156230671
9、查看系统内核命令。
# isainfo 看内核的bit,
# isainfo -kv 调整内核
# modinfo 显示可载入的模组
# prtconf 显示系统硬件配置(周边设备)
#sysdef 显示可载入的模组,硬件配置与一些可以调整的核心参考值
#ulimit -a
10、打印当前的OBP版本号
# prtconf -V
- # prtconf -V
- OBP 4.27.7 2007/10/24 08:23
# /usr/platform/sun4v/sbin/prtdiag –v | grep OBP
- # /usr/platform/sun4v/sbin/prtdiag -v | grep OBP
- OBP 4.27.7 2007/10/24 08:23
11、查看及启动系统的64位内核模式
64位模式
# isalist –v
sparcv9+vis sparcv9 sparcv8plus+vis sparcv8plus sparcv8 sparcv8-fsmuld sparcv7 sparc
# isainfo –v
64-bit sparcv9 applications
32-bit sparc applications
# isainfo –b
64
12、如何配置网卡ip?
# ifconfig -a --查看网卡,例如是hme0
# ifconfig hme0 unplumb --停止网卡
# ifconfig hme0 plumb --起用网卡
# ifconfig hme0 inet 192.168.2.3 netmask 255.255.255.0 up --添加ip、子网掩码
# vi /etc/defaultrouter 添加默认路由的ip
# vi /etc/hostname.hme0 添加主机名
# vi /etc/nodename 添加主机名
# vi /etc/resolv.conf
domain china.com 你的域名
nameserver 202.106.0.20 你使用的nds ip
# vi /etc/nsswitch.conf 更改 hosts:file dns
# vi /etc/hosts
# getent hosts $HOSTNAME
13、 PROM状态命令与参数
格式: OK> 指令
命令 说明
banner 显示当前机器配置状况,CPU,内存,hostid,EtherNet
probe-scsi 显示内部SCSI通道所挂接设备
probe-scsi-all 显示所有SCSI通道及所挂接设备
probe-ide 显示所有IDE通道及所挂接设备(针对U10,U5)
devalias 显示设备别名,如 cdrom,disk,disk0,disk1等
printenv 无参数,显示环境变量或
参数为环境变量名 如: printenv auto-boot?
setenv 设置环境变量,如: setenv auto-boot? false
set-default 恢复环境变量预定值 如:set-default auto-boot?
set-defaults 恢复所有环境变量预定值
boot device option 启动主机
设备别名: cdrom 或 disk
设备名: /pci@1f,4000/scsi@3,1/disk@6,0:f
option -r 设备配置
-s 单用户
eject cdrom|floppy 弹出cdrom或floppy
reset 复位
test net
watch-net-all
show-devs
14、查找网卡名称及接口个数
# grep network /etc/path_to_inst
- # grep network /etc/path_to_inst
- "/pci@7c0/pci@0/pci@8/network@1" 2 "bge"
- "/pci@7c0/pci@0/pci@8/network@1,1" 3 "bge"
- "/pci@7c0/pci@0/network@4" 0 "bge"
- "/pci@7c0/pci@0/network@4,1" 1 "bge"
- "/virtual-devices@100/channel-devices@200/virtual-network-switch@0" 0 "vsw"
本文出自 “LinuxLeon” 博客,请务必保留此出处http://leonkuo.blog.51cto.com/3133504/811626