Tools & Utils¶
Duplicate files¶
Find: find ~/Videos/ -type f -print0 | xargs -0 -P 16 -L 1 md5sum | sort | uniq -D -w 32
Delete duplicates:
- Save the output of the above command in a file (db.txt), and then
-
Execute this:
nano ~/remove-duplicates.fish#!/usr/bin/env fish set db_path $argv[1] if test -z $db_path echo "Please provide the path to the file that contains the MD5 hashes and file paths." exit 1 end set prev_seen_hash "" function maybe_delete_file --argument-names file if test -z $DELETE_DUPLICATES_DRY_RUN echo "Deleting \"$file\"..." set fish_trace 1 rm -f "$file" set fish_trace 0 else echo "Would delete (dry-run): $argv" end end cat $db_path | while read -l line set -l components (string split " " -- $line) set curr_hash $components[1] set curr_file $components[3..-1] if test "$prev_seen_hash" = "$curr_hash" maybe_delete_file $curr_file end set prev_seen_hash $curr_hash end
Compression¶
A couple of observations:
- zstd uses cores up to the compression level of 19 (including).
--ultra -22
gives the best compression
Alternatives¶
Add clang alternatives:
Display info about given alternative:
Permissions¶
Restore default permissions (x
for dirs, no x
for files):
X
permission: execute/search only if the file is a directory or already has execute permission for some user.
Note, unlike X
, it will remove x
permission from files.
initrd.img¶
- Extract
initrd.img
:unmkinitramfs /boot/initrd.img-5.15.0-30-generic ../new-init/
Hash of a directory¶
Mouse scroll speed¶
See askubuntu.