pkg query -e '%#r = 0' '%n-%v'
Lists packages nothing depends on
freebsd pkg #7375292epkg query -e '%#r = 0' '%n-%v'
Lists packages nothing depends on
freebsd pkg #7375292egoaccess *.log --log-format='%C|%s|%x|%b|%^|%h|%R|%U|%^|%u|%^|%^' --date-format='%*' --time-format='%*' --enable-panel=REFERRERS
Analyzes Bunny CDN logs
log goaccess #56a5a51cfind . -type f \( -perm -100 -o -perm -010 -o -perm -001 \) -print
Lists executable files
find permissions #341cc036ffmpeg -nostats -i tetrakolius_-_odlazak_remastered.flac -af astats=metadata=0 -f null - 2>&1 | grep "Bit depth"
Shows real bit depth of audio
audio ffmpeg #926c1c64grep -E '^he_' /var/run/hostapd-phy*.conf | grep -v mu_edca
Shows Wi-Fi 6 settings
openwrt wifi #7a0cfa97iw phy1 info | grep -A 10 'valid interface combinations'
Shows how many APs the radio supports
openwrt wifi #93d95e4aiw dev phy1-ap0 station dump | grep -c Station
Counts Wi-Fi clients
openwrt wifi #cc6f25eciw dev phy1-ap0 station dump | grep -E 'Station|signal:|tx bitrate|rx bitrate'
Shows Wi-Fi clients' signal and rates
openwrt wifi #4b6c8419iw dev phy1-ap0 survey dump | grep -A7 'in use'
Shows channel noise and busy time
openwrt wifi #6a350449iwinfo phy1-ap0 info | grep -E 'Channel|Tx-Power'
Shows Wi-Fi channel and transmit power
openwrt wifi #ffbfe77cmagick pokloni-website-card_1200x600.png -resize "1200x630^" -gravity center -extent 1200x630 pokloni-website-card_1200x600_fixed.png
Resizes and crops to exactly 1200x630
image magick #2b66526efind . -maxdepth 1 -mindepth 1 -type d -exec rm -rf '{}' \;
⚠ Deletes all subdirectories, incl. hidden ones like .git
file cleanup find #b0da01a6python3 -c "import re,sys,pathlib;p=re.compile(r'[\U0001f300-\U0001f9ff\U00002702-\U000027b0\U0000fe00-\U0000fe0f\U0000200b-\U0000200f\U0000200d]');[print(f'{f}:{i+1}: {l.rstrip()[:80]}') for f in pathlib.Path(sys.argv[1]).rglob('*') if f.suffix in ('.html','.md','.txt') for i,l in enumerate(f.read_text('utf-8').splitlines()) if p.search(l)]" ./
Finds emoji and invisible characters in text files
python unicode #85158709pkg info -r ImageMagick7
Lists packages that depend on a package
freebsd pkg #cf6d78acgzip --best -k file.svg && mv file.svg.gz file.svgz
Compresses SVG to SVGZ
image svg gzip #caaaebbadnf repoquery --installed --whatrequires ImageMagick7
Lists packages that depend on a package
fedora dnf #847e80c7magick main_screen.png -background none -size 20x1 xc:none results.png +append kalkulator-prostih-brojeva-app-pregled.png
Joins images side by side with a gap
image magick #748ccfc2awk -F'[<>]' '/<loc>/ {print $3}' sitemap.xml
Extracts URLs from a sitemap
awk xml #ab594e92sed -n 's/.*<loc>\(.*\)<\/loc>.*/\1/p' sitemap.xml
Extracts URLs from a sitemap
sed xml #ea4b248ftop -o res
Sorts processes by real memory use
freebsd top memory #aa5ac412magick gshock-gw-m5610u-1b.png -fill "#fbfbfe" -opaque "#e6f1f5" -fill "#1c1b22" -opaque "#203a43" gshock-gw-m5610u-1b_darkgrey.png
Swaps two colors in an image
image magick #d0b84284printf 'dev.hwpstate_intel.0.epp=100\ndev.hwpstate_intel.1.epp=100\ndev.hwpstate_intel.2.epp=100\ndev.hwpstate_intel.3.epp=100\n' | sudo tee -a /etc/sysctl.conf && sudo sysrc powerd_enable='NO'
Makes Intel powersave permanent, disables powerd
freebsd cpu power #4a68146fsysctl dev.cpu.0.freq_levels
Single frequency level = use hwpstate_intel, not powerd
freebsd cpu libreboot #c307d528sysctl dev.hwpstate_intel.0.epp=100
Sets Intel CPU to powersave (0 = performance)
freebsd cpu power #e496c66csysctl dev.cpu.0.freq dev.cpu.0.freq_levels dev.cpu.0.cx_supported dev.cpu.0.cx_lowest
Shows CPU frequency and sleep states
freebsd cpu power #baaf9140dd if=Fedora-Workstation-Live.iso of=/dev/da0 bs=1m status=progress
⚠ Writes an ISO to a USB drive
freebsd disk iso dd #570e384cmagick input.xcf -flatten -resize 3000x3000 -strip -quality 92 output.jpg
Converts GIMP XCF to JPEG
image gimp magick #fdf66c44magick rss-icon.png -quality 75 -define webp:method=6 -define webp:pass=10 rss-icon.webp
Converts PNG to small WebP
image webp magick #1a045181magick -background none -density 648 favicon.svg rss-icon.png
Converts SVG to sharp PNG (density = target/source x 72)
image svg magick #5ab78bd5ffmpeg -i tetrakolius_-_tetrahedron.flac -filter_complex "[0:a]avectorscope=s=640x640:rate=25:zoom=1.5:draw=line" -y tetrahedron_phase.mp4
Makes a stereo phase scope video
audio ffmpeg mastering #0e89a5a5ffmpeg -i tetrakolius_-_tetrahedron.flac -filter_complex "pan=mono|c0=c0-c1" -y tetrahedron_side_signal.wav
Extracts the side signal (L minus R)
audio ffmpeg mastering #f3497914adb push ./local_file /sdcard/Download/
Copies a file to Android fast
android adb #36b0a309ffmpeg -i input.wav -af "pan=stereo|c0=c0|c1=-1*c1" phase_flip.wav
Inverts the right channel's phase
audio ffmpeg #444d89eeffmpeg -i input.wav -af "pan=stereo|c0=c0|c1=c0" vangogh.wav
Copies left channel to both sides
audio ffmpeg #0147fd40ffmpeg -i input.wav -codec:a libmp3lame -q:a 0 output.mp3
Converts to V0 MP3
audio mp3 ffmpeg #5201f854ffmpeg -i input.wav -codec:a libmp3lame -b:a 320k output.mp3
Converts to 320k MP3
audio mp3 ffmpeg #6ec315cfmagick input.png -resize 1000x1000 -quality 90 output.jpeg
Resizes to fit 1000 px, saves as JPEG
image magick #ddd2216amagick input.png -define jpeg:extent=1.8MB output.jpeg
Converts to JPEG under 1.8 MB
image magick #ea43b5f8magick cover.png \( -background none -size 200x200 logo.svg \) -gravity SouthEast -geometry +100+100 -composite output.png
Puts a logo in the bottom-right corner
image magick #f22bdec5metaflac --remove --block-type=PICTURE file.flac && metaflac --import-picture-from="cover.jpg" file.flac
Replaces FLAC cover art
audio flac #915f3a9bffmpeg -i input.flac -af loudnorm=I=-12:TP=-2:LRA=7:print_format=summary -c:a flac -sample_fmt s32 -ar 48000 output.flac
Masters to -12 LUFS, -2 dBTP, 24-bit 48 kHz
audio loudness ffmpeg #fe94ed73etcupdate diff | less
Shows your changes to /etc vs stock
freebsd config #e9ec39b7bastille cmd ALL ping -c 1 8.8.8.8
Tests internet access from all jails
freebsd jail bastille #a3ff39efservice pf reload
Reloads PF rules
freebsd firewall pf #75d231dapfctl -nf /etc/pf.conf
Checks pf.conf for errors without loading
freebsd firewall pf #ff639d0afsck -t ufs -f -y /dev/da0p1
Forces a full UFS check and repair
freebsd disk ufs #7ce23e03tunefs -n enable /dev/da0p1
Enables UFS Soft Updates
freebsd disk ufs #ee4e088dtunefs -t enable /dev/da0p1
Enables UFS TRIM
freebsd disk ufs ssd #54c34d92tunefs -j enable /dev/da0p1
Enables UFS journaling (SU+J)
freebsd disk ufs #30476752tunefs -p /dev/da0p1
Shows UFS settings
freebsd disk ufs #1473bf05tunefs -m 0 /dev/da0p1
Frees UFS reserved space (~8%)
freebsd disk ufs #525b5867fsck -t ufs -y /dev/da0p1
Checks and repairs a UFS partition
freebsd disk ufs #baa8f201e2fsck -f /dev/da0p1
Checks and repairs an ext partition
disk ext #00bbb9d1tune2fs -L "NEW_LABEL" /dev/da0p1
Renames an ext partition
disk ext #03221187newfs -U -L "DATA-DISK" /dev/da0p1
⚠ Formats as UFS with Soft Updates and a label
freebsd disk ufs #f8428120sysupgrade -b /tmp/backup.tar.gz
Backs up router config
openwrt backup #96159acfblock info
Lists block devices with UUIDs and labels
openwrt disk #61a24f38whereis -b ansible
Finds a program's binary
search #d81ab3cc/usr/libexec/locate.updatedb
Updates the locate database
freebsd search #88a1b0dfprocstat -f $(pgrep nginx)
Lists a process's open files
freebsd process #954cbaffpfctl -s info
Shows PF firewall status
freebsd firewall pf #a79e6f09service netif restart
⚠ Restarts networking (drops SSH; then run 'service routing restart')
freebsd network #47301596service -e
Lists enabled services
freebsd service #3a7bb71csockstat -4l
Lists listening IPv4 sockets with processes
freebsd network ports #104fe04fkldstat -v
Lists loaded kernel modules
freebsd kernel #defb47depciconf -lv
Lists PCI devices with drivers
freebsd hardware #02be6de2service powerd status
Checks if powerd is running
freebsd power #0967edbasysctl dev.cpu.0.cx_usage
Shows CPU sleep state usage
freebsd cpu power #030a176dsysctl dev.cpu.0.freq_levels
Lists CPU frequency steps
freebsd cpu #ad840f0fsysctl dev.cpu.0.freq
Shows current CPU frequency
freebsd cpu #cd98f46asysctl dev.cpu | grep temperature
Shows CPU temperatures (needs coretemp)
freebsd cpu #58ff22fdtop -P -s 1
Shows per-CPU usage, refreshing every second
freebsd monitoring top #6c7e421dbastille rdr target_jail tcp 8080 80
Forwards host port 8080 to port 80 in a jail
freebsd jail bastille #dbba154ebastille stop target_jail
Stops a jail
freebsd jail bastille #6805f8cbbastille cmd ALL echo 'Hello World'
Runs a command in all jails
freebsd jail bastille #78928119bastille console hlab-ansible-server
Opens a shell in a jail
freebsd jail bastille #51e1fd1ebastille list
Lists jails
freebsd jail bastille #b72b1a08pkg audit -F
Checks packages for known vulnerabilities
freebsd pkg security #4005973cpkg info -as | sort -hk 2
Lists packages by size
freebsd pkg #a7469c92pkg query -e '%a = 0' '%n-%v'
Lists packages you installed explicitly
freebsd pkg #4a27b7ddbectl create -r pre-update-backup
Creates a boot environment before an update
freebsd zfs boot #250b216abectl list
Lists boot environments
freebsd zfs boot #e91e639dzpool scrub zroot
Starts a ZFS scrub
freebsd zfs #3b0df29czpool status -v zroot
Shows pool health, errors and scrub progress
freebsd zfs #83a16992zpool list -v
Shows pool capacity per disk
freebsd zfs #a5f5530bzfs list -o space
Shows ZFS space usage incl. snapshots
freebsd zfs #d77e4789glabel status
Lists labels and their devices
freebsd disk #690b93dcgeom disk list
Lists disks with details
freebsd disk #83102629echo '/dev/ext2fs/DATA_VAULT /mnt/ext_usb ext2fs rw,noauto,failok,noatime 0 0' >> /etc/fstab
⚠ Adds an ext drive to fstab
freebsd disk fstab #5664e38etune2fs -L "DATA_VAULT" /dev/da0p1
Labels an ext partition
disk ext #5ad434aatune2fs -O ^has_journal /dev/da0p1
Removes the journal from ext4
disk ext #181eaa16mke2fs -t ext4 -O ^has_journal -L "DATA-DISK" /dev/da0p1
⚠ Formats as ext4 without journal
disk ext #7fc1282fmke2fs -t ext2 -L "DATA-DISK" /dev/da0p1
⚠ Formats as ext2 with a label
disk ext #031f3d7egpart destroy -F da0 && gpart create -s gpt da0 && gpart add -t linux-data -a 1m -l "DATA-DISK" da0
⚠ Wipes a disk and creates one Linux partition
freebsd disk #a065914bmount -o async,noatime /dev/ufs/DATA-DISK /media/DATA-DISK
Mounts a UFS drive for fast writes (unmount before unplugging)
freebsd disk ufs #e74e2ba9tunefs -L "DATA-DISK" /dev/da0p1
Labels a UFS partition
freebsd disk ufs #2b8dc2f2gpart destroy -F da0 && gpart create -s gpt da0 && gpart add -t freebsd-ufs -l "DATA-DISK" -a 1m da0
⚠ Wipes a disk and creates one UFS partition
freebsd disk ufs #2f3328ddrsync -avhW --no-compress --info=progress2 /source/ /media/DATA-DISK/
Fast local copy to a USB drive
backup rsync #1e886f83dd if=/dev/zero of=/media/DATA-DISK/speedtest.img bs=1M count=1000 conv=fsync status=progress
Measures drive write speed (delete speedtest.img after)
disk benchmark dd #5d0eeac6cmp ./Samsung_SSD_990_PRO_8B2QJXD7.iso /dev/sdb
Verifies a written ISO ('EOF on iso' = OK)
disk iso #c8ab0c15sudo dd if=./Samsung_SSD_990_PRO_8B2QJXD7.iso of=/dev/sdb bs=4M status=progress
⚠ Writes an ISO to a USB drive
linux disk iso dd #a1f844d8: > /path/to/big.log
⚠ Empties a file
file #01b5e79eecho "${SRANDOM}"
Prints a secure random number (bash 5.1+)
random bash #2b366f16shred -vzu -n 5 filename
⚠ Overwrites and deletes a file (useless on SSD, ZFS, Btrfs)
security file #a8c909d2assoc .txt=txtfile
Associates .txt with text files
windows file #9921989cdism /online /export-driver /destination:C:\BackupDrivers
Exports all drivers to a folder
windows backup drivers #3680393enetstat -ano | findstr LISTENING
Lists listening ports with PIDs
windows network ports #deaa6bbftaskkill /F /FI "STATUS eq NOT RESPONDING"
Kills all frozen apps
windows process #b7679d38wmic path softwarelicensingservice get OA3xOriginalProductKey
Shows the OEM product key from firmware (wmic is deprecated)
windows license #9464f57bpython3 -m http.server 8000
Serves the current directory on port 8000 (whole network can see it)
web server python #90c2ee89powercfg /batteryreport
Creates a battery health report
windows battery #2f52cfd9robocopy Source Dest /MIR /MT:8 /R:1 /W:1
⚠ Mirrors a folder, deleting extras in Dest
windows backup #6d2fb045netsh wlan show profile name="SSID" key=clear
Shows a saved Wi-Fi password
windows wifi password #777582d1cipher /W:C:
⚠ Wipes free space on C:
windows security disk #4a6e8366ipconfig /flushdns
Clears the DNS cache
windows network dns #acbd82bbdefrag /c /h /v /b /o
Optimizes all drives (defrag or TRIM)
windows disk #dbd3d032defrag /c /h /v /a
Analyzes fragmentation on all drives
windows disk #a8670093sfc /scannow
Repairs Windows system files
windows #aba642d7cleanmgr /sageset:1
cleanmgr /sagerun:1
Configures and runs Disk Cleanup
windows disk cleanup #1b15f158chkdsk /f /r
Fixes disk errors and bad sectors (slow)
windows disk #5f086775chkdsk /scan
Scans a disk for errors without fixing
windows disk #5aad937cwinget repair [package-name or package-ID]
Repairs a program
windows winget #509677c6winget upgrade --all
Updates all programs
windows winget #a02143ddwinget list
Lists installed programs
windows winget #be71d7cfdnf --assumeno install package1
Previews an install without doing it
fedora dnf #d7c15728apt autoremove --purge
Removes unneeded packages and their config
debian apt cleanup #fbb388bfapt -s install package1 package2
Simulates an install
debian apt #6de4f35aapt remove --purge package1
Removes a package and its config
debian apt #fcf148deapt install --no-install-recommends --no-install-suggests package1 package2
Installs packages without recommends or suggests
debian apt #f23844abfind . -type f -wholename './.meta/artwork/*-release_cover_l.jpeg' -exec bash -c 'magick "$0" -write mpr:img +delete \
\( mpr:img -resize 1920x1920 -crop 1920x1920+0+0 -gravity center -extent 1920x1080 +repage -blur 0x187 -attenuate 10.0 +noise Uniform -modulate 100,75 -blur 0x7 \) \
\( mpr:img -resize 540x540 \) \
\( +clone -background black \) \
\( -clone 2,1 -background none -layers merge +repage \) \
-delete 1,2 \
-gravity center -extent 1920x1080 -compose over -composite -quality 98% -define jpeg:fancy-upsampling=off ".meta/artwork/$(basename ./*.flac ".flac")-video_cover_l.jpeg"' '{}' \;
⚠ Makes a 1920x1080 video background from album art
image magick #e32c63f6MP4Box -info $VIDEO.mp4 2>&1 | grep RFC6381 | awk '{print $4}' | paste -sd , -
Gets codec strings for an HTML5 video tag
video mp4box #ee97b6b7find ./.artwork/jpeg/ -type f \( -name "*.jpeg" -o -name "*.jpg" \) ! -name "*_optimized.jpeg" -exec bash -c 'magick -strip -quality 88 -verbose -limit thread 0 "$0" sixel:- > "${0%.*}.six"' '{}' \;
Converts JPEGs to sixel for terminal display
image sixel magick #32b11ec3find . -type f -wholename '*.flac' -exec bash -c 'ffmpeg -hide_banner -loglevel error -nostats -y -i "$(eval "echo .meta/artwork/*video_cover_l.jpeg")" -i "${0}" -metadata title="$(metaflac --show-tag=TITLE "${0}" | cut -c7-)" -metadata artist="$(metaflac --show-tag=ARTIST "${0}" | cut -c8-)" -metadata album="$(metaflac --show-tag=ALBUM "${0}" | cut -c7-)" -metadata genre="$(metaflac --show-tag=GENRE "${0}" | cut -c7-)" -metadata encoded_by="FFmpeg" -q:v 8 -codec:v libvpx-vp9 -lossless 1 -preset slow -quality good -speed 0 -deadline best -codec:a libopus -b:a 160k -vbr on -compression_level 10 -pix_fmt yuv420p -threads 0 "./${0%.*}_vp9_opus_1080p.webm"' '{}' \;
Turns FLACs into WebM videos with cover art
video ffmpeg #60b592f3git ls-files . --exclude-standard --others
Lists untracked files
git #cec9feabgit ls-files . --ignored --exclude-standard --others
Lists ignored files
git #74491c54Get-ChildItem -Path Cert:\CurrentUser\My | Select-Object -Property Subject, NotAfter
Lists your certificates with expiry dates
windows powershell certificates #5452735egit show b523b86 | grep -i 'JS'
Shows lines of a commit matching a word
git search #8bc0e99egit log -S "specific_variable_name"
Finds commits that added or removed a string
git search #929a3b45lsof -p 1234
Lists files a process has open
process lsof #72c36eebdnf provides /usr/bin/ssh
Finds which package provides a file
fedora dnf #833edaa2dig +trace google.com
Follows DNS resolution from the root servers
network dns #b52992fcopenssl dgst -sha256 myfile
Shows a file's SHA256
checksum openssl #e4aeddc5truncate -s 5G large_dummy_file.img
Creates an empty 5 GB sparse file instantly
file disk #b387cd89git bisect start BAD_COMMIT GOOD_COMMIT
Starts a binary search for the commit that broke something
git #5a9b5ce8iostat -dx 2
Shows disk I/O stats every 2 seconds
disk monitoring #1af8194bnmap -p 22 --open 192.168.1.0/24
Finds hosts with SSH open
network nmap #ffc66478podman inspect bfd59994e8f2
Shows container details
container podman #9dde31e2journalctl --unit=nginx.service --follow --output=json-pretty
Follows nginx logs as JSON
linux systemd log #2a16a122ss -tlpn 'sport = :8080'
Shows what listens on port 8080
linux network ports #3be9bc97php phpstan.phar --memory-limit=4096M analyse --level max ~/index.php
Checks a PHP file with PHPStan at max level
php #bca2e290ionice -c 3 python3 mistat.py generate-all
Runs a script with idle disk priority
linux io #1935021adiff mistat_v3.py mistat_v4.py
Shows differences between two files
text diff #9bdfecf7date -d '2025-06-13 08:22:00 UTC' +%s
Converts a date to a UNIX timestamp (GNU date)
time #dccc15adfind . -type f -wholename '*.flac' -exec bash -c 'DELAY_COMPENSATION=0.2; SMOOTHING_PX=2; FLAC_FILE="$0"; COVER_PATH=".meta/artwork/$(basename "${FLAC_FILE}" ".flac")-video_cover_l.jpeg"; BRIGHTNESS=$(magick "$COVER_PATH" -colorspace Gray -format "%[mean]" info:); VISUALISER_COLOR="white"; BRIGHTNESS_THRESHOLD=35000; if (( $(echo "$BRIGHTNESS > $BRIGHTNESS_THRESHOLD" | bc -l) )); then VISUALISER_COLOR="black"; fi; GEQ_FORMAT="r=r(X,Y):g=g(X,Y):b=b(X,Y):a=st(0,H/2*sin(X/W*PI));st(1,abs(Y-H/2));if(gt(ld(1),ld(0)),0,if(lt(ld(1),ld(0)-%s),alpha(X,Y),alpha(X,Y)*(ld(0)-ld(1))/%s))"; GEQ_FINAL=$(printf "$GEQ_FORMAT" "$SMOOTHING_PX" "$SMOOTHING_PX"); echo "Processing ${FLAC_FILE}. Cover brightness: $BRIGHTNESS. Using visualiser color: $VISUALISER_COLOR. Applying ${DELAY_COMPENSATION}s delay compensation. Applying ${SMOOTHING_PX}px edge smoothing."; ffmpeg -hide_banner -loglevel error -nostats -y -framerate 24 -i "$COVER_PATH" -i "$FLAC_FILE" -filter_complex "[0:v]scale=1920:1080,setsar=1[bg]; [1:a]asplit[a_out][a_viz]; [a_viz]asetpts=PTS-${DELAY_COMPENSATION}/TB[a_viz_shifted]; [a_viz_shifted]showwaves=s=1400x140:mode=cline:colors=${VISUALISER_COLOR}:draw=full:rate=24,format=rgba[waves_hr]; [waves_hr]scale=700:70:eval=init:flags=lanczos[waves]; [waves]geq='\''"$GEQ_FINAL"'\''[waves_faded]; [waves_faded]colorchannelmixer=aa=0.3[waves_transparent]; [bg][waves_transparent]overlay=(W-w)/2:910[outv]" -map "[outv]" -map "[a_out]" -metadata title="$(metaflac --show-tag=TITLE "${FLAC_FILE}" | cut -c7-)" -metadata artist="$(metaflac --show-tag=ARTIST "${FLAC_FILE}" | cut -c8-)" -metadata album="$(metaflac --show-tag=ALBUM "${FLAC_FILE}" | cut -c7-)" -metadata genre="$(metaflac --show-tag=GENRE "${FLAC_FILE}" | cut -c7-)" -metadata encoded_by="FFmpeg" -crf 45 -b:v 0 -codec:v libvpx-vp9 -cpu-used 0 -row-mt 1 -auto-alt-ref 1 -lag-in-frames 25 -g 250 -codec:a libopus -b:a 160k -vbr on -compression_level 10 -frame_duration 60 -application audio -pix_fmt yuv420p -threads 0 "./${FLAC_FILE%.*}_vp9_opus_visualiser_1080p.webm"' '{}' \;
Turns FLACs into WebM videos with cover art and a waveform
video ffmpeg #459528b7cuebreakpoints "tetrakolius - The Best Of.cue" | shnsplit -o flac -f "tetrakolius - The Best Of.cue" -t "%n-%t" "tetrakolius - The Best Of.flac"
Splits a FLAC into tracks using a CUE sheet
audio cue #04277b1afor f in *.wav; do ffmpeg -i "$f" -hide_banner -loglevel error -nostats -vn -ac 1 -c:a libopus -b:a 24k -compression_level 10 -application voip -map_metadata 0 -metadata composer="" -metadata ENCODED-BY="" -metadata comment="" -metadata COMM="" -metadata encoded_by="FFmpeg$(ffmpeg -version | head -n1 | awk '{print $3}')" "${f%.wav}.opus"; done
Converts WAVs to mono 24k Opus for podcasts
audio conversion ffmpeg #8d6ec00efor f in *.wav; do ffmpeg -i "$f" -hide_banner -loglevel error -nostats -ac 1 -c:a libmp3lame -q:a 8 -joint_stereo 1 -compression_level 9 -map_metadata 0 -metadata composer="" -metadata ENCODED-BY="" -metadata comment="" -metadata encoded_by="FFmpeg$(ffmpeg -version | head -n1 | awk '{print $3}')" -id3v2_version 3 "${f%.wav}.mp3"; done
Converts WAVs to mono speech MP3 for podcasts
audio conversion ffmpeg #cfff2e4cfor f in *.flac; do ffmpeg -i "$f" -ab 320k -map_metadata 0 -id3v2_version 3 "${f%.flac}.mp3"; done
Converts FLACs to 320k MP3
audio conversion ffmpeg #7d84d555find . -type f -perm -o+w -ls
Finds world-writable files
security permissions #9ec17d55ip addr show | grep -Eo 'inet (addr:)?([0-9]{1,3}\.){3}[0-9]{1,3}' | grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}'
Shows IPv4 addresses
linux network #baaa6c3bsystemctl list-timers --all
Lists systemd timers
linux systemd #055b3866find . -type f -size +100M -print0 | xargs -0 ls -lh | sort -k5 -h
Lists files over 100 MB by size
disk storage #752d4bc9lsof -i TCP:80
Shows what uses TCP port 80
network ports #9b97e05cps -eo pid,comm,%mem,%cpu --sort=-%mem | head
Shows processes sorted by memory
linux process memory #02fea1defind . -type f -printf '%T+\t%p\n' | sort | head -n 1
Shows the oldest file
file search #6df80697journalctl --disk-usage
Shows journal disk usage
linux systemd log #91cd9884ps aux | awk '{print $1, $2, $3, $4, $11}' | sort -k 4 -rn | head -n 10
Shows top 10 processes by memory
process memory #119624e4echo 'Secret' > ~/.secret_file; history -d $((HISTCMD-1))
Writes a secret without keeping it in bash history
security history #3677363afind "${HOME}/cats" \( -name "*.png" -o -name "*.gif" \) -exec touch -t "$(date +%Y%m%d)0100" {} \;
Sets the date of PNG and GIF files to today 01:00
file touch #82faeb96for d in */; do XZ_OPT="-9e" tar -cvJf "${d%/}.tar.xz" "$d"; done
Archives each directory into its own .tar.xz
archive tar #8555e321for f in *.mp3; do echo "$f: $(soxi -B "$f")"; done
Shows the bitrate of each MP3
audio sox #0f4161dbfind . -name "*.eno" -print0 | tar -czvf eno-backup-$(date '+%Y-%m-%d_%H%M%S').tar.gz --null -T -
Archives all .eno files with a dated name
archive backup tar #182f92adping google.com | awk '{ print strftime("[%Y-%m-%d %H:%M:%S]"), $0; fflush() }'
Adds timestamps to ping output (gawk)
network ping #e185781eping google.com | ts '[%Y-%m-%d %H:%M:%S]'
Adds timestamps to ping output (moreutils)
network ping #84d40744flatpak override --reset com.bitwig.BitwigStudio
Resets a Flatpak's permission overrides
flatpak #773d7c2dflatpak override --show com.bitwig.BitwigStudio
Shows a Flatpak's permission overrides
flatpak #716de86cxdg-settings get default-web-browser
Shows the default browser
linux desktop #70880fccflatpak mask --remove com.bitwig.BitwigStudio
Unblocks updates for a Flatpak
flatpak #95f94fbaflatpak mask
Lists masked Flatpaks
flatpak #7b84bd32flatpak mask com.bitwig.BitwigStudio
Blocks updates for a Flatpak
flatpak #a6a0c5faflatpak update --commit=d46e23d2d45efb8f9b5e38d60abbbeb17cce6ee3d8143918fa4d7f0708b4eee7 com.bitwig.BitwigStudio
Installs a specific Flatpak commit (downgrade)
flatpak #07503932flatpak remote-info --log flathub com.bitwig.BitwigStudio
Shows a Flatpak's commit history
flatpak #63e4d38eSELECT user,host FROM mysql.user;
Lists MySQL users
database mysql #e36f84cbSHOW GRANTS FOR 'ABC'@'%';
Shows a MySQL user's privileges
database mysql #3536ce77find . -maxdepth 1 -type f -name "*.flac" -exec bash -c 'sha256sum "$1" | sed "s|./||" > "$1.sha256"' _ {} \;
Writes a .sha256 file next to each FLAC
audio checksum #061e29dcGet-Process notepad* | Stop-Process -Force
Kills all Notepad windows
windows powershell process #643f81e4taskkill /F /IM ms-teams.exe
Kills Teams
windows process #16fbe55etasklist | findstr /i "teams.exe"
Checks if Teams is running
windows process #1d5ad27dsysteminfo | find /i "original"
Shows the Windows install date
windows #56b12097(Get-Item "C:\Windows\system.ini").CreationTime
Shows the Windows install date
windows #64f4ccc9"{0:N2} MB" -f ((Get-ChildItem -Recurse -File | Measure-Object -Property Length -Sum).Sum / 1MB)
Shows total folder size in MB
windows powershell disk #50b5c940Get-ChildItem -File | ForEach-Object {
$hash = Get-FileHash $_.FullName -Algorithm SHA256
"$($hash.Hash) $($_.FullName)"
}
Lists SHA256 hashes of all files
windows powershell checksum #ce2e3b601..4 | ForEach-Object { -join ((65..90) + (97..122) + (48..57) | Get-Random -Count 10 | % {[char]$_}) }
Generates 4 random 10-character strings
windows powershell random #325203f1php -S 127.0.0.1:8080 -t .
Serves the current directory with PHP on localhost:8080
web server php #29185211for file in *.heic; do magick "$file" "${file%.heic}.jpeg"; done
Converts HEIC photos to JPEG
image conversion magick #35a0eba1git remote rename origin codeberg
Renames a remote
git #ca9bd7bcgit remote -v
Lists remotes
git #2d20a19fgit diff --staged
Shows staged changes
git #d93e6b0efor f in *.flac; do echo "$f"; sox "$f" -n stat; done
Shows audio stats for each FLAC
audio sox #6ebc6ba0ffmpeg -i INPUT.flac -af loudnorm=I=${TARGET_INTEGRATED_LOUDNESS}:TP=${TARGET_TRUE_PEAK}:LRA=${TARGET_LOUDNESS_RANGE}:measured_I=${MEASURED_INPUT_INTEGRATED_LOUDNESS}:measured_TP=${MEASURED_INPUT_TRUE_PEAK}:measured_LRA=${MEASURED_INPUT_LOUDNESS_RANGE}:measured_thresh=${MEASURED_INPUT_THRESHOLD}:offset=${TARGET_NORMALIZATION_OFFSET}:linear=true OUTPUT.flac
Normalizes loudness, second pass (add -ar 48000; output defaults to 192 kHz)
audio loudness ffmpeg #4be82875for f in *.flac; do echo "$f"; ffmpeg -hide_banner -nostats -i "$f" -af loudnorm=print_format=summary -f null -; done
Measures loudness of each FLAC
audio loudness ffmpeg #d0cbe7affree -t -m
Shows memory usage in MB
linux memory #0f726899free -t | tail -n+2 | awk '{($2>0) ? p=$3/$2*100.0 : p=0.0; print "Used " $1 "\t" p "%"}'
Shows memory usage in percent
linux memory #aafb20a6grep -E --color 'Mem|Cache|Swap' /proc/meminfo
Shows memory and swap lines
linux memory #b57efbd2dconf dump / >~/.config/dconf/user.conf
dconf load / <~/.config/dconf/user.conf
Backs up and restores GNOME settings
gnome backup #86c40a5bfor f in *.flac; do sox -S "${f}" -r 44100 -b 16 "${f%.*}"_16bit_44100.flac; done
Converts FLACs to 16-bit 44.1 kHz
audio conversion sox #d307f677for f in *; do ffmpeg -i "$f" -map 0 -map -0:s -codec copy "$f.mkv"; done
Removes subtitles from videos into MKV
video ffmpeg #42f0ffc4find . -type d -name '*.jpeg' -exec rm -r {} +
⚠ Deletes directories named *.jpeg
file cleanup #7e4cd5dbfor f in *; do ffmpeg -i "$f" -f mp4 -c:v libx265 -preset ultrafast -crf 24 -acodec aac "${f%.*}"_x265.mp4; done
Converts videos to H.265 MP4 (fast, larger files)
video ffmpeg h265 #831e98f8gpgconf --list-dirs
Shows GPG directories
gpg #5f41a7e9gpg --list-keys
Lists GPG keys
gpg #32731c64gpgconf --kill gpg-agent
Restarts gpg-agent
gpg #e22ceebdgit commit --amend
Edits the last commit
git #101608c9git config --global tag.gpgSign true
Signs all tags
git gpg #5d722b7egit config --global commit.gpgsign true
Signs all commits
git gpg #470f860fgit config --global user.signingkey ABCBCA
Sets the GPG key for signing
git gpg #e007b92cgit rebase --root --exec 'git commit --amend --no-edit --no-verify -S'
⚠ Re-signs all commits with GPG (rewrites history)
git history gpg #c41d6b28echo 'New Name <new@email.com> <old@email.com>' > ../mailmap
git filter-repo --mailmap ../mailmap --force
⚠ Replaces an old email in all commits (rewrites history)
git history #fc4ee1degit log --all --pretty=format:"%h - %an <%ae>"
Lists commits with hash and author
git #a4ff88f8ledger reg Expenses -S amount
Lists expenses sorted by amount
finance ledger #6848b12aledger bal ^Expenses ^Income --invert
Shows expenses and income, sign inverted
finance ledger #b3b17806ledger -M register Assets -X EUR -n --no-rounding
Shows monthly asset totals in EUR
finance ledger #fe278d21ledger reg -b 09/01 -e 12/01 --subtotal
Shows transactions from Sep 1 to Dec 1, subtotalled
finance ledger #7622cf8dledger bal Expenses --flat -S -amount
Shows expenses as a flat list, largest first
finance ledger #62a75539ledger register Expenses
Lists expense transactions
finance ledger #fba17f0eledger balance Assets --collapse
Shows asset balances, collapsed
finance ledger #02af450eledger balance income expenses --period "this month"
Shows this month's income and expenses
finance ledger #7a8ccb60#!/bin/sh
# Simple logging script with date filtering, colorizing, and Todo.txt compatibility.
TIMESTAMP=$(date "+%Y-%m-%d [%H:%M:%S]")
LOG="${HOME}/.jnrl.log"
CONTEXT="${CONTEXT:-20}"
TODOTXT_TAG='+jnrl'
# Ensure the log file exists
touch "$LOG"
# Colorize timestamp matches in log output
grep_coloring() {
grep --color=always -E "(\[[0-9]{2}:[0-9]{2}:[0-9]{2}|\])" "$@"
}
# Handle date range filtering based on OS type (BSD vs GNU date)
if [ "$1" = "-d" ] && [ "$2" -ge 0 ] 2>/dev/null; then
DATE_RANGE=$(date --date="$2 day ago" "+%Y-%m-%d" 2>/dev/null || date -v "-$2d" "+%Y-%m-%d")
grep "$DATE_RANGE" "$LOG" | grep_coloring
elif [ -z "$*" ]; then
# Show last N lines if no arguments are provided
tail -n "$CONTEXT" "$LOG" | grep_coloring
else
# Log the message with timestamp and Todo.txt tag, escaping special characters
echo "${TIMESTAMP} - $(printf '%q' "$*") $TODOTXT_TAG" >> "$LOG"
fi
Journal script: logs notes with timestamps, filters by day
log script #3cafd293cat <<EOF
(*- { $@ }
//\
v_/_
EOF
Prints a Tux saying the arguments
text #6a54d93apwgen -Bnyc 15 1
Generates a 15-character password
password #83db858dshuf -n 4 --random-source=/dev/urandom /usr/share/dict/words | paste -sd ' ' -
Generates a 4-word passphrase (xkcd 936)
password #0727a4faopenssl rand -base64 16
Generates a 24-character password
password openssl #bdeefed1openssl rand -hex 15 | sha256sum | head -c15 | cut -b -15
Generates a 15-character hex password
password openssl #b4a535d0gpg --gen-random --armor 1 15 | head -c15
Generates a 15-character password
password gpg #868bccd7#!/bin/bash
PODCAST_DOWNLOAD_DIR="${HOME}/Ресурси/Преузимања/Podcasts"
if [ -e "$PODCAST_DOWNLOAD_DIR" ] && [ ! -z "$(command -v ffmpeg)" ]; then
find "$PODCAST_DOWNLOAD_DIR" -type f -name '*.mp3' -execdir bash -c '
PODCAST_FILE="$1"
PODCAST_FILE_LENGTH_IN_SECONDS="1800"
if [[ ! $PODCAST_FILE =~ ^[a-zA-Z0-9]{3}-[0-9]{2}- ]]; then
random_filename_string=$(tr -dc "a-zA-Z0-9" < /dev/urandom | head -c 3)
ffmpeg -i "$PODCAST_FILE" -c:a libmp3lame -q:a 6 -f segment -segment_time ${PODCAST_FILE_LENGTH_IN_SECONDS} -map 0:a -map_metadata -1 "${random_filename_string}-%02d-${PODCAST_FILE##*/}" && rm "$PODCAST_FILE"
fi
' sh {} \;
fi
Splits long podcast MP3s into 30-minute parts
audio ffmpeg script #f08115a3cd "${BACKUP_DESTINATION}" && export XZ_DEFAULTS="-9 -T 0" && tar cJf "${BACKUP_FILENAME}.tar.xz" "$TARGET_PATH" 2>/dev/null && tar -tf "${BACKUP_FILENAME}.tar.xz" 2>/dev/null && sha256sum "${BACKUP_FILENAME}.tar.xz" > "${BACKUP_FILENAME}.tar.xz.sha256" && chown -R ${OWNER_USERNAME}:${OWNER_USERNAME} "${BACKUP_DESTINATION}/${BACKUP_FILENAME}.tar.xz"
Creates a compressed backup, verifies it, writes a checksum
backup archive script #2522e210if [ -z "$(pidof -x "$1")" ]; then "$1" & exit 0; else exit 1;fi
Starts a program only if it isn't already running
process script #0ae37c0dcat myfile.txt | tr -d '\n' | wc -c
Counts characters in a file without newlines
text statistics #a868a8ffGOGC=10 hugo server --environment development --watch --disableFastRender --templateMetrics --templateMetricsHints --buildFuture --buildDrafts
Runs Hugo dev server with drafts and future posts
web hugo #383bd541find . -type d -exec du -h --max-depth=1 {} + 2>/dev/null | sort -rh | head -n "10" | awk -v highlighter="\033[1;32m" -v reset="\033[0m" '{gsub(/[0-9,.]+[MGK]|^0[[:space:]]/, highlighter "&" reset); print}'
Lists the 10 largest directories, sizes highlighted
disk storage #c4689ba7find . -type f -exec du -h {} + 2>/dev/null | sort -rh | head -n "10" | awk -v highlighter="\033[1;36m" -v reset="\033[0m" '{gsub(/[0-9,.]+[MGK]|^0[[:space:]]/, highlighter "&" reset); print}'
Lists the 10 largest files, sizes highlighted
disk storage #616b2ffafind . -type f -name "*.txt" -exec wc -l {} +
Counts lines in all .txt files
text statistics #c7c4c9b3cat /bin/ls | hexdump -C | less
Shows a binary as hex
binary hexdump #11597cfeSELECT random_article_id FROM random_articles WHERE date = DATE('now') LIMIT 1
Gets today's article ID
database sqlite #61403917rsync -avz --delete --prune-empty-dirs \
--exclude='.ignore*' \
--exclude='*.db-wal' \
--exclude='*.db-shm' \
-e "ssh -p $SSH_PORT -C" \
"$LOCAL_FOLDER/" "$REMOTE_USER@$REMOTE_HOST:$REMOTE_FOLDER"
⚠ Syncs a folder to a server over SSH, skipping DB temp files
backup rsync ssh #15dc9b5bpodman exec -d "$client_name" /bin/sh -c "if which apk > /dev/null; then /usr/bin/node_exporter; elif which apt-get > /dev/null; then /usr/bin/prometheus-node-exporter; fi"
Starts Node Exporter inside an Alpine or Debian container
container podman monitoring #27d2edf5podman exec -d "$client_name" sh -c "/usr/sbin/sshd -D -e"
Starts sshd inside a container
container podman ssh #19201333podman exec "$client_name" sh -c "pkill sshd"
Stops sshd inside a container
container podman ssh #d07eceb1podman exec "$client_name" sed -i '/^#\?PubkeyAuthentication /c\PubkeyAuthentication yes' /etc/ssh/sshd_config
Enables SSH key login inside a container
container podman ssh #4cbf58fbpodman machine set my-machine --cpus 4 --memory 4096
Changes a podman VM to 4 CPUs and 4 GB
container podman vm #0139dccfpodman machine init my-machine --cpus 2 --memory 2048
Creates a podman VM with 2 CPUs and 2 GB
container podman vm #0209797epodman container ls -a --filter name="$container" --format "{{.Names}}"
Shows a container's name if it exists
container podman #71418541podman volume prune -f
⚠ Deletes all unused volumes and their data
container podman cleanup #eed766ddpodman auto-update
Updates containers labelled for auto-update
container podman #cfaaae32podman image prune -a -f
Deletes all unused images
container podman cleanup #38aa070ecurl --silent -L "$download_url" -o "$filepath"
Downloads a file quietly, following redirects
web curl #10c66d33git -C ~/my_project log --pretty=format:'%H' --max-count 5
Shows the last 5 commit hashes of a project
git #61761bbdrsync -avz --delete --exclude='.ignore*' -e "ssh -p 2222 -C" /home/user/documents/ user@192.168.1.100:/backup/documents/
⚠ Mirrors a folder to a server over SSH, deleting extras
backup rsync ssh #78bc8ff8rsync -gloptruc --info=progress2 --human-readable --stats --delete-missing-args --delete --delete-excluded --ignore-errors --zc=zstd --exclude='*.log' --exclude='*.tmp' --include='*/' --include='*.jpg' --include='*.png' /home/user/Documents/ /mnt/backup/
⚠ Mirrors Documents to a backup drive, deleting extras (-c = checksum)
backup rsync #c5d22ea9python -m http.server 8899 --bind 127.0.0.1
Serves the current directory on localhost:8899
web server python #daea3e6egit --no-pager show -s --format="%an <%ae>"
Shows author of the latest commit
git #5876c7eejournalctl --unit clamav-clamonacc --since today
Shows today's ClamAV on-access logs
linux security antivirus #1279c23ffind . -type f -exec du -h {} + | sort -r -h | head -n 10
Lists the 10 largest files
disk storage #5ab8d2b4cmark --to html --validate-utf8 --unsafe
Converts Markdown to HTML (raw HTML allowed)
text markdown #46a220ceinxi -v 3 -F -B -z -c 7
Shows full system info with private data hidden
linux hardware #ce07ba0bmpv --loop --audio-display=no
Loops a file in mpv without showing cover art
video mpv #7fa75f15nano --autoindent --backup --boldtext --mouse --nonewlines --nowrap --nohelp --multibuffer --quickblank --smarthome --constantshow --linenumbers --tabstospaces -T 2 --indicator --backupdir="$HOME/.cache" some_file_i_wanna_create.txt
Opens nano with indent, line numbers, 2-space tabs and backups
text nano #d35b7973w3m -no-cookie -no-graph -W
Starts w3m without cookies, plain ASCII
web browser #5a262c03elinks -anonymous 1 -no-home 1 -no-connect 1
Starts ELinks without saving anything
web browser #557f3b5bcurl -Is -H "Accept-Encoding: gzip,deflate,br" https://durad.xyz | grep -i "content-encoding"
Checks if a site serves compressed responses
web curl #72b1b515netstat -tupan
Lists connections and listening ports with processes
linux network ports #5367f107ps aux | sort -nr -k 4 | head -5
Shows top 5 processes by memory
process memory #b8b893c2dumpe2fs -h /dev/root | grep -i created
Shows when the root filesystem was created (install date)
linux disk #131221d6find -not -empty -type f -printf "%s\n" | sort -rn | uniq -d | xargs -I{} -n1 find -type f -size {}c -print0 | xargs -0 md5sum | sort | uniq -w32 --all-repeated=separate
Finds duplicate files, comparing sizes first (faster)
file duplicates #99ef4c08find . ! -empty -type f -exec md5sum {} + | sort | uniq -w32 -dD
Finds duplicate files by checksum
file duplicates #863fb7afecho 'BUS=="usb", OPTIONS+="ignore_device"' > /etc/udev/rules.d/971-usb-lockdown.rules
⚠ Blocks USB devices (obsolete udev syntax; use USBGuard)
linux security usb #0a852cc6udevadm control --reload-rules && udevadm trigger
Reloads udev rules and applies them
linux udev #858e7f4ecryptsetup benchmark
Benchmarks disk encryption ciphers
linux security encryption #3312141fcat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 10 | head -n 4
Generates 4 random 10-character strings
random #03a922a3journalctl -b2
Shows logs of boot #2 from the oldest (-b -1 = previous boot)
linux systemd log #0c0f245ffor file in *; do zip -r "${file%.*}.zip" "$file"; done
Zips each file or folder into its own archive
archive zip #2cd1d25cpactl set-sink-volume @DEFAULT_SINK@ +2%
Raises volume by 2%
audio pulseaudio #b9f75935smartctl -l selftest /dev/sdX
Shows SMART self-test results
disk health smart #ca201542smartctl -t short /dev/sdX
Starts a short SMART self-test
disk health smart #7675d697smartctl -a /dev/sdX
Shows SMART health of a disk
disk health smart #58df33c0find $DIR_PATH -type f -exec chmod 644 {} \;
Sets all files to 644
permissions chmod find #ac401984find $DIR_PATH -type d -exec chmod 755 {} \;
Sets all directories to 755
permissions chmod find #c2a8e4aefor f in *.ass; do ffmpeg -i "$f" -c:s srt "${f%.*}".srt; done
Converts .ass subtitles to .srt
video subtitles ffmpeg #0f7d0e84for f in *.flac; do sox -S "${f}" -r 44100 -b 16 ./resampled/"${f%.*}"_16bit_44100.flac; done
Converts FLACs to 16-bit 44.1 kHz into ./resampled
audio conversion sox #fe51bafexsetroot -cursor_name left_ptr
Sets the default X11 cursor
x11 desktop #fcc3e8a3iw list
Shows Wi-Fi hardware capabilities
linux wifi hardware #1354d119for file in *.html; do printf "$file\t$(cat $file | wc -c | xargs printf "%'d\n")\t$(gzip -9c $file | wc -c | xargs printf "%'d\n")\t$(brotli -cZ $file | wc -c | xargs printf "%'d\n")\n"; done | tee
Compares raw, gzip and brotli sizes of HTML files
web compression #3aa775advboxsdl --startvm $VM_NAME
Starts a VirtualBox VM in a plain SDL window
vm virtualbox #c7bedee0vboxmanage modifyvm Debian5 --nic1 bridged --cableconnected1 on --bridgeadapter1 eth0
Bridges a VirtualBox VM's network to eth0
vm virtualbox network #b175b3f0vboxmanage hostonlyif remove vboxnet0
Removes a VirtualBox host-only network
vm virtualbox network #40f473eavboxmanage storagectl $VM_NAME --name "IDE Controller" --add ide --controller PIIX4
Adds an IDE controller to a VirtualBox VM
vm virtualbox #c5a50a48vboxmanage modifyvm $VM_NAME --memory 1024 --vram 128 --accelerate2dvideo on --accelerate3d off --audio alsa --cpuexecutioncap 85 --ostype WindowsXP
Sets VirtualBox VM memory, video and CPU options
vm virtualbox #c4fc3f46vboxmanage createhd --filename $VM_HDD_PATH --size 35000 --variant fixed
Creates a fixed 35 GB VirtualBox disk
vm virtualbox disk #91c6f8bdvboxmanage unregistervm $VM_NAME --delete
⚠ Removes a VirtualBox VM and deletes its disks
vm virtualbox #f007dc64vboxmanage registervm $VM_PATH
Registers an existing VirtualBox VM
vm virtualbox #ca277418vboxmanage createvm --name "Debian" --ostype "Debian_64" --register
Creates a VirtualBox VM
vm virtualbox #14b4acb6stat -c %a .bashrc
Shows file permissions as a number (GNU stat)
permissions #4fa9a035rfkill unblock all
Unblocks Wi-Fi and Bluetooth
linux wifi bluetooth #2c2c4d71printf "file '%s'\n" input1.mp4 input2.mp4 > list.txt && ffmpeg -f concat -safe 0 -i list.txt -c copy output.mp4
Joins videos without re-encoding
video ffmpeg #1de7bf26/etc/init.d/alsa-utils reset 0
Resets ALSA sound settings
linux audio #20a307e2systemctl set-default graphical.target
Boots into the graphical desktop by default
linux systemd boot #c75b9597flatpak remote-ls flathub | grep org.gtk.Gtk3theme
Lists GTK3 themes on Flathub
flatpak theme #1f90b3f0ausearch -c 'hl2_linux' --raw | audit2allow -M my-hl2linux
Builds an SELinux policy module from denials
fedora selinux #5dcb3f52grub2-mkconfig -o /boot/grub2/grub.cfg
Regenerates the GRUB config
fedora grub boot #a8042839sealert -a /var/log/audit/audit.log
Explains SELinux denials
fedora selinux log #e6aa6e05setsebool -P selinuxuser_execheap 0
⚠ Forbids user heap execution (secure default; 1 allows it)
fedora selinux #15cd1dc9setsebool -P allow_execheap 0
⚠ Forbids heap execution (secure default; 1 allows it)
fedora selinux #30d0d9f5fixfiles onboot
Relabels SELinux on next boot
fedora selinux #b82491bajournalctl --vacuum-time=2weeks
Deletes journal logs older than 2 weeks
linux systemd log #6a7215e0dmesg | grep -i ahci
Shows AHCI messages from the kernel log
linux disk #a091f390dd if=/dev/zero of=./largefile bs=7M count=256 conv=fsync
Measures disk write speed (delete largefile after)
disk benchmark dd #6ee0a8f7restorecon -r -v /
Restores SELinux labels on the whole system
fedora selinux #19e743b8vnstat --add -i wlp6s0
Adds an interface to vnStat
network vnstat #684de7d5vnstat --iflist
Lists interfaces vnStat can monitor
network vnstat #c7bff012package-cleanup --oldkernels --count=5
Removes all but 5 kernels (legacy yum)
fedora cleanup kernel #787e465egsettings list-recursively | grep -i Epiphany
Lists GNOME Web settings
gnome config #cc0b82d3sed -i 's/^installonly_limit=.*/installonly_limit=4/' /etc/dnf/dnf.conf
Keeps at most 4 kernels
fedora dnf config #8789a119dnf remove $(dnf repoquery --installed --latest-limit=-2 -q)
Removes all but the 2 newest versions of multi-version packages
fedora dnf cleanup #8f6120f0echo "never" > /sys/kernel/mm/transparent_hugepage/defrag
Disables transparent hugepage defrag
linux kernel memory #f307a20eauthconfig --disablefingerprint --update
Disables fingerprint login (legacy; use authselect)
fedora security #a80928a0tracker status
Shows Tracker indexing status (tracker3 on v3)
gnome tracker #fe4010b2tracker daemon -t
Stops Tracker indexing (tracker3 on v3)
gnome tracker #533259fcecho "blacklist firewire-core" >> /etc/modprobe.d/firewired.conf
Blocks the FireWire module from loading
linux kernel module #c8ef35b5SELECT * FROM categories ORDER BY name ASC;
Lists categories sorted by name
database #543add80dnf grouplist -v
Lists DNF package groups
fedora dnf #55946369qemu-img create -f qcow2 -o preallocation=off <disk-name> <disk-size>
Creates a thin QCOW2 disk image
vm qemu disk #40903d3cvirsh pool-destroy default
Stops a libvirt storage pool (deletes nothing)
vm libvirt #d7dcc9f2virsh pool-dumpxml default > pool.xml
Saves a libvirt storage pool config to XML
vm libvirt #0a735a5dpkcon refresh force -c -1
Refreshes PackageKit metadata
fedora packagekit #001229a2sed -i 's/^.*KeepCache=.*$/KeepCache=false/' /etc/PackageKit/PackageKit.conf
Stops PackageKit keeping a package cache
fedora packagekit cleanup #2f7add0fdnf clean all --releasever=41
Clears the DNF cache
fedora dnf cleanup #b52a2adegsettings set org.gnome.software download-updates false
Stops GNOME Software auto-downloading updates
gnome config #1ce466a3chmod a+x ~/.local/share/gnome-boxes
Lets other users enter the gnome-boxes directory
permissions chmod #4ba8c093gnome-extensions enable system-monitor@gnome-shell-extensions.gcampax.github.com
Enables a GNOME extension (needs full UUID)
gnome extension #41405996dnf config-manager --set-disabled fedora-modular
Disables the fedora-modular repo (legacy)
fedora dnf #dd1db21cdnf module reset $MODULE_NAME
Resets a DNF module (legacy)
fedora dnf #ef67fcbddnf module list --enabled
Lists enabled DNF modules (legacy)
fedora dnf #95996c6adnf list installed '*.i*86'
Lists installed 32-bit packages
fedora dnf #08f22c5bperl -c somescript_or_module.pl
Checks Perl syntax without running
perl #b3572d1ahwclock --hctosys
Copies hardware clock time to the system
time hardware #930ce433hwclock --systohc
Copies system time to the hardware clock
time hardware #eca48b77dnf install @container-tools -y
Installs container tools
fedora dnf container #a8fe10d5rpm-ostree install --idempotent gnome-shell-extension-caffeine
Layers a package; no error if already installed
fedora rpm-ostree #78f2b9e9freshclam
Updates ClamAV virus definitions
security antivirus #24d71dbadnf --setopt=strict=0 --setopt=install_weak_deps=False install nano
Installs nano without weak dependencies
fedora dnf #b38d668dfind ~/mail/example@domain.com/ -type d -name "cur" -print0 | xargs -0 -I {} find {} -type f -mtime +7 ! -ipath '*/.Archive/*' -print0 | xargs -0 rm -f
⚠ Deletes mail older than 7 days, except archives
web cpanel mail cleanup #cc29eb9afind ~/logs ~/access-logs ~/tmp/{analog,awstats,webalizer,webalizerftp} -type f \( -name "*.log" -o -name "*.txt" -o -name "*.rs" -o -name "*90a3ac" \) -exec sed -i -E '/djura|dura|80a5ai3dd|tetrakolius|--90a3ac/Id' {} +
Deletes log lines matching keywords
web cpanel log cleanup #bde9eec2find ~/logs ~/access-logs ~/tmp/{analog,awstats,webalizer,webalizerftp} -type f \( -name "*.log" -o -name "*.txt" -o -name "*.rs" -o -name "*90a3ac" \) -exec grep -H -E 'djura|dura|80a5ai3dd|tetrakolius|--90a3ac' {} \;
Searches logs for keywords
web cpanel log search #b805ce6cfind ~/logs ~/access-logs ~/tmp/{analog,awstats,webalizer,webalizerftp} ~/.trash -type f \( -name "*djura*" -o -name "*dura*" -o -name "*80a5ai3dd*" -o -name "*tetrakolius*" -o -name "*90a3ac" \) -mtime 0 -exec rm -f {} \;
⚠ Deletes today's log files matching keywords
web cpanel log cleanup #e64eb0d9sed -i.bak -e '/^#ControllerMode = dual/s/^#//; /^ControllerMode = le/!s/^ControllerMode = dual$/ControllerMode = le/' -e '/^#AutoEnable=true/s/^#//; /^AutoEnable=false/!s/^AutoEnable=true$/AutoEnable=false/' /etc/bluetooth/main.conf
Sets Bluetooth to LE-only and off at boot (breaks classic devices)
linux bluetooth config #7f190ed6find . -type f | sed -rn 's|.*/[^/]+\.([^/.]+)$|\1|p' | sort | uniq -c | sort -rn
Counts files by extension
file statistics #d027a413echo '<device screen="0" driver="dri2"><application name="Default"><option name="vblank_mode" value="0"/></application></device>' > ~/.drirc
Disables vsync for OpenGL apps via Mesa (overwrites ~/.drirc)
linux gpu mesa #60063181cat /sys/kernel/debug/dri/*/radeon_pm_info
Shows power stats for old radeon-driver GPUs
linux gpu amd #ca1ec169cat /sys/class/drm/card*/device/power_dpm_force_performance_level
Shows the AMD GPU power level
linux gpu amd #b377a312sysctl -w kernel.sysrq=1
⚠ Enables Magic SysRq keys (REISUB)
linux kernel recovery #59a69d02cat /dev/urandom > /dev/pcspkr
Sends noise to the PC speaker (legacy device)
linux audio #9063a9bbpacat /dev/urandom
Plays white noise (loud!)
linux audio #a3b82f1cpasswd -l root
⚠ Locks root password login
security #860daa00dd if=/dev/urandom of=/dev/null status=progress
Measures random generator speed
benchmark dd #98baef9bsysctl kern.geom.debugflags=0x10
⚠ Allows writing to disks in use, incl. boot code (set back to 0 after)
freebsd disk #6be61cfcecho -e "* hard nproc 2500\n@users hard nproc 3250\nroot hard nproc 3250\n* hard core 0\n* hard maxlogins 2" | sudo tee -a /etc/security/limits.conf
Adds process, core dump and login limits
linux security limits #e409b199ulimit -aH
Shows hard resource limits
limits #2258f249find . -type f \( -name "*.[Pp][Nn][Gg]" -o -name "*.[Jj][Pp]*[Gg]" -o -name "*.[Gg][Ii][Ff]" -o -name "*.[Ww][Ee][Bb][Pp]" \) -exec exiftool -overwrite_original -all= {} \;
Strips metadata from all images with exiftool
image metadata privacy #6e8e91d4find . -type f -iname '*' -exec exiftool -overwrite_original -all= {} \;
Strips metadata from all files with exiftool
image metadata privacy #9bf4f59efind . -type f \( -name "*.[Pp][Nn][Gg]" -o -name "*.[Jj][Pp]*[Gg]" -o -name "*.[Gg][Ii][Ff]" -o -name "*.[Ww][Ee][Bb][Pp]" \) -exec exiv2 -da rm {} \;
Strips metadata from all images
image metadata privacy #57b682d0find . -type f -iname '*' -exec exiv2 -da rm {} \;
Strips metadata from all files exiv2 supports
image metadata privacy #95ef6240find . -name "*.[Jj][Pp]*[Gg]" -printf ' jpegoptim > %p\n' -exec jpegoptim -f --strip-none --overwrite --quiet {} \;
Losslessly optimizes all JPEGs with jpegoptim
image jpeg compression #0b578d3cfind . -name "*.[Jj][Pp]*[Gg]" -printf ' jpegtran > %p\n' -exec sh -c 'jpegtran -optimize -copy all "$1" > "$1.tmp" && mv "$1.tmp" "$1"' _ {} \;
Losslessly optimizes all JPEGs with jpegtran
image jpeg compression #6293084efind . -name "*.[Gg][Ii][Ff]" -printf ' gifsicle > %p\n' -exec gifsicle --batch --no-warnings --no-comments --optimize=3 {} \;
Optimizes all GIFs with gifsicle
image gif compression #208cc4e7find . -name "*.[Pp][Nn][Gg]" -printf ' pngcrush > %p\n' -exec pngcrush -ow -rem alla -reduce -brute -q -warn {} \;
Losslessly compresses all PNGs with pngcrush
image png compression #8301ac64find . -name "*.[Pp][Nn][Gg]" -printf ' optipng > %p\n' -exec optipng -preserve -clobber -nc -nb -o7 -zm1-9 -quiet {} \;
Losslessly compresses all PNGs with optipng
image png compression #ac71da16find . -name "*.[Pp][Nn][Gg]" -printf ' oxipng > %p\n' -exec oxipng -ao max -Z -q {} \;
Losslessly compresses all PNGs with oxipng
image png compression #6ed2992aflatpak uninstall --unused
Removes unused Flatpak runtimes
flatpak cleanup #e3e9632fflatpak uninstall --delete-data org.gnome.TextEditor
⚠ Uninstalls a Flatpak app and deletes its data
flatpak cleanup #8e8e1bfeqemu-img convert -f vdi -O qcow2 [VBOX-IMAGE.vdi] [KVM-IMAGE.qcow2]
Converts a VirtualBox disk to QEMU/KVM format
vm qemu disk #b4575354VBoxManage modifyhd [VDI] --resize [megabytes]
Resizes a VirtualBox disk
vm virtualbox disk #97d23292VBoxManage clonehd [old-VDI] [new-VDI] --variant Fixed
Clones a VirtualBox disk (fixed size)
vm virtualbox disk #d56315f0VBoxManage clonehd [old-VDI] [new-VDI] --variant Standard
Clones a VirtualBox disk (dynamic size)
vm virtualbox disk #928f97e0avahi-browse -alr
Lists mDNS services on the network
linux network mdns #84e044a3firewall-cmd --add-service=http --permanent
Opens HTTP in the firewall permanently (applies after --reload)
linux firewall #8b239806firewall-cmd --add-service=http
Opens HTTP in the firewall until reboot
linux firewall #35dcf230echo -e '[device]\nwifi.scan-rand-mac-address=yes\n\n[connection]\nwifi.cloned-mac-address=random\nethernet.cloned-mac-address=random\nconnection.stable-id=${CONNECTION}/${BOOT}' > /etc/NetworkManager/conf.d/00-macrandomize.conf
⚠ Randomizes MAC addresses in NetworkManager
linux network privacy #8880f0aeecho 'none' > /sys/class/leds/ath9k_htc-phy0/trigger
Turns off a Wi-Fi dongle's LED
linux hardware led #733b7b0flogread -t | grep -iE '(warn|crit|err)'
Shows warnings and errors from the system log
openwrt log #14a7e2cecat /sys/kernel/debug/iee*/phy*/airtime_flags
Shows Wi-Fi airtime fairness flags
openwrt wifi airtime #cedafb36cat /sys/kernel/debug/iee*/phy*/netdev:wlan*/stations/*/aql
Shows Airtime Queue Limits per Wi-Fi client
openwrt wifi queue #f60e2f78cat /sys/kernel/debug/iee*/phy*/aql_enable
Shows whether Airtime Queue Limits are enabled
openwrt wifi queue #ae19ef37cat /sys/kernel/debug/iee*/phy*/netdev:wlan*/stations/*/peer_ps_state
Shows power-save state of each Wi-Fi client
openwrt wifi power #610f19cfcat /sys/kernel/debug/iee*/phy*/netdev:*/aqm
Shows Wi-Fi queue management (aqm) stats
openwrt wifi queue #5cc920a7find /sys/kernel/debug/iee*/phy* -name aqm
Finds the Wi-Fi queue management (aqm) files
openwrt wifi queue #c0129fc6grep -iE '(BEAMFORME|ANTENNA)' /var/run/hostapd*.conf
Shows beamforming and antenna settings of the Wi-Fi AP
openwrt wifi config #cd045ef4nmap -p0-65535 127.0.0.1 -T5
Scans all ports on localhost
network security nmap #9d41cd23netstat -lntu
Lists listening TCP and UDP ports
network ports #8af38debss -lntu
Lists listening TCP and UDP ports
linux network ports #c958c506hdsentinel -solid | awk '{print "[\t" $3 "% \t] "$5}'
Shows SSD/HDD health percentage
disk health #3eef4cfcdd if=/dev/zero of=/dev/sdX bs=512 status=progress
⚠ Zeros an entire disk
disk wipe dd #b84a76e3dd if=/dev/zero of=/dev/sdX bs=512 count=1 status=progress
⚠ Zeros the first sector of a disk (kills MBR; GPT needs wipefs -a)
disk wipe dd #857e350efstrim -v /
TRIMs the root filesystem on an SSD
linux disk ssd #6cdf0fbcgrep . /sys/block/sd?/queue/scheduler
Shows the I/O scheduler of each disk
linux disk config #5ddb9db0for f in /sys/block/sd?/queue/scheduler; do printf "$f is "; cat $f; done
Shows the I/O scheduler of each disk
linux disk config #9eeb2346grep . /sys/block/sd?/queue/rotational
Shows whether each disk is an HDD (1) or SSD (0)
linux disk hardware #c1dd31c1for f in /sys/block/sd?/queue/rotational; do printf "$f is "; cat $f; done
Shows whether each disk is an HDD (1) or SSD (0)
linux disk hardware #6c7aac47dmesg | grep -i 'ata link up'
Shows SATA link speeds from the kernel log
linux disk hardware #d6d590fdseq 3 | xargs -P0 -n1 md5sum /dev/zero
Loads three CPU cores until Ctrl+C
cpu stress-test #418a34c3yes > /dev/null &
Loads one CPU core (kill it when done)
cpu stress-test #3e1ff389dd if=/dev/urandom | bzip2 -9 >> /dev/null
CPU stress test: compresses random data with bzip2
cpu benchmark stress-test #8f4ad938dd if=/dev/zero of=/dev/null
Measures memory copy speed with dd (no disk involved; Ctrl+C to stop)
benchmark dd #0d918498watch -n 2 cpupower monitor
Shows live CPU frequency and power states every 2 seconds
linux cpu monitoring #5c1e3866perf stat -a sleep 2
Shows system-wide CPU performance counters for 2 seconds
linux cpu benchmark #7f115b79@reboot echo -n $USER_DEFINED > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold
Crontab line: sets the ondemand threshold at boot
linux cpu power cron #0c0bf704crontab -e -u pretzel
Edits another user's crontab
cron #4b2c818becho "SUBSYSTEM==\"module\", ACTION==\"add\", KERNEL==\"acpi_cpufreq\", RUN+=\"/bin/sh -c 'echo -n $USER_LIMIT > /sys/devices/system/cpu/cpufreq/ondemand/up_threshold'\"" > /etc/udev/rules.d/50-scaling-governor.rules
⚠ Creates a udev rule that sets the ondemand threshold when acpi_cpufreq loads
linux cpu power udev #ca9cb939echo -n $USER_LIMIT > '/sys/devices/system/cpu/cpufreq/ondemand/up_threshold'
Sets the ondemand governor's load threshold
linux cpu power #b0c9a2decpupower -c $CPU_CORES frequency-set -g performance
Sets selected CPU cores to the performance governor
linux cpu power #b31bb02acpupower frequency-set -g performance
Sets the CPU governor to performance
linux cpu power #60cd8659cat /sys/devices/system/cpu/cpufreq/boost
Shows whether CPU boost is enabled
linux hardware cpu power #da312980lscpu
Shows a CPU summary: cores, threads, architecture
linux hardware cpu #6fd17ad5cat /proc/cpuinfo
Shows detailed CPU info
linux hardware cpu #e11a2e3bglxinfo | grep memory
Shows GPU memory info from OpenGL
linux hardware gpu #772a0555lspci -vvv | grep modules
Shows kernel modules for PCI devices
linux hardware drivers #8d09da26lsusb -vs 006:001
Shows details of one USB device
linux hardware usb #8dcb889blspci -vs 0a:00.0
Shows details of one PCI device
linux hardware pci #85c1b0fflspci | grep VGA
Shows the graphics card
linux hardware gpu #5fbebcc7find ~/logs/{daily,monthly,weekly} -type f \( -name "*.log" -o -name "*.txt" \) -print0 | xargs -0 sed -i -E '/monday|tuesday/Id'
Deletes lines containing 'monday' or 'tuesday' from log and text files
log cleanup sed find #ed16e668find . -type f -size +50000k -exec cp -nv {} ./ \;
Copies files larger than ~50 MB from subdirectories into the current directory
file copy find #4a831fc3find . -type f -name "*.log" -mtime +10 | xargs grep -iEn "(Error 403|Error 404)"
Searches logs older than 10 days for 403/404 errors
log search find grep #94fab188find . -maxdepth 1 -type f -name "*apache*" -mtime +10 -exec echo {} \;
Lists files with 'apache' in the name older than 10 days
file search find #7ee0e860find . -name "*.pdf" -type f -print0 | xargs -0 /bin/rm -f
⚠ Deletes all PDFs, safe with spaces in names
file cleanup find xargs #2107611cfind . -name "*.pdf" -type f -delete
⚠ Deletes all PDFs in the current tree
file cleanup find #7900cb2afind . -iname "*.jpeg" -execdir mv -i '{}' cover.jpeg \;
Renames every .jpeg to cover.jpeg in its own directory, asking first
file rename find #1b6bbfdcfind . -name "*.pdf" -exec cp {} ~/Documents \;
Copies all PDFs from subdirectories into ~/Documents
file copy find #f5611918sed -i 's/^.*NAutoVTs=.*$/NAutoVTs=2/' /usr/lib/systemd/logind.conf
Sets NAutoVTs=2 in logind.conf (updates overwrite /usr/lib; prefer a drop-in in /etc)
systemd config sed #2373c356sed -i 's/^String=.*$/New String = 22/' file.txt
Replaces lines starting with 'String=' in a file (GNU sed; BSD needs -i '')
text sed #96b8bd14dmidecode | awk '/(\t)+Size/{$1=""; print $0 }'
Shows RAM module sizes from dmidecode
hardware memory awk #23dc390dawk '/(\t)+Size/{$1=""; print $0 }'
Prints lines with 'Size' after tabs, without the first field
text awk #02e1f89fgrep -R 'search-string' ~/Some/Path/
Searches for a string in all files under a directory
text search grep #6982f37bgrep -i -B 3 -A 5 'something something'
Finds a phrase and shows 3 lines before and 5 after each match
text search grep #f8de002dgrep -iE '(Word1|Word2|Word3)'
Finds lines containing any of the words, case-insensitive
text search grep #470be60dawk -v SEPARATOR="," '{print $1 " " SEPARATOR " " $2 " " SEPARATOR " " $3}'
Adds a comma between the printed fields ($1, $2, and $3) in the output
text awk #b9c5a8e4