Common scripts
Check the global data usage:
df -h
Check the usage of the current directory:
du -sh .
List the usages of each subdirectory under the current directory:
du -h --max-depth=1
Sort the usages of subdirectories:
du -h --max-depth=1 | sort -hr
Docker caches
When you run docker build
to build an image, it stores the cache into the disk, making the storage almost full. To ease the problem, you can use the prune
command to clean up the caches.
- Remove all unused images, containers, networks, and dangling build caches:
docker system prune
- Remove all unused (not just dangling) images, containers, networks, and build caches:
docker system prune -a
- Clean up the build cache:
docker builder prune
node_modules
find . -name "node_modules" -type d -prune -print | xargs rm -rf