Skip to content

Instantly share code, notes, and snippets.

@pizzadude
Created September 16, 2013 18:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pizzadude/6584658 to your computer and use it in GitHub Desktop.
Save pizzadude/6584658 to your computer and use it in GitHub Desktop.
mekSysInfo
#!/bin/bash
## a simple system info script by meklu
# if we don't have a display we'll try to set one
# useful for e.g. ssh access
[[ -z "$DISPLAY" ]] && export DISPLAY=":0"
printf "Host: " ; hostname
printf "Kernel: " ; uname -rsm
printf "Distro: "
lsb_release >/dev/null 2>/dev/null
if [ $? = 0 ]
then
lsb_release -ds | sed 's/^\"//g;s/\"$//g'
# a bunch of fallbacks if no lsb_release is available
elif [ -f /etc/arch-release ]
then
printf "Arch Linux\n"
elif [ -f /etc/gentoo-release ]
then
cat /etc/gentoo-release
elif [ -f /etc/fedora-release ]
then
cat /etc/fedora-release
elif [ -f /etc/redhat-release ]
then
cat /etc/redhat-release
elif [ -f /etc/debian_version ]
then
printf "Debian GNU/Linux " ; cat /etc/debian_version
else
printf "Unknown\n"
fi
printf "CPU: " ; cat /proc/cpuinfo | sed -n 's/^model name\t: //gp' | head -n1
if [ -f "/sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq" ]
then
CPUFREQUENCY="$(printf "scale=2;$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)/1000\n" | bc -l)"
else
CPUFREQUENCY="$(printf "scale=2;$(grep -m 1 "cpu MHz" /proc/cpuinfo | awk '{print $4}')/1\n" | bc -l)"
fi
printf " $(grep -c "^processor" /proc/cpuinfo | sed 's/\n//g') cores/threads\n $CPUFREQUENCY MHz\n"
printf "RAM: $(printf "scale=2;$(grep "^MemTotal:" /proc/meminfo | awk '{print $2}')/1024^2\n" | bc -l) GiB\n"
GPUINFO="$(glxinfo 2>/dev/null | sed -n 's/^OpenGL renderer string: //gp;s/^OpenGL version string: / OpenGL /gp;s/^OpenGL shading language version string: / GLSL /gp')"
printf "GPU: "
if [ -n "$(printf "${GPUINFO}")" ]
then
printf "${GPUINFO}\n"
else
printf "No GPU detected.\n"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment