Skip to content

Instantly share code, notes, and snippets.

@AndersonIncorp
Last active July 10, 2018 19:42
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 AndersonIncorp/7aef6eadc4a76196a7122ca9e13f8e01 to your computer and use it in GitHub Desktop.
Save AndersonIncorp/7aef6eadc4a76196a7122ca9e13f8e01 to your computer and use it in GitHub Desktop.
Present info on terminal/ssh login. ~/.bash_login file
#!/bin/bash
## SSH Check
if [ -n "$SSH_CONNECTION" ] && [ "$SHLVL" == "1" ]; then
## pacman -S pacman-contrib
## https://unix.stackexchange.com/questions/119126
stat_mem=$(free -m | awk 'NR==2{printf "%s/%sMB (%.2f%%)\n", $3,$2,$3*100/$2 }')
stat_disk=$(df -h | awk '$NF=="/"{printf "%d/%dGB (%s)\n", $3,$2,$5}')
stat_cpu=$(top -bn1 | grep load | awk '{printf "%.2f\n", $(NF-2)}')
echo -e -n " Date : `date +"%A, %e %B %Y, %r"`
Hostname : `hostname`
Updates : `checkupdates | wc -l`
RAM : $stat_mem
HDD : $stat_disk
CPU : $stat_cpu
"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment