Collection of various one-liners for archiving. Always being
updated.
Convert GIF to AVIF
1
| ffmpeg -i input.gif -strict -1 -f yuv4mpegpipe -pix_fmt yuva444p - | avifenc --stdin output.avif
|
Convert JPEF/PNG to AVIF
1 2
| magick input.jpeg -quality 90% output.avif magick input.png -quality 50% output.avif
|
Lossy compress PNG in a
folder
1
| for f in *.png; do magick "$f" -quality 90% -resize 50x50% "${f%.png}.avif"; done
|
Compress files with 7z
1
| 7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1
|
Compress files with 7z
and standard zip
1
| 7z a -mm=Deflate -mfb=258 -mpass=15 -r foo.zip dir1
|
Print the lines of
file2 that exist in file1
Tree-like output in ls
1
| ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/ /' -e 's/-/|/'
|
Get file sizes in a
directory
1
| du -h /home/user/ --max-depth=1
|
Find the largest 10 files
1
| find ~/ -type f -print0 | xargs -0 du -h | sort -rh | head -n 10
|
Download file with aria2
1 2 3 4 5 6 7 8 9 10 11 12
| aria2c \ --max-connection-per-server=4 \ --split=4 \ --min-split-size=20M \ --retry-wait=10 \ --max-tries=0 \ --timeout=60 \ --connect-timeout=30 \ --lowest-speed-limit=10K \ --continue=true \ --auto-file-renaming=false \ URL
|
Find files larger than 100
MB
1
| find . -type f -size +100M -print
|
Rename all .jpeg files to
.jpg
1
| for f in *.jpeg; do mv -- "$f" "${f%.jpeg}.jpg"; done
|
Find byte-by-byte duplicated
files
1
| find . -type f -name '*.jpg' -exec shasum -a 256 {} + | sort | awk '{h=$1;if(h==p){if(!x)print l;print;x=1}else{x=0}p=h;l=$0}'
|
Video compression for
archiving
1 2 3 4 5 6 7 8 9
| ffmpeg -i "INPUT_VIDEO.mp4" \ -map 0 \ -c:v libsvtav1 \ -preset 2 \ -crf 26 \ -pix_fmt yuv420p10le \ -c:a copy \ -map_metadata 0 \ "OUTPUT_VIDEO.mkv"
|
References
- Convert
images to AVIF/AVIFS with open-source tools
- What
are the best options to use when compressing files using 7 Zip?
- ImageMagick:
reduce image size
- Bash
One-Liners