iftop 能即時監控伺服器各端口的流量,以下示範以編譯方式安裝。
1. 下載原始碼:
wget https://www.ex-parrot.com/~pdw/iftop/download/iftop-1.0pre4.tar.gz
2. 解壓並進入目錄:
tar -xvf iftop-1.0pre4.tar.gz cd iftop-1.0pre4 ls

3. 編譯安裝(指定安裝到 /usr/soft/iftop/):
./configure --prefix=/usr/soft/iftop/ make make install

安裝完成後,直接執行 iftop(可帶參數)即可進行流量監控。

前提是系統已具備編譯環境(gcc、perl、python、glibc、make、automake 等)。大多數 tar.gz 或 tar.bz2 打包的軟體,透過 ./configure、make、make install 三步驟即可安裝;少數軟體沒有 configure,直接 make 即可。
其中 --prefix 參數相當重要,可用來指定安裝目錄,日後不需要時直接刪除該目錄即可。
./configure --prefix=/usr/soft/iftop