Last active
September 9, 2017 13:49
-
-
Save webdev23/6ed2c3eeda6b66c5262aeff9890b90f8 to your computer and use it in GitHub Desktop.
Kill all x11 windows, empty ram and swap, empty trash bin | php bash script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
// Get all x11 windows | |
$windows = system("wmctrl -l | cut -f1 -d' ' > winlist"); | |
$list = file("winlist"); | |
foreach($list as $kill){ | |
system("xdotool windowkill $kill"); | |
} | |
// Remove window list | |
system("rm winlist"); | |
// Empty trash bin | |
system("rm -rf ~/.local/share/Trash/*"); | |
// Clean ram and swap space | |
system("sync; echo 3 | sudo tee /proc/sys/vm/drop_caches | sudo swapoff -a"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment