Skip to content

Instantly share code, notes, and snippets.

@namgivu
Last active July 2, 2024 05:49
Show Gist options
  • Save namgivu/98d5422685d3832cddb0960011dd2eba to your computer and use it in GitHub Desktop.
Save namgivu/98d5422685d3832cddb0960011dd2eba to your computer and use it in GitHub Desktop.
viewbigfile() {
# ref https://www.plesk.com/kb/support/how-to-find-directories-files-that-take-up-the-most-disk-space-on-a-plesk-for-linux-server/
find / -type f -size +200M -exec du -h {} + 2>/dev/null | sort -r -h
# / +200M <- find it
}
reduce_journal_log() {
# ref https://www.sitelint.com/blog/how-do-i-clear-a-big-var-log-journal-folder#:~:text=You%20can%20safely%20clean%20%2Fvar,cannot%20delete%20the%20directory%20itself.
sudo journalctl --vacuum-size=100M
}
# ncdu to view what occupied big size ref https://askubuntu.com/a/57760/22308
apt-get install ncdu
clenup_tmp_safely() {
# ref https://superuser.com/a/499053/34893
find /tmp -mtime +1 -and -not -exec fuser -s {} ';' -and -exec rm {} ';'
# +1 day -exec fuser -s {} ';' the unaccessed one
}
# maybe tmpreaper also helpful ref https://superuser.com/a/839408/34893
tmpreaper 1d /tmp
# 1day folder to reap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment