System optimization on Zorin/Linux ...?

I'd still get Stacer... it does a pretty good job of cleaning up extraneous files.

If you want to clean it absolutely:
gnome-terminal -- /bin/sh -c 'echo Running Stacer...; stacer; sleep 3; clear; echo Cleaning Chrome cache...; sudo rm /home/$USER/.cache/chromium/Default/Cache/Cache_Data/* -vf; sudo rm /home/$USER/.cache/chromium/Default/"Code Cache"/js/* -vf; sudo rm /home/$USER/.cache/chromium/Default/"Code Cache"/wasm/* -vf; sudo rm /home/$USER/.cache/chromium/Default/"Code Cache"/webui_js/* -vf; sleep 3; clear; echo Clearing /var/backups; sudo rm /var/backups/* -f; sleep 3; clear; echo Clearing APT cache...; sudo apt update; sudo apt autoremove; sudo apt autoclean; sudo apt clean; sleep 3; clear; echo Clearing Logs...; sudo journalctl --rotate; sleep 20; sudo journalctl -m --vacuum-files=0; sleep 5; sudo journalctl --rotate; sleep 20; sudo journalctl -m --verify --sync --flush --rotate --vacuum-time=1s; sleep 3; clear; echo Clearing thumbnails...; rm -rf ~/.cache/thumbnails/* sleep 10'

I use that (with code in there to clear ZFS snapshots older than X days) from a keyboard shortcut (Zorin menu > Settings > Keyboard Shortcuts; scroll all the way to the bottom, click the  +  button).

For defragging, the only sure way is to copy everything from Drive 1 to Drive 2 (or clone Drive 1 to Drive 2), wipe Drive 1 via:
sudo dd if=/dev/zero of=/dev/sdxX bs=512 status=progress
... where sdxX = the drive and partition (sda1, sdd4, sdh2, etc.).
... then copy (not clone) everything back from Drive 2 to Drive 1. The OS automatically writes to the first free space, and since it's all free space (because the sectors have been zero'd), it's the same as defragging.

With ZFS, you can do the defrag while the system is running live... it essentially removes a drive from the pool, adds it back into the pool, silvers and scrubs the drive, then initializes the drive by writing zeroes to the free space.

1 Like