Skip to content

Instantly share code, notes, and snippets.

@DevJonny
Last active September 5, 2019 11:42
Show Gist options
  • Save DevJonny/01ec09fba52dd610253429da29cb716a to your computer and use it in GitHub Desktop.
Save DevJonny/01ec09fba52dd610253429da29cb716a to your computer and use it in GitHub Desktop.
Useful Linux commands
# List folders with file size in MB
ls -la --block-size=M <directory>
# Find total file sizes for a directory
du -h -c <directory> | tail -1
# Find all directories with name with wildcard
find -iname '<directory>*' -maxdepth 10 -mindepth 1 -type d
# Delete all directories with name with wildcard
find -iname '<directory>*' -d -type d -exec rm -rf '{}' \;
# Find and replace in Vim
:%s/foo/bar/g
# Restart all stopped Docker containers
docker start $(docker ps -a -q -f status=exited)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment