Skip to content

Instantly share code, notes, and snippets.

@mcpcpc
Last active June 21, 2020 20:25
Show Gist options
  • Save mcpcpc/d9d8b98c6980cb53cafbe1b3536d1717 to your computer and use it in GitHub Desktop.
Save mcpcpc/d9d8b98c6980cb53cafbe1b3536d1717 to your computer and use it in GitHub Desktop.
KISS Linux tiny fetch
#!/bin/sh
#
# fetch by Dylan Araps
(read -r _ _ k _ </proc/version;IFS=. read -r s _ </proc/uptime;d=$((s/60/60/24));h=$((s/60/60%24));m=$((s/60%60));[ "$d" = 0 ]||u="$u ${d}d";[ "$h" = 0 ]||u=$u\ ${h}h;[ "$m" = 0 ]||u=$u\ ${m}m;. /etc/os-release;while IFS=: read -r a b;do b=${b%kB};case $a in MemT*)_=$((z+=b));_=$((y=b));; Shmem)_=$((z+=b));;MemF*|Buf*|Cac*|SR*)_=$((z-=b));esac;done </proc/meminfo;_=$((z/=1024));_=$((y/=1024));set -- /var/db/k*/ins*/*/;printf '%b\n' "
 ___ ${USER:-$(id -un)}@$(hostname)
 (.· | os: ${PRETTY_NAME:-Linux}
 (<> | shell: ${SHELL:-/bin/sh}
 / __ \\ pkgs: $#
 ( / \\ /| uptime:${u:-0m}
_/\\ __)/_) memory: ${z:-?}MB / ${y:-?}MB
\/-____\/ kernel: ${k:-linux}
") 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment