Back to wiki
Bytesized Hosting

Cmdline

Name: cmdline

Last reviewed by: Clipper, April 2026


Command Line Tips & Tricks


Finding Things

Find broken symbolic links in your media directory.

find ~/media -xtype l

Find empty sub-directories in your media directory.

find ~/media -type d -empty

Find sample movie files (contains "sample" in name) by size (less than 50MB) and extension (avi, mkv, mp4, vob).

find ~/torrents ~/nzbget -type f -size -51200k -regex ".*/.*sample.*\.\(avi\|mkv\|mp4\|vob\)"

Find files in your torrents and nzbget directories that are not linked in your media folder.

find ~/media -type l -exec readlink -f {} \; > links.txt && \
find ~/torrents ~/nzbget -type f > files.txt && \
grep -Fxv -f links.txt files.txt

Finding and Deleting Things

With Confirmation — Interactive Removal (Y/N) for each file

Find and remove broken symbolic links in your media directory.

find ~/media -xtype l -exec rm -i {} \;

Find and remove broken symbolic links, then remove any empty sub-directory in your media directory.

⚠️ Warning: Confirmation only exists for broken symbolic links — empty folders are removed without confirmation.

find ~/media -xtype l -exec rm -i {} \; && find ~/media -type d -empty -delete

Find sample movie files by size (less than 50MB) and extension (avi, mkv, mp4, vob) and delete them interactively.

find ~/torrents ~/nzbget -type f -size -51200k -regex ".*/.*sample.*\.\(avi\|mkv\|mp4\|vob\)" -exec rm -i {} \;

Without Confirmation

Find and remove broken symbolic links in your media directory.

find ~/media -xtype l -delete

Find and remove empty sub-directories in your media directory.

find ~/media -type d -empty -delete

Find and remove broken symbolic links, then remove any empty sub-directory in your media directory.

find ~/media -xtype l -delete && find ~/media -type d -empty -delete

Find sample movie files by size (less than 50MB) and extension (avi, mkv, mp4, vob) and delete them.

find ~/torrents ~/nzbget -type f -size -51200k -regex ".*/.*sample.*\.\(avi\|mkv\|mp4\|vob\)" -delete

Find and remove files in your torrents and nzbget directories that are not linked in your media folder.

find ~/media -type l -exec readlink -f {} \; > links.txt && \
find ~/torrents ~/nzbget -type f > files.txt && \
grep -Fxv -f links.txt files.txt | xargs -d '\n' rm

Display HDD Usage

echo -e "\e[33mused $(du -sh ~ | awk -F ' ' '{print $1}')iB\e[0m"
Last Author
Clipper
Versions
29
Last Update
Sat, 11 Apr 2026 16:10:07 +0200