Skip to content

Instantly share code, notes, and snippets.



Last active Sep 24, 2015
What would you like to do?
Show concise system info on any architectrue/distro


sysinfo -- console util to show concise system info for linux


sysinfo displays system info for distros based on Arch, Debian, SuSE, and Redhat. It's similar to system(2), but gives more info. Whereas top, free, uptime, etc give dynamic status indicators, sysinfo gives a static snapshot of system parameters. It also shows version info for the most common interpreters and services. Some munging of output is done to help commands aspire to semantic versioning.

You may want to use this as a starter recipe for quickly showing the most pertinent info for your systems. The info shown is particularly useful for working with compilers (gcc, glibc, etc), but you may want to tune it for whatever common tools you work with (ruby/python/perl versions, etc). It's also handy for generating consistent bug reports.


Just run it! There are no options. You'll get some parsable output as key-values.

% sysinfo
hostname: ario
distro:   archlinux
release:  rolling
codename: n/a
kernel:   3.4.4-2-ARCH
arch:     x86_64
glibc:    2.15
procs:    Pentium(R) Dual-Core CPU T4200 @ 2.00GHz (x2)
cache:    1024 KB
ram:      7924 MB
swap:     517 MB
bash:     4.2.29(2)-release
zsh:      4.3.17
gcc:      4.7.1
java:     1.7.0_05-icedtea
python:   3.2.3
ruby:     1.9.3p194
perl:     v5.16.0
erlang:   5.9.1
php:      5.4.4
node:     v0.8.0
haskell:  none
mysql:    14.14
postgres: 9.1.4
sqlite:   3.7.13
mongodb:  2.0.6
couchdb:  1.2.0
redis:    2.4.15
apache:   2.2.22
nginx:    1.2.1
hg:       2.2.2


Originally deployed in a compiler test lab to be used on 50+ diverse machines.

For Debian* you may have to install something like libpam-modules to get motd going. We had a convention of putting a specific one-line status message into our MOTDs, and this parsed that out, so is likely not too useful unless you adopt a similar convention. Anyway, it’s a nice approach when using many systems.

Note that there is also an apt-installable GUI tool called sysinfo, but I think this existed first so I'll just keep with the name.

Much more could be done with the Platform Python library if you want to take the concepts here and apply to more OSes.


This has been tested recently only in Arch and Debian.


Micah Elliott

Project hosted as a gist.



Installing to Arch Linux

Installation (packaging) is the main point of this tiny package. I wanted to use a tiny project to serve as an example of how to install directly from github (a gist!) to Arch Linux. Normally a package would go through an approval process to be put into AUR, but until your package is mature enough for that this is a clean and simple way to go.

User flow

cd ~/abs
# Get the one requisite file. Just download the PKGBUILD, or:
# Build the package
# Install
sudo pacman -U sysinfo-git-20120630-1-any.pkg.tar.xz
# Run it
# Read about it
man sysinfo
# Uninstall
sudo pacman -R sysinfo-git

Developer flow

  1. Write a script in any language.
  2. Put some brief usage info into a
  3. Create a simple PKGBUILD.
  4. Create a gist or first-class repo out of it.
  5. Hack, push, hack, push.

This is not a world changing package, but demonstrates that anything you write can be packaged up to be run by anyone, and can have a trivial manpage installed. It doesn't matter what the language is. And there's no messing with complex install instructions, altering PATHs, copying files around, or trying to uninstall misplaced things.

