Posts Tagged ‘killall’

Pause (and then resume) Battery-Guzzling programs

Wednesday, June 7th, 2017

My laptop battery dies quickly these days. Certain apps (cough, cough, Slack), have very high idle CPU-usage. You can pause these programs with

killall -STOP Slack

And later you can resume the application with

killall -CONT Slack

Use ssh to kill single, unresponsive application instead of rebooting entire machine

Thursday, August 13th, 2009

Below is a way to avoid restarting you Mac/Linux machine just because one application has frozen the graphic user interface (by killing just that one app).

Script Editor on my Mac OS X machine froze my machine, freezing not just Script Editor but the whole Graphic User Interface of my Mac.

Luckily I had Remote Login enabled (Go to System Preferences > Sharing and make sure “Remote Login” is checked) and I knew my local ip address.

System Preferences Sharing Window

You can find your local ip address at the bottom of the same window above.

System Preferences Sharing Window

So I used a terminal shell on my girlfriend’s computer to ssh tunnel into my frozen machine and kill Script Editor. Opening Terminal.app on my girlfriend’s machine I issued:


ssh [username on my mac]@[local ip address]

Then after agreeing to the RSA fingerprint and entering the password to my Mac. I simply issued:


killall "Script Editor"

Change "Script Editor" to the name of whatever application is freezing your machine. You can issue the command:


top

to see running processes.

Note: You must have ssh enabled before your machine freezes.
Note: If killall doesn’t actually kill the application in question, stronger kill levels exist.