Last active
February 28, 2017 16:06
-
-
Save juliobetta/4eea4a711f3fd729d9e1 to your computer and use it in GitHub Desktop.
Useful command line... commands
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
########################################################################################################################### | |
### MISC ################################################################################################################## | |
########################################################################################################################### | |
# Replace string in multiple files | |
grep --include=filename -rl 'string_to_be_replaced' /directory | xargs sed -i 's/string_to_be_replaced/new_string/g' | |
# Remove git sensitive data | |
git filter-branch --force --index-filter 'git rm -rf --cached --ignore-unmatch filename' --prune-empty --tag-name-filter cat -- --all | |
########################################################################################################################### | |
### DOCKER ################################################################################################################ | |
########################################################################################################################### | |
# Install Docker | |
curl -sSL https://get.docker.com/ | sh | |
# Install Docker Compose | |
curl -L "https://github.com/docker/compose/releases/download/1.11.1/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
# Remove all docker images based on a filter | |
docker ps -a | grep 'to_be_found' | awk '{print $1}' | xargs --no-run-if-empty docker rm | |
# Remove all docker images | |
docker rmi $(docker images -q) | |
# Remove all docker containers | |
docker rm $(docker ps -a -q) | |
# Cleaning dangling images | |
docker rmi $(docker images -f dangling=true -q) | |
# Remove dead containers | |
docker rm -v $(docker ps -a -q -f status=exited) | |
# Cleaning forgotten volumes | |
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes | |
# Remove all docker untagged images | |
docker rmi $(docker images | grep "^<none>" | awk "{print $3}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment