Ultima attività 1776414318

简单小脚本,大大的便捷

Revisione 8c6e849fd51e4bd9b680c26290c40b8415d0f902

sysinfo.sh Raw
1#!/bin/bash
2
3# wget -O sis.sh https://gist.doracoin.cc/doracoin/e29dff46e05840d4878a368399ec1858/download/HEAD/sysinfo.sh
4
5echo "=== 系统信息 ==="
6echo "主机名: $(hostname)"
7echo "系统版本: $(cat /etc/os-release | grep PRETTY_NAME | cut -d'"' -f2)"
8echo "内核版本: $(uname -r)"
9echo "运行时间: $(uptime -p)"
10
11echo -e "\n=== CPU信息 ==="
12echo "CPU型号: $(lscpu | grep "Model name" | cut -d':' -f2 | xargs)"
13echo "物理CPU数: $(lscpu | grep "Socket(s)" | cut -d':' -f2 | xargs)"
14echo "核心总数: $(lscpu | grep "^CPU(s):" | cut -d':' -f2 | xargs)"
15
16echo -e "\n=== 内存信息 ==="
17free -h | head -2
18
19echo -e "\n=== 磁盘信息 ==="
20df -h | grep -E "(^Filesystem|^/dev/)"
21
22echo -e "\n=== 当前负载 ==="
23w | head -1
24