SSH login: show load avg, free memory, free disk, etc.

For most any Linux computer (including Raspberry Pi, Beaglebone Black, Beagleboard, etc.) you can display a cool login message using a “message of the day” (MOTD) type framework.

This script can be put in ~/.bash_profile or on Ubuntu systems as a file in the /etc/update-motd.d/ directory.

The login message you’ll get will include:

Uptime………….: 25 days, 01h47m Memory………….: 822MB (Free) / 1021MB (Total) Load Averages……: 0.03, 0.08, 0.10 (1, 5, 15 min) Running Processes..: 123 Free Disk Space….: 8112M on /dev/sda1

Here’s what to paste inside ~/.bash_profile:

Save that, then login to that machine via SSH. Note, you will have to change the /dev/sda1 to be the partition name you’re interested in.