1、前言
Top 在 Solaris 10 沒有內建因此我們必須另外安裝,Top 套件能夠動態提供系統行程 (Process) 資訊、CPU 使用率、負載狀態....等,預設為 5 秒更新畫面。文章目錄
1、前言2、實作環境
3、安裝及設定
步驟1.下載 top 套件
步驟2.安裝 top 套件
步驟3.操作 top
4、補充、安裝/查詢/移除 套件
2、實作環境
- SunOS 5.10 (Solaris 10) i386
- top-3.6
3、安裝及設定
步驟1.下載 top 套件
執行如下指令,以便下載 top 套件。# ftp ftp.sunfreeware.com //連接到 sunfreeware
Connected to sunfreeware.com.
220 ftp.sunfreeware.com FTP server ready.
Name (ftp.sunfreeware.com:weithenn): anonymous //輸入登入帳號 (匿名)
331 Guest login ok, send your complete e-mail address as password.
Password: //不用密碼直接按 Enter 即可登入
230-
230-=================================
230-This is the ftp.sunfreeware.com ftp server
230-
230-If you have not already done so, make sure
230-you have read the Downloading/Installation,
230-FAQ, and Disclaimer links on
230-http://sunfreeware.com.
230-
230-This is a restricted access system. All
230-transfers are logged. If you disagree
230-with this practice, log off now.
230-
230-Questions go to Steve Christensen at
230-the address given on sunfreeware.com.
230-=================================
230-
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> cd /pub/freeware/i386/5.10 //切換到 Solaris 10 x86 套件目錄
250 CWD command successful.
ftp> ls -al //列出所有套件
ftp> get top-3.6-sol10-x86-local.gz //下載 top 套件(在目前的目錄下)
200 PORT command successful.
150 Opening BINARY mode data connection for top-3.6-sol10-x86-local.gz (117461 bytes).
226 Transfer complete. //顯示下載套件成功
local: top-3.6-sol10-x86-local.gz remote: top-3.6-sol10-x86-local.gz
117461 bytes received in 1.5 seconds (74.48 Kbytes/s)
ftp> quit //離開 sunfreeware
221-You have transferred 117461 bytes in 1 files.
221-Total traffic for this session was 162098 bytes in 2 transfers.
221-Thank you for using the FTP service on ftp.sunfreeware.com.
221 Goodbye.
步驟2.安裝 top 套件
依序執行如下指令,以安裝 top 套件。# cd /export/home/weithenn/software //切換到套件下載路徑
# gzip -d top-3.6-sol10-x86-local.gz //解壓縮 top 套件
# pkgadd -d top-3.6-sol10-x86-local //安裝 top 套件
The following packages are available:
1 SMCpstree top
(x86) 3.6
Select package(s) you wish to process (or 'all' to process all packages). (default: all) [?,??,q]: //預設全裝
Processing package instance <SMCtop> from </export/home/weithenn/software/top-3.6-sol10-x86-local>
top(x86) 3.6
LeFebvre et al
The selected base directory </usr/local> must exist before installation is attempted.
Do you want this directory created now [y,n,?,q] y //輸入 y 開始安裝
Using </usr/local> as the package base directory.
## Processing package information.
## Processing system information.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
## Checking for setuid/setgid programs.
Installing top as <SMCtop>
## Installing part 1 of 1.
/usr/local/bin/amd64/top
/usr/local/bin/i386/top
/usr/local/bin/top //top 執行檔安裝路徑
/usr/local/doc/top/Changes
/usr/local/doc/top/FAQ
/usr/local/doc/top/INSTALL
/usr/local/doc/top/LICENSE
/usr/local/doc/top/README //top 參考文件路徑
/usr/local/doc/top/Y2K
/usr/local/man/man1/top.1/top.1
[ verifying class <none> ]
Installation of <SMCtop> was successful. //顯示安裝 top 成功
步驟3.操作 top
安裝完成後無法直接使用因為 top 執行檔是裝在 /usr/loca/bin 目錄下,而我們 PATH 內通常未指定該路徑,所以修改 /export/home/weithenn/local.cshrc 把路徑如入吧。# vi /export/home/weithenn/local.cshrc
set path=(/bin /usr/bin /usr/sbin /usr/local/bin /usr/ucb /etc .) //加入/usr/local/bin
# echo $PATH
/usr/bin
# source /export/home/weithenn/local.cshrc //更新環境變數
# echo $PATH
/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/ucb:/etc:.
執行 top 指令 (預設五秒更新,可配合參數 -d time(秒)、-n number(顯示行數)。
# top
last pid: 1992; load avg: 0.01, 0.01, 0.00; up 0+21:18:38 12:23:56
52 processes: 51 sleeping, 1 on cpu
CPU states: 99.2% idle, 0.0% user, 0.8% kernel, 0.0% iowait, 0.0% swap
Memory: 512M phys mem, 288M free mem, 518M swap, 518M free swap
PID USERNAME LWP PRI NICE SIZE RES STATE TIME CPU COMMAND
1992 root 1 59 0 1912K 1184K cpu 0:00 0.23% top
931 root 17 59 0 107M 42M sleep 4:12 0.16% java
430 root 1 59 0 16M 18M sleep 1:04 0.07% Xorg
634 root 5 59 0 8008K 5852K sleep 0:05 0.06% dtwm
1 root 1 59 0 2024K 1096K sleep 0:00 0.04% init
628 root 3 59 0 9880K 5736K sleep 0:28 0.03% dtsession
1872 weithenn 1 59 0 7072K 1848K sleep 0:00 0.02% sshd
7 root 12 59 0 8996K 8112K sleep 0:06 0.01% svc.startd
342 root 15 59 0 10M 6732K sleep 0:01 0.01% fmd
9 root 15 59 0 8988K 8080K sleep 0:13 0.01% svc.configd
1524 root 25 59 0 3400K 2444K sleep 0:03 0.00% nscd
305 root 1 59 0 1064K 608K sleep 0:00 0.00% utmpd
506 root 1 59 0 6664K 2052K sleep 0:03 0.00% sendmail
1417 root 1 39 10 3828K 1812K sleep 0:02 0.00% dtscreen
4、補充、安裝/查詢/移除 套件
剛才去找了一下 sunfreeware 也有 Taiwan Anonymous FTP Mirror Sites 這樣就不用每次抓套件就出國比賽了。進入後路徑都在 freeware/i386/10 下。1.列出安裝套件的概要資訊
# pkginfo | grep top
application SMCtop top
2. 列出安裝套件的詳細資訊
# pkginfo -l SMCtop
PKGINST: SMCtop
NAME: top
CATEGORY: application
ARCH: x86
VERSION: 3.6
BASEDIR: /usr/local
VENDOR: LeFebvre et al
PSTAMP: Steve Christensen
INSTDATE: May 25 2007 11:26
EMAIL: steve@smc.vnet.net
STATUS: completely installed
FILES: 18 installed pathnames
2 shared pathnames
8 directories
3 executables
538 blocks used (approx)
3.移除套件
# pkgrm SMCtop //移除 top 套件
The following package is currently installed:
SMCtop top
(x86) 3.6
Do you want to remove this package? [y,n,?,q] y //輸入 y 後確定移除
## Removing installed package instance <SMCtop>
## Verifying package <SMCtop> dependencies in global zone
## Processing package information.
## Removing pathnames in class <none>
/usr/local/man/man1/top.1/top.1
/usr/local/man/man1/top.1
/usr/local/man/man1
/usr/local/man
/usr/local/doc/top/Y2K
/usr/local/doc/top/README
/usr/local/doc/top/LICENSE
/usr/local/doc/top/INSTALL
/usr/local/doc/top/FAQ
/usr/local/doc/top/Changes
/usr/local/doc/top
/usr/local/doc
/usr/local/bin/top
/usr/local/bin/i386/top
/usr/local/bin/i386
/usr/local/bin/amd64/top
/usr/local/bin/amd64
/usr/local/bin
## Updating system information.
Removal of <SMCtop> was successful.