Collection of varies command line one liner

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
1
grep -xFf file1 file2

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

References

  1. Convert images to AVIF/AVIFS with open-source tools
  2. What are the best options to use when compressing files using 7 Zip?
  3. ImageMagick: reduce image size
  4. Bash One-Liners