Skip to content

Instantly share code, notes, and snippets.

@abdulwaheedsyed
Last active March 9, 2026 14:02
Show Gist options
  • Select an option

  • Save abdulwaheedsyed/eccd4ce727dab945d660d8d2ee534cac to your computer and use it in GitHub Desktop.

Select an option

Save abdulwaheedsyed/eccd4ce727dab945d660d8d2ee534cac to your computer and use it in GitHub Desktop.
One Liners

Install Docker on Linux:

curl -fsSL https://get.docker.com | sh

Docker Prune stuff (๐Ÿ’€ Danger, removes all stopped containers and volumes):

docker builder prune -f; docker system prune --all --volumes -f

SysRq reset a Linux box:

echo 1 > /proc/sys/kernel/sysrq && echo b > /proc/sysrq-trigger

Find the processes using the most swap space in Linux:

psres=$(ps -eo rss,vsz,user,pid,tty,time,cmd); set -- $(/bin/echo "$psres" | head -n1); shift; shift; echo "SWAP $*"; echo "$psres" | awk 'BEGIN {ORS=""; getline} {print $2 - $1 " "; for (i=3; i<NF; i++) print $i " "; print $NF "\n"}' | sort -rn | head

Safely clean /boot of old kernels in Ubuntu:

sudo dpkg --list 'linux-image*'|awk '{ if ($1=="ii") print $2}'|grep -v `uname -r` | while read -r line; do sudo apt-mark remove $line;done;sudo apt autoremove --purge; sudo update-grub

Quick HTTP server using Python 3:

python3 -m http.server

Quickly create a file:

Sparse file on Linux:
fallocate -l 10G <filename>
Empty reserve file on Linux:
truncate -s 1G <filename>
Sparse file in NTFS on Windows:
fsutil file createnew <filename> <length in bytes>

Move Ubuntu dock Applications icon to left/top

gsettings set org.gnome.shell.extensions.dash-to-dock show-apps-at-top true

Ubuntu Display Battery Percentage

gsettings set org.gnome.desktop.interface show-battery-percentage true

Ubuntu Click to minimize to dock

gsettings set org.gnome.shell.extensions.dash-to-dock click-action minimize

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment