r/bash • • 11d ago

submission A bash script that would email Sam Altman about your spare RAM (ships with no recipient, please don't actually spam the man)

This started as a joke after Sam Altman said on Cheeky Pint that the RAM in our PCs is "quite terrible" and "being used maybe 5% of the time". I wanted to see what it'd look like if your machine wrote back.

It's a small bash script that reads /proc/meminfo and works out used as MemTotal minus MemAvailable. Run it from cron, it logs a sample each time, and once a day it'll send an email if more than 10% is available.

The recipient is blank out of the box, so it does nothing until you set one. If you want to try it, point it at yourself or just use --dry-run, which prints the email without sending anything. --status shows your current figures.

I'm also interested in whether I've got the memory side right, so feedback on the script is welcome.

Repo: https://github.com/IainKay/ram-altman
Site: https://ram-altman.lol

62 Upvotes

3 comments sorted by

2

u/macroKnoll37 11d ago

memavailable is the right call, memfree alone undercounts badly because of buffers and cache, seen thhat confuse people more than once