Skip to content

Instantly share code, notes, and snippets.

@webdev23
Last active September 9, 2017 13:49
Show Gist options
  • Save webdev23/6ed2c3eeda6b66c5262aeff9890b90f8 to your computer and use it in GitHub Desktop.
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
#!/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