brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: find -nouser -o -nogroup lists files whose owner no longer exists

Find
~/tips/tip-find-nouser-nogroup-orphans

sudo find / -xdev \( -nouser -o -nogroup \) -ls 2>/dev/null

Lists files that belong to a user or group id nobody uses.

After a restore or a user removal, files can carry an id that no account uses any more.

sudo find / -xdev \( -nouser -o -nogroup \) -ls 2>/dev/null

-nouser and -nogroup match files whose numeric owner or group has no entry in the passwd or group database. The backslashed brackets group the two tests, so that -ls applies to both. These files are a risk because a new account that gets the same id would inherit them. Fix them with chown or by restoring the missing account. Containers and bind mounts produce these ids on purpose, so check the origin before you chown.

Further reading: find manual page

More Find tips find / -maxdepth 1 -fstype proc find /backup -name '*.gz' ! -exec gzip -t {} \; -print 2>/dev/null find /srv/downloads -type f -size +100M -size -1G -exec ls -lh {} + find /srv/data -depth -print find /srv -xdev -samefile /srv/downloads/movie.mkv All Find tips (46) All topics

Link