# Maintainer: Micah Elliott <>
pkgdesc="show concise system info for linux on console"
depends=('lsb-release' 'bash')
makedepends=('git' 'ronn')
md5sums=() #generate with 'makepkg -g'
build() {
cd "$srcdir"
msg "Connecting to GIT server...."
if [[ -d "$_gitname" ]]; then
cd "$_gitname" && git pull origin
msg "The local files are updated."
git clone "$_gitroot" "$_gitname"
msg "GIT checkout done or server timeout"
msg "Starting build..."
rm -rf "$srcdir/$_gitname-build"
git clone "$srcdir/$_gitname" "$srcdir/$_gitname-build"
cd "$srcdir/$_gitname-build"
mv README sysinfo.1
gzip sysinfo.1
package() {
cd "$srcdir/$_gitname-build"
install -Dm755 sysinfo $pkgdir/usr/bin/sysinfo
install -Dm644 sysinfo.1.gz $pkgdir/usr/share/man/man1/sysinfo.1.gz
# vim:set ts=2 sw=2 et:
#! /bin/bash
# sysinfo — console util to show concise system info for Linux arch/distro
# Author: Micah Elliott
# License: GPL
# To add:
# * An envar like SYSINFO_RUNTIMES=ruby,python,java to enable
# selectivelyshowing versions
# * Option for JSON output
s() { sed -r "$@" ; }
trim() { local trimres=$(echo $1 |sed "s/^ \+//"); }
w() { /usr/bin/which $1 >/dev/null 2>&1; }
if stat -t /lib/libc-*.so >/dev/null 2>&1; then
glibc=$(echo /lib/libc-*.so |head -1 |sed -e 's/.*-//' -e 's/\.so$//')
kernel=$(uname -r)
arch=$(uname -m)
#distro=$(for f in /etc/{redhat,SuSE}-release; do test -f $f && head -1 $f; done)
distro=$(lsb_release -i |awk '{print $3}')
release=$(lsb_release -r |awk '{print $2}')
codename=$(lsb_release -c |awk '{print $2}')
freemem=$(free -m |grep Mem |tr -s ' ' |cut -d' ' -f2)
freeswap=$(free -m |grep Swap |tr -s ' ' |cut -d' ' -f2)
trim $(cat /etc/motd |grep "^$(hostname)" |cut -d'-' -f3)
# Shells
vbash=$( w bash && bash --version |& head -1 |awk '{print $4}' || echo "none" )
vzsh=$( w zsh && zsh --version |& awk '{print $2}' || echo "none" )
# Compilers
vgcc=$( w gcc && gcc --version |& head -1 |awk '{print $3}' || echo "none" )
vjava=$( w java && java -version |& sed -rn 's/.*"(.*)".*/\1/;1p' || echo "none" )
vruby=$( w ruby && ruby -v |& awk '{print $2}' || echo "none" )
vpython=$( w python && python -V |& awk '{print $2}' || echo "none" )
vnode=$( w node && node --version |& s 's/^v//' || echo "none" )
vlua=$( w lua && lua -v 2>&1 |& awk '{print $2}' || echo "none" )
# What a monster!
vghc=$( w ghc && ghc --version || echo "none" )
verl=$( w erl && erl -version |& s 's/.* //' || echo "none" )
vcoffee=$( w coffee && coffee -v |& s 's/.* //' || echo "none" )
vperl=$( w perl && perl -v 2>&1 |sed -rn 's/.*(v[0-9.]+).*/\1/;2p' || echo "none")
vphp=$( w php && php --version |& head -1 |awk '{print $2}' || echo "none" )
# Too slow
#vscala=$( w scalac && scalac -version |& sed -r 's/.*([0-9]+\.[0-9]\.[0-9]).*/\1/'|| echo "none" )
# Not including clojure since every project uses a different local version from .m2.
# Databases
vmysql=$( w mysql && mysql --version |& awk '{print $3}' || echo "none" )
vpsql=$( w psql && psql --version |& sed -nr 's/.* //;1p' || echo "none" )
vsqlite=$( w sqlite3 && sqlite3 --version |& tail -1 |sed -r 's/ .*?//' || echo "none" )
vmongodb=$( w mongo && mongo --version |awk '{print $4}' || echo "none" )
vcouchdb=$( w couchdb && couchdb -V |head -1 |sed -r 's/.* //' || echo "none" )
vredis=$( w redis-cli && redis-cli --version |awk '{print $2}' || echo "none" )
# Services
vapache=$( w apachectl && apachectl -version |& sed -rn 's/.*\/(.*) .*/\1/;1p' || echo "none" )
vnginx=$( w nginx && nginx -v |& sed -r 's/.*\///' || echo "none" )
# Other tools
vgit=$( w git && git --version |awk '{print $3}' || echo "none" )
vhg=$( w hg && hg --version |head -1 |sed -r -e 's/\)//' -e 's/.* //' || echo "none" )
test $arch = "ia64" && {
vendor=$(grep '^vendor' /proc/cpuinfo |uniq |cut -d: -f2)
fam=$(grep '^family' /proc/cpuinfo |uniq |cut -d: -f2)
mhz=$(grep '^cpu MHz' /proc/cpuinfo |uniq |cut -d: -f2)
nprocs=$(grep '^processor' /proc/cpuinfo |wc -l |tr -s ' ')
cache=$(grep 'Size' /proc/pal/cpu0/cache_info |tail -1 |cut -d: -f2)
} || {
proc=$(grep "model name" /proc/cpuinfo |uniq |cut -d: -f2 |tr -s ' ')
nprocs=$(grep processor /proc/cpuinfo |wc -l |tr -d ' ' |tr -s ' ')
cache=$(awk '/^cache/ {print $4}' /proc/cpuinfo |head -1)
echo "hostname: $name"
echo "distro: $distro"
echo "release: $release"
echo "codename: $codename"
echo "kernel: $kernel"
echo "arch: $arch"
echo "glibc: $glibc"
echo "procs: $proc (x$nprocs)"
echo "cache: $cache KB"
echo "ram: $freemem MB"
echo "swap: $freeswap MB"
echo "bash: $vbash"
echo "zsh: $vzsh"
echo "gcc: $vgcc"
echo "java: $vjava"
echo "python: $vpython"
echo "ruby: $vruby"
echo "perl: $vperl"
echo "erlang: $verl"
echo "php: $vphp"
echo "node: $vnode"
echo "lua: $vlua"
#echo "scala: $vscala"
echo "haskell: $vghc"
echo "mysql: $vmysql"
echo "postgres: $vpsql"
echo "sqlite: $vsqlite"
echo "mongodb: $vmongodb"
echo "couchdb: $vcouchdb"
echo "redis: $vredis"
echo "apache: $vapache"
echo "nginx: $vnginx"
echo "git: $vgit"
echo "hg: $vhg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment