Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@johnnypea
johnnypea / useful-one-liners.sh
Last active April 22, 2024 14:56
Useful one liners
# Run the last command as root
sudo !!
# Serve current directory tree at http://$HOSTNAME:8000/
python -m SimpleHTTPServer
# Save a file you edited in vim without the needed permissions
:w !sudo tee %
# change to the previous working directory
cd -
# Runs previous command but replacing
^foo^bar
@jrenggli
jrenggli / backup-all-docker-images.sh
Created December 8, 2015 17:56
Backup/Save all Docker Images to a compressed file
docker images | tail -n +2 | grep -v "none" | awk '{printf("%s:%s\n", $1, $2)}' | while read IMAGE; do
echo $IMAGE
filename="${IMAGE//\//-}"
filename="${filename//:/-}.docker-image.gz"
docker save ${IMAGE} | pigz --stdout --best > $filename
done