- Sep 10 Mon 2012
Solaris常用查看系統狀態和資訊的命令(
1.showrev
查看系統Hostid: 24cc7225
Release: 5.9
Kernel architecture: i86pc
Application architecture: i386
Hardware provider: COMPAQ
Domain: sinomos.com
Kernel version: SunOS 5.9 Generic 112234-10 Nov 2003
showrev -p可以查看系統的安裝的補丁
2、vmstat監視cpu
iostat監視磁片
iostat -E現在磁片資訊,包括大小和錯誤數量,廠家等等
3、prtconf顯示系統資訊
4、prtdiag顯示系統cpu,記憶體,以及OBP
5、netstat -r路由資訊
netstat -i介面資訊
6、查看網卡狀態
ndd -get /dev/eri link_status or link_speed
7. isainfo -b 32 or 64
isainfo查看系統的平臺類型sparc or i386
8. prodreg圖形介面顯示安裝的軟體
9、prtvtoc /dev/rdsk/c0t0d0s2
/* Disk geometry and partitioning info *
10、dos2unix | -ascii <filename>;
/* Converts DOS file formats to Unix */
11、mailx -H -u <username>;
/* List out mail headers for specified user */
12、prtconf | grep "Memory size"
/* Display Memory Size */
13、prstat -a類似top的命令
14、Snoop Your Network
snoop -d pcelx0
/* Watch all network packets on device pcelx0 */
snoop -o /tmp/mylog pcelx0
/* Saves packets from device pcelx0 to a file */
snoop -i /tmp/mylog host1 host2
/* View packets from logfile between host1 & host2 */
snoop -i /tmp/mylog -v -p101
/* Show all info on packet number 101 from a logfile */
snoop -i /tmp/mylog -o /tmp/newlog host1
/* Write a new logfile with all host1 packets */
snoop -s 120
/* Return the first 120 bytes in the packet header */
snoop -v arp
/* Capture arp broadcasts on your network */
15、uname -a
顯示機器名以及機器的平臺,機器的型號
16、df -h顯示磁片使用方式
17、查看cpu詳細資訊psrinfo -v
18、whoami
who
finger
查看當前登陸使用者(大家運行下,看看有什麼區別)
19、fuser -cu /mountpoint,看當前有什麼進程和此檔案系統有關
fuser -ck /mountpoint,殺掉所有和此檔案系統有關的進程
20、查看磁片的分區情況:format---0(表硬碟控制器號)--partition--print
21、du -sk dir1 顯示目錄 dir1 的總容量,以k bytes為計量
22、id 查看當前使用者使用者號和組號
23、dfshares 顯示遠端機共用資源
24、pkginfo -l 命令顯示關於套裝軟體的詳細資訊,包括套裝軟體的大小
你用isainfo看完裡系統啟動的哪種kernel,你可能想進一步看看記憶體裡啟動了哪些kernel module:
# modinfo
Id Loadaddr Size Info Rev Module Name
0 1000000 b5760 - 0 unix ()
1 106c6d8 19e36 - 0 krtld ()
2 107feb0 180330 - 0 genunix ()
3 11b1528 a8 - 0 platmod ()
4 11b15c0 bd80 - 0 SUNW,UltraSPARC-II ()
6 11be000 44a0 1 1 specfs (filesystem for specfs)
...
看了kernel module啟動了,或許可能想進一步看看其資料結構:
# kstat |more
...
module: cpu_info instance: 2
name: cpu_info2 class: misc
chip_id 2
clock_MHz 450
cpu_type sparcv9
crtime 91.083890136
fpu_type sparcv9
implementation UltraSPARC-II
snaptime 23372.605727035
state on-line
state_begin 1083292792
...
看了資料結構,或許又關心下記憶體如何分配的,kernel占了多大:
# sar -k 1
SunOS u60 5.10 s10_54 sun4u 04/30/2004
17:11:35 sml_mem alloc fail lg_mem alloc fail ovsz_alloc fail
17:11:36 14107136 10459228 0 102178816 96087616 0 18350080 0
看了常駐記憶體的kernel,有想看看記憶體裡跑的程式有多少,程式的進程是那些,進程的執行緒有多少, 堆疊多大,進程開了那些檔:
# ps -ecL
PID LWP CLS PRI TTY LTIME CMD
0 1 SYS 96 ? 0:00 sched
1 1 TS 59 ? 0:00 init
2 1 SYS 98 ? 0:00 pageout
3 1 SYS 60 ? 0:16 fsflush
539 1 TS 59 ? 0:00 sac
323 1 TS 59 ? 0:00 utmpd
294 1 TS 59 ? 0:00 nscd
...
# ptree
74 /usr/lib/sysevent/syseventd
82 /usr/lib/crypto/kcfd
85 /usr/lib/picl/picld
198 /usr/lib/inet/in.ndpd
...
705 /usr/dt/bin/dtterm -session dt_jaWxb -C -ls
731 -csh
844 dic
1469 sh
1470 csh
1493 ptree
...
# pmap 824
824: /bin/ksh -p /usr/dt/appconfig/SUNWns/netscape
00010000 200K r-x-- /usr/bin/ksh
00052000 8K rwx-- /usr/bin/ksh
00054000 48K rwx-- [ heap ]
FF210000 328K r-x-- /usr/lib/locale/zh_CN.GB18030/zh_CN.GB18030.so.3
FF270000 8K rwx-- /usr/lib/locale/zh_CN.GB18030/zh_CN.GB18030.so.3
FF280000 840K r-x-- /lib/libc.so.1
FF362000 32K rwx-- /lib/libc.so.1
FF36A000 8K rwx-- /lib/libc.so.1
FF380000 8K r-x-- /usr/lib/locale/zh_CN.GB18030/methods_zh_CN.GB18030.so.3
FF390000 8K rwx-- /usr/lib/locale/zh_CN.GB18030/methods_zh_CN.GB18030.so.3
FF3AA000 8K rwxs- [ anon ]
FF3B0000 168K r-x-- /lib/ld.so.1
FF3EA000 8K rwx-- /lib/ld.so.1
FF3EC000 8K rwx-- /lib/ld.so.1
FF3F8000 16K r-x-- /platform/sun4u/lib/libc_psr.so.1
FFBFC000 16K rw--- [ stack ]
total 1712K
...
# pfiles -F 824
824: /bin/ksh -p /usr/dt/appconfig/SUNWns/netscape
Current rlimit: 256 file descriptors
0: S_IFCHR mode:0666 dev:286,0 ino:6815752 uid:0 gid:3 rdev:13,2
O_RDONLY|O_LARGEFILE
1: S_IFCHR mode:0620 dev:286,0 ino:4 uid:126158 gid:7 rdev:0,0
O_WRONLY|O_LARGEFILE
2: S_IFCHR mode:0620 dev:286,0 ino:4 uid:126158 gid:7 rdev:0,0
O_WRONLY|O_LARGEFILE
61: S_IFREG mode:0600 dev:293,2 ino:6185276 uid:126158 gid:10 size:0
O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE FD_CLOEXEC
62: S_IFREG mode:0755 dev:32,32 ino:57970 uid:0 gid:3 size:6312
O_RDONLY|O_LARGEFILE FD_CLOEXEC
...
看了程式/進程/執行緒/調用檔,你或許又要關心下當前系統對進程的分配調度規則,哪個先哪個後呢:
# dispadmin -l
CONFIGURED CLASSES
==================
SYS (System Class)
TS (Time Sharing)
FX (Fixed Priority)
IA (Interactive)
RT (Real Time)
FSS (Fair Share)
# priocntl -l
CONFIGURED CLASSES
==================
SYS (System Class)
TS (Time Sharing)
Configured TS User Priority Range: -60 through 60
IA (Interactive)
Configured IA User Priority Range: -60 through 60
...
看了調度規則,你可能想看看當前系統把那些CPU給那些進程了,還是所有進程共用呢:
# pooladm -e
# poolcfg -dc info
...
pset oracle-pset
int pset.sys_id 1
boolean pset.default false
...
看了CPU可能是共用的,這時看看個CPU的負載是否有不同呢:
# mpstat 1
CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl
0 0 0 200 402 302 139 53 1 0 0 150 100 0 0 0
1 0 0 0 102 100 83 0 3 0 0 105 2 0 0 98
2 0 0 0 118 104 85 0 1 0 0 26 1 1 0 98
如發現CPU負載有問題,有想去瞭解下有無記憶體給CPU用呢:
可用說的vmstat, 還可查下CPU在從記憶體讀資料時,對記憶體資料的命中率,100%?
# sar -b 1 100
SunOS u60 5.10 Generic_118822-08 sun4u 11/18/2005
14:20:45 bread/s lread/s %rcache bwrit/s lwrit/s %wcache pread/s pwrit/s
14:20:46 0 0 100 0 0 100 0 0
14:20:47 0 0 100 0 0 100 0 0
14:20:48 0 0 100 0 0 100 0 0
...
看了記憶體情況,心裡有點嘀咕,這系統關於記憶體是如何設的呢,何時把記憶體排不下的資料仍回到硬碟上的:
# netstat -k
...
system_pages:
physmem 63284 nalloc 11786054 nfree 11708436 nalloc_calls 5350 nfree_calls 4502
kernelbase 268435456 econtig 285212672 freemem 15428 availrmem 55955 lotsfree 977
cachefree 977 desfree 488 minfree 244 fastscan 8192 slowscan 100 nscan 0
desscan 25 pp_kernel 6089 pagesfree 15428 pageslocked 6579 pagestotal 62534
...
Solaris記憶體,為了速度,不是當CPU修改後立刻再寫回硬碟,而到一定程度,即Water Mark - bufhwm:
缺省約占2%的實體記憶體,如你想修改,又得看/etc/system的參數:
# more /etc/system
...
或直接debug:
# adb -k /dev/ksyms /dev/mem
...
看了記憶體關於讀寫硬碟,可能直接看I/O了:
包括你的iostat 和 netstat, 還有busstat, nfsstat:
# nfsstat -rc
Client rpc:
Connection oriented:
calls badcalls badxids timeouts newcreds badverfs
21203 0 0 0 0 0
目錄如使用SVM卷做的,還有:
# metastat
...
發現沒用SVM卷,可能是ZFS:
# zpool df testpool
Pool size used avail capacity
-------------------- ------ ------ ------ --------
testpool 500M 56.0K 500M 1%
上述所有東西,發現可能是系統管理員給你的虛擬的OS實例Zone,那可看看系統有幾個Zone呢:
# zoneadm list -cv
ID NAME STATUS PATH
0 global running /
1 cu running /a1000/cu
累死了,再看看系統裡有那些服務呢:
# svcs -a|more
STATE STIME FMRI
legacy_run 17:16:59 lrc:/etc/rcS_d/S29wrsmcfg
legacy_run 17:17:19 lrc:/etc/rc2_d/S10lu
legacy_run 17:17:19 lrc:/etc/rc2_d/S20sysetup
legacy_run 17:17:19 lrc:/etc/rc2_d/S40llc2
legacy_run 17:17:19 lrc:/etc/rc2_d/S42ncakmod
legacy_run 17:17:19 lrc:/etc/rc2_d/S47pppd
...
disabled 17:15:25 svc:/system/metainit:default
disabled 17:15:25 svc:/platform/sun4u/mpxio-upgrade:default
disabled 17:15:26 svc:/network/ipfilter:default
...
online 17:17:38 svc:/milestone/multi-user-server:default
online 17:17:38 svc:/system/zones:default
offline 17:15:27 svc:/application/print/ipp-listener:default
offline 17:17:14 svc:/application/print/rfc1179:default
maintenance 17:17:20 svc:/network/ssh:default
...
看看系統裡有那些加密方法呢,位數多少:
# cryptoadm list -m
使用者級別的提供者:
=====================
Provider: /usr/lib/security/$ISA/pkcs11_kernel.so
無可用插槽。
Provider: /usr/lib/security/$ISA/pkcs11_softtoken.so
機制:
CKM_DES_CBC
CKM_DES_CBC_PAD
CKM_DES_ECB
CKM_DES_KEY_GEN
CKM_DES_MAC_GENERAL
...
內核軟體提供者:
==========================
des: CKM_DES_ECB,CKM_DES_CBC,CKM_DES3_ECB,CKM_DES3_CBC
aes: CKM_AES_ECB,CKM_AES_CBC
arcfour: CKM_RC4
blowfish: CKM_BF_ECB,CKM_BF_CBC
sha1: CKM_SHA_1,CKM_SHA_1_HMAC,CKM_SHA_1_HMAC_GENERAL
md5: CKM_MD5,CKM_MD5_HMAC,CKM_MD5_HMAC_GENERAL
rsa: CKM_RSA_PKCS,CKM_RSA_X_509,CKM_MD5_RSA_PKCS,CKM_SHA1_RSA_PKCS
swrand: No mechanisms presented.
內核硬體提供者:
==========================
# mac -l
Algorithm Keysize: Min Max (bits)
------------------------------------------
des_mac 64 64
sha1_hmac 8 512
md5_hmac 8 512
# encrypt -l
演算法 金鑰大小: 最小 最大 (位)
------------------------------------------
aes 128 128
arcfour 8 128
des 64 64
3des 192 192
。。。
又想看看某些目錄裡的檔,被人修改了嗎,可和以前的存檔對比下:
# bart compare etc-2005-05-20 etc2005-05-30
使用者的程式被允許運行了嗎,儘管其擁有權力,但可能沒分配,檢查下:
# elfsign verify -e /oracle/xx
BloggerAds


Google ads
Google ads
文章分類


Android (35)
iPhone (22)
Windows Mobile (5)
網頁設計 (17)
程式開發 (15)
DATABASE (13)
黑客密碼 (15)
FLASH (22)
Linux (15)
美工繪圖 (3)
Symbian (2)
商業課程 (9)
visual studio 2012 (1)
車族世界 (2)
動漫資訊 (14)
QR Code

沒有留言:
張貼留言