linux
Table of Contents
Linux Cheat Sheet
snap
Clean unused/disabled snap packages
snap list --all | while read snapname ver rev trk pub notes; do if [[ $notes = *disabled* ]]; then snap remove "$snapname" --revision="$rev"; fi; done
iptables/netfilter
Restrict to single host, e.g. for prometheus node exporter
iptables -N prometheus iptables -A prometheus --src <server-ip> -j ACCEPT iptables -A prometheus -j DROP iptables -I INPUT -m tcp -p tcp --dport 9100 -j prometheus
docker
open shell in a running container
docker exec -ti <container-name> /bin/bash
sender guidelines
default:
ps2pdf input.pdf output.pdf
ghostscript options -dPDFSETTINGS
ps2pdf -dPDFSETTINGS=/ebook input.pdf output.pdf
possible options:
- dPDFSETTINGS=/screen (72 dpi)
- dPDFSETTINGS=/ebook (150 dpi)
- dPDFSETTINGS=/prepress (300 dpi)
- dPDFSETTINGS=/printer (300 dpi)
- dPDFSETTINGS=/default Selects the output which is useful for multiple purposes. Can cause large PDFS.
Video
compress video for email sending
ffmpeg -i input.mp4 output_compressed.mp4
adjust volume
ffmpeg -i input.avi -af "volumedetect" -vn -sn -dn -f null /dev/null
gives:
[Parsed_volumedetect_0 @ 0x55f12ff28780] n_samples: 1839104 [Parsed_volumedetect_0 @ 0x55f12ff28780] mean_volume: -43.4 dB [Parsed_volumedetect_0 @ 0x55f12ff28780] max_volume: -31.5 dB [Parsed_volumedetect_0 @ 0x55f12ff28780] histogram_31db: 64 [Parsed_volumedetect_0 @ 0x55f12ff28780] histogram_32db: 455 [Parsed_volumedetect_0 @ 0x55f12ff28780] histogram_33db: 1884
increase max volume:
ffmpeg -i input.avi -af "volume=30dB" -c:v copy -c:a libmp3lame -q:a 2 output.mp4
flip image
ffmpeg -i input.mp4 -vf "transpose=2" output.mp4
transpose options:
0 = 90° counter-clockwise and vertical flip (default) 1 = 90° clockwise 2 = 90° counter-clockwise 3 = 90° clockwise and vertical flip
linux.txt · Last modified: 2025/01/09 06:28 by nine