查看 Linux 系统信息

一键测试脚本:YABS [yet another benchmark]

curl -sL yabs.sh | bash

查看系统信息

查看系统信息

neofetch

查看发行版信息

cat /etc/os-release
lsb_release -a

查看系统架构

uname -m  # POSIX 标准
arch      # GNU Coreutils

查看硬件信息

sudo apt install -y inxi  # 需要先安装使用
inxi     # 查看 CPU、内存等信息
inxi -G  # 查看显卡信息

查看 CPU / GPU 信息

  • cpufetch

    sudo apt install -y cpufetch
    cpufetch
    
  • gpufetch

    sudo apt install zlib1g-dev cmake make gcc g++
    git clone https://github.com/Dr-Noob/gpufetch
    cd gpufetch
    ./build.sh
    ./gpufetch
    

查看系统运行情况

top      # 任务管理器
htop     # 加强版任务管理器
btop     # 更强的任务管理器
nvitop   # 查看显卡使用情况
free -h  # 查看内存使用情况

查看公网 IP 地址

curl -4 icanhazip.com

性能测试

CPU 性能测试

sudo apt install -y sysbench
sysbench --test=cpu --cpu-max-prime=20000 run

内存性能测试

sysbench --test=memory --memory-block-size=1M --memory-total-size=10G run

磁盘 I/O 性能测试

  • 测试磁盘的响应时间:

    ioping -c 10 .  # 测试当前目录的磁盘响应时间,执行 10 次
    
  • 测试磁盘写入速度:

    dd if=/dev/zero of=testfile bs=1G count=1 oflag=dsync && rm testfile
    

    这条命令使用 dd/dev/zero 写入 1GB 数据到 testfile 文件,oflag=dsync 确保直接写入磁盘。

网络性能测试

  • Speedtest

    curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo sh
    sudo apt install speedtest
    
    speedtest
    
  • iperf3

    iperf3 用于测量两个主机之间的最大 TCP 和 UDP 带宽性能。

    sudo apt install -y iperf3
    

    首先在一台机器上启动 iperf3 server:

    iperf3 -s
    

    然后在另一台机器上使用 iperf3 client 连接到服务器:

    iperf3 -c <server_ip>
    
posted @ 2024-05-04 03:13  Undefined443  阅读(26)  评论(0)    收藏  举报