Skip to content

Instantly share code, notes, and snippets.

@Ran-Xing
Last active May 23, 2022 13:59
Show Gist options
  • Save Ran-Xing/8eb22c8c93ff6be334ddc87fcda198e5 to your computer and use it in GitHub Desktop.
Save Ran-Xing/8eb22c8c93ff6be334ddc87fcda198e5 to your computer and use it in GitHub Desktop.
Linux hardware details
#!/usr/bin/env bash
clear
printf "\n%s\n\n" "-----------------------"
echo "CPU: $(grep -c processor /proc/cpuinfo) 核心"
echo "内存: $(($(free | grep Mem | cut -d " " -f 9) / 1024 / 1024)) G"
echo "网络: $(curl -s cip.cc | grep "数据二" | cut -d " " -f 2)"
echo "磁盘: $(lsblk -f | grep ext4 | cut -d " " -f 14 | tr -s "\n" " ")"
printf "\n%s\n\n" "-----------------------"
@Ran-Xing
Copy link
Author

curl -sLm 10 https://ghproxy.com/https://gist.githubusercontent.com/Ran-Xing/8eb22c8c93ff6be334ddc87fcda198e5/raw/27a563d9a0562292c2287cf19daaf192f7c521c3/hardware.sh | bash

@Ran-Xing
Copy link
Author

ubuntu-server

echo "内存: $(($(free | grep Mem | cut -d " " -f 8) / 1024 / 1024)) G"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment