Linux memory space cleanup command record

1. How to find files that occupy a large amount of memory

$ df -h

        Displays disk information for filesystems, including their usage, free space, etc. as follows:

$ sudo du -ah | sort -rh | awk '$1~/G/{print}'

        Output all files that take up more than 1 GB of memory. If you want to find larger or smaller files, you can modify "G" to "M" (MB), "K" (KB) or other units accordingly.

2. How to clear ./.cache

        Clearing the cache files in the ~/.cache directory may free up some disk space, but some applications may need to rebuild their caches, so make sure you understand the impact before clearing the cache.

$sudo rm -r ~/.cache/*

        The above command will recursively delete everything under the ~/.cache directory. NOTE: Clearing cache files may cause some applications to regenerate their caches, which may cause applications to start slower on restart or require cached data to be reloaded.

Guess you like

Origin blog.csdn.net/weixin_44855366/article/details/130921983