別只會測手機!Linux 性能跑分全攻略
很多人一提“跑分”,腦子里立刻想到的就是手機測安兔兔、電腦跑個 3DMark——要么是 Windows,要么是安卓。 可你知道嗎?在 Linux 里也能跑分,而且不只是測個“分數”那么簡單。它能幫你摸清服務器的 CPU、內存、磁盤、網絡到底有多能打,甚至能精準定位性能瓶頸。 這篇文章,我們就用最接地氣的方式,帶你認識幾款常用的 Linux 跑分工具,讓你不再只會看手機分數,也能玩轉服務器性能測試。
![]()
img 一、使用 nench
nench 會自動測試:
CPU 性能、磁盤 I/O 讀寫速度、網絡下載速度(測速多個區域)
curl -sL wget.racing/nench.sh | bash 或者 curl -sL https://gitee.com/funet8/Rocky-Linux-Shell/raw/main/monitor/nench.sh | bashnench顯示結果[root@node3 ~]# curl -sL wget.racing/nench.sh | bash ------------------------------------------------- nench.sh v2019.07.20 -- https://git.io/nench.sh benchmark timestamp: 2025-09-18 06:20:18 UTC ------------------------------------------------- Processor: 11th Gen Intel(R) Core(TM) i7-11390H @ 3.40GHz CPU cores: 2 Frequency: 3417.606 MHz RAM: 3.5Gi Swap: 2.0Gi Kernel: Linux 5.14.0-570.22.1.el9_6.x86_64 x86_64 Disks: nvme0n1 100G SSD nvme0n2 100G SSD CPU: SHA256-hashing 500 MB 0.471 seconds CPU: bzip2-compressing 500 MB CPU: AES-encrypting 500 MB 0.582 seconds ioping: seek rate ioping: sequential read speed dd: sequential write speed 1st run: 613.21 MiB/s 2nd run: 2193.45 MiB/s 3rd run: 2193.45 MiB/s average: 1666.70 MiB/s IPv4 speedtests your IPv4: 14.155.113.xxxx Cachefly CDN: 0.00 MiB/s Leaseweb (NL): 0.02 MiB/s Softlayer DAL (US): 0.00 MiB/s Online.net (FR): 6.91 MiB/s OVH BHS (CA): 0.21 MiB/s No IPv6 connectivity detected -------------------------------------------------二、使用 bench.sh服務器硬件+網速+硬盤
curl -sL https://gitee.com/funet8/Rocky-Linux-Shell/raw/main/monitor/bench.sh| bash 源文件來自:https://raw.githubusercontent.com/teddysun/across/refs/heads/master/bench.shbench測試結果curl -sL https://raw.githubusercontent.com/teddysun/across/refs/heads/master/bench.sh | bash -------------------- A Bench.sh Script By Teddysun ------------------- Version : v2025-05-08 Usage : wget -qO- bench.sh | bash ---------------------------------------------------------------------- CPU Model : 11th Gen Intel(R) Core(TM) i7-11390H @ 3.40GHz CPU Cores : 2 @ 3417.606 MHz CPU Cache : 12288 KB AES-NI : ? Enabled VM-x/AMD-V : ? Disabled Total Disk : 197.7 GB (5.7 GB Used) Total Mem : 3.5 GB (606.1 MB Used) Total Swap : 2.0 GB (0 Used) System uptime : 1 days, 7 hour 8 min Load average : 0.00, 0.03, 0.08 OS : Rocky Linux release 9.6 (Blue Onyx) Arch : x86_64 (64 Bit) Kernel : 5.14.0-570.22.1.el9_6.x86_64 TCP CC : cubic Virtualization : VMware IPv4/IPv6 : ? Online / ? Offline Organization : AS4134 CHINANET-BACKBONE Location : Shenzhen / CN Region : Guangdong ---------------------------------------------------------------------- I/O Speed(1st run) : 1.0 GB/s I/O Speed(2nd run) : 1.6 GB/s I/O Speed(3rd run) : 1.6 GB/s I/O Speed(average) : 1433.6 MB/s ---------------------------------------------------------------------- Node Name Upload Speed Download Speed Latency Paris, FR 105.06 Mbps 577.33 Mbps 223.35 ms Amsterdam, NL 65.13 Mbps 6.85 Mbps 256.49 ms Shanghai, CN 97.54 Mbps 482.40 Mbps 32.10 ms Hong Kong, CN 4.50 Mbps 5.25 Mbps 11.61 ms Tokyo, JP 79.18 Mbps 689.46 Mbps 115.56 ms ---------------------------------------------------------------------- Finished in : 4 min 30 sec Timestamp : 2025-09-18 16:22:21 CST ----------------------------------------------------------------------三、使用 superspeed測速(結果報錯)開源地址: https://github.com/i-abc/Speedtest
國內主要運營商(電信/聯通/移動)速度
多個區域的 ping 值
這個文件已經找不到了:curl -fsSL https://bench.im/speedtest.sh | bash curl -sL https://gitee.com/funet8/Rocky-Linux-Shell/raw/main/monitor/speedtest.sh| bash 源文件: bash <(curl -sL https://raw.githubusercontent.com/i-abc/Speedtest/main/speedtest.sh)測試結果sha256sum: ./sp-github-i-abc/speedtest-cli.tgz: No such file or directory sha256sum: ./sp-github-i-abc/bim-core: No such file or directory sha256sum: ./sp-github-i-abc/speedtest-go.tar.gz: No such file or directory sha256sum: ./sp-github-i-abc/librespeed-cli.tar.gz: No such file or directory 經檢測,speedtest-cli的SHA-256與官方不符,方便的話歡迎到GitHub反饋報錯原因: https://github.com/i-abc/Speedtest/issues/19
四、網絡質量測速Speedtest
# 安裝 speedtest-cli(Ubuntu/Debian) sudo apt install -y speedtest-cli # 安裝 speedtest-cli(CentOS/RHEL) sudo yum install -y speedtest-cli # 運行測試 speedtest-cli測試結果speedtest-cli Retrieving speedtest.net configuration... Testing from China Telecom (X.X.X.X)... Retrieving speedtest.net server list... Selecting best server based on ping... Hosted by Chunghwa Mobile (Changhua) [679.03 km]: 176.978 ms Testing download speed................................................................................ Download: 0.07 Mbit/s Testing upload speed...................................................................................................... Upload: 0.41 Mbit/s五. 使用 Geekbench專業 CPU 跑分,一行命令
wget -qO- http://cdn.geekbench.com/Geekbench-6.2.2-Linux.tar.gz | tar xz --strip-components=1 && ./geekbench6測試結果
wget -qO- http://cdn.geekbench.com/Geekbench-6.2.2-Linux.tar.gz | tar xz --strip-components=1 && ./geekbench6 Geekbench 6.2.2 : https://www.geekbench.com/ Geekbench 6 requires an active internet connection and automatically uploads benchmark results to the Geekbench Browser. Upgrade to Geekbench 6 Pro to enable offline use and unlock other features: https://store.primatelabs.com/v6 Enter your Geekbench 6 Pro license using the following command line: ./geekbench6 --unlock System Information Operating System Rocky Linux 9.6 (Blue Onyx) Kernel Linux 5.14.0-570.22.1.el9_6.x86_64 x86_64 Model VMware, Inc. VMware Virtual Platform Motherboard Intel Corporation 440BX Desktop Reference Platform BIOS Phoenix Technologies LTD 6.00 CPU Information Name Intel Core i7-11390H Topology 2 Processors, 2 Cores Identifier GenuineIntel Family 6 Model 140 Stepping 2 Base Frequency 3.42 GHz L1 Instruction Cache 32.0 KB L1 Data Cache 48.0 KB L2 Cache 1.25 MB L3 Cache 12.0 MB Memory Information Size 3.54 GB Single-Core Running File Compression Running Navigation Running HTML5 Browser Running PDF Renderer Running Photo Library Running Clang Running Text Processing Running Asset Compression Running Object Detection Running Background Blur Running Horizon Detection Running Object Remover Running HDR Running Photo Filter Running Ray Tracer Running Structure from Motion Multi-Core Running File Compression Running Navigation Running HTML5 Browser Running PDF Renderer Running Photo Library Running Clang Running Text Processing Running Asset Compression Running Object Detection Running Background Blur Running Horizon Detection Running Object Remover Running HDR Running Photo Filter Running Ray Tracer Running Structure from Motion Uploading results to the Geekbench Browser. This could take a minute or two depending on the speed of your internet connection. Upload succeeded. Visit the following link and view your results online: https://browser.geekbench.com/v6/cpu/13890045 Visit the following link and add this result to your profile: 訪問結果 https://browser.geekbench.com/v6/cpu/13890045/claim?key=354758 六、查看內存占用工具ps_memhttps://github.com/pixelb/ps_mem
使用
wget https://raw.githubusercontent.com/pixelb/ps_mem/master/ps_mem.py python ps_mem.py 或者 wget -qO- https://raw.githubusercontent.com/pixelb/ps_mem/master/ps_mem.py | python3效果root@developer:~# wget -qO- https://raw.githubusercontent.com/pixelb/ps_mem/master/ps_mem.py | python3 Private + Shared = RAM used Program 128.0 KiB + 15.5 KiB = 143.5 KiB fusermount3 96.0 KiB + 72.5 KiB = 168.5 KiB lightdm-greeter 100.0 KiB + 72.5 KiB = 172.5 KiB Xtigervnc-sessi 中間省略...... 27.7 MiB + 5.8 MiB = 33.5 MiB Xorg 35.9 MiB + 0.5 KiB = 35.9 MiB snapd 13.6 MiB + 23.7 MiB = 37.2 MiB systemd-journald 28.3 MiB + 9.3 MiB = 37.6 MiB xfwm4 46.9 MiB + 8.0 MiB = 54.9 MiB xfdesktop 82.8 MiB + 9.6 MiB = 92.3 MiB Xtigervnc --------------------------------- 849.4 MiB =================================七、綜合跑分UnixBench輸出包含多項子測試及綜合評分,數值越高性能越好。
# 安裝依賴 sudo apt install -y build-essential perl # 獲取源碼 git clone https://github.com/kdlucas/byte-unixbench.git cd byte-unixbench/UnixBench # 編譯并運行 make ./Run八、CPU 跑分:sysbench關注 events per second(越高越好)和 total time(越短越好)。
# 安裝 sudo apt install -y sysbench # 測試 CPU(計算 20000 以內素數) sysbench cpu --cpu-max-prime=20000 run九、磁盤 I/O:fio關注 IOPS(每秒讀寫次數)和 BW(帶寬)。
# 安裝 sudo apt install -y fio # 隨機寫測試 fio --name=randwrite --ioengine=libaio --rw=randwrite \ --bs=4k --size=1G --numjobs=4 --runtime=60 --group_reporting十、 網絡帶寬:iperf3結果顯示實際帶寬(Mbps/Gbps)。
# 安裝 sudo apt install -y iperf3 # 服務器端 iperf3 -s # 客戶端(替換 ) iperf3 -c常用跑分工具分類工具/腳本
測試范圍
特點
適用場景
UnixBench
CPU、內存、I/O、進程管理
經典綜合基準,結果可橫向對比
全面評估服務器整體性能
Geekbench
CPU(單核/多核)、內存
跨平臺,結果可上傳對比
CPU 性能對比、硬件評測
sysbench
CPU、內存、磁盤 I/O
可定制參數,適合壓力測試
定向測試單一硬件性能
fio
磁盤 I/O
支持多種 I/O 模式,結果詳細
存儲性能評估、數據庫調優
iperf3
網絡帶寬
TCP/UDP 測試,支持雙向
內網/公網帶寬測試
nench / bench.sh
CPU、磁盤、網絡
一鍵腳本,快速出結果
VPS/云主機快速評估
glmark2
GPU
圖形性能測試
GPU 服務器評估
參考網站:https://blog.csdn.net/AlegFox/article/details/146125974 參考網站中有些地址失效,我下載到倉庫中備用。
Linux 跑分測試工具種類豐富,從一鍵腳本到專業基準套件應有盡有。 建議先用 bench.sh / nench 快速摸底,再用 UnixBench / sysbench / fio / iperf3 做針對性深測,最后結合業務負載進行優化。
特別聲明:以上內容(如有圖片或視頻亦包括在內)為自媒體平臺“網易號”用戶上傳并發布,本平臺僅提供信息存儲服務。
Notice: The content above (including the pictures and videos if any) is uploaded and posted by a user of NetEase Hao, which is a social media platform and only provides information storage services.