Wiki/maintenance.md

1.0 KiB

Linux Maintenance

  • Find all files older than one year find <path> -depth -type f -atime +365

  • Delete all files older than one year find <path> -type f -atime +365 -delete

  • Delete all empty directories find <path> -empty -type d -delete

  • Sort files according to their size du <path> -h | sort -h

  • Find largest files du -ahx . | sort -rh | head -5
  • Find broken symlinks find <path> -xtype l

Tools

  • Used files tree: baobab
  • Find files not belonging to any package: lostfiles

Packages

  • Find no longer needed packages: pacman -Qtd
    • Remove all pacman -Qtdq | sudo pacman -Rns -
  • Find packages that are only required by cyclic dependencies: pacman -Qqd | pacman -Rsu --print -
    • Remove all pacman -Qqd | sudo pacman -Rsu -
  • Find packages only optionally required : pacman -Qttd
    • Remove all pacman -Qttdq | sudo pacman -Rns -
  • Find packages that are no longer in the repo: pacman -Qm
  • Find packages that are only required by cyclic dependencies: pacman -Qqd | pacman -Rsu --print -