可能会出现部分版本和操作系统命令不匹配情况,仅供shell参考:
#!/usr/bash
#----------------------------------
#this bashshell will show all information about this system
#somesystem cmd will diffirent,change the code for yourself
clear
total_tasks=100 # 假设总任务数为100
for ((i=1; i<=total_tasks; i++)); do
sleep 0.1
progress=$((100 * i / total_tasks))
printf "\rsystem-information-aplexia: [%d%%] [" $progress
for ((j=1; j<=progress/10; j++)); do
printf "="
done
for ((j=progress/10+1; j<=10; j++)); do
printf " "
done
printf "]"
done
function system_os(){
echo "|system-OS:(系统信息)`cat /etc/redhat-release`"
echo "----------------------------------------------"
echo "|system-name:(系统版本)`uname -a`"
echo "----------------------------------------------"
echo "|system-memory:(内存空间)"&&free -h
echo "----------------------------------------------"
echo "|system-cpu:(CPU)"&&lscpu
echo "----------------------------------------------"
echo "|system-pci:(设备显卡和声卡)"&&lspci
echo "----------------------------------------------"
echo "|system-lsblk:(挂载信息)"&&lsblk&&lsblk -f
echo "----------------------------------------------"
echo "|system-df:(磁盘信息)"&&df -h
}
function system_network(){
echo "|network-information `ifconfig`"
echo "if your linux-version > 9;this config_file maybe in:/etc/NetworkManager/system-connections/ens160.nmconnection "
echo "----------------------------------------------"
echo "|network-DNS:"&&cat /etc/resolv.conf
echo "DNS_file in /etc/resolv.conf"
}
function system_user_group(){
echo "|user-information:(用户信息文件)"&&cat /etc/passwd
echo "----------------------------------------------"
echo "|user-now:(当前用户信息)"&&id
}
function system_mount(){
echo "|mount:(设备挂载情况)"&&lsblk
}
function system_cpu(){
echo "|system-top:(查看系统监控信息,正在加载(按q退出)......"
sleep 2&&top
}
echo "|time-now:`date`"
printf "%s \n" " ------------------------------------"
printf "%s \n" "| -*-*-* 1.查看系统相关信息 *-*-*- |"
printf "%s \n" "| -*-*-* 2.查看网络相关信息 *-*-*- |"
printf "%s \n" "| -*-*-* 3.用户与用户组信息 *-*-*- |"
printf "%s \n" "| -*-*-* 4.查看系统挂载信息 *-*-*- |"
printf "%s \n" "| -*-*-* 5.查看系统监控信息 *-*-*- |"
printf "%s \n" " ------------------------------------"
read -p "Please input which opration you want to do:" opration
case $opration in
1)
system_os
;;
2)
system_network
;;
3)
system_user_group
;;
4)
system_mount
;;
5)
system_cpu
;;
esac