I recently ran into a situation where a system was too out-of-memory to even run
htop, or to even create a swap file.
(But somehow I could still SSH into the system, so at least I had a shell.)
I ended up getting lucky by noticing that I could run
kill if I don't run the login shell, but I'm wondering if I hadn't been lucky, what could I have possibly done to avoid rebooting, assuming I still had the login shell?
Is there e.g. to reserve a specific amount of memory for a particular executable to always be able to run? Or is there a way to kill processes from within Bash that doesn't require a fork?