User Tools

Site Tools


linux

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

email

sender guidelines

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: 2024/02/22 21:11 by nine