Commands Collection
Collection of helpful Linux commands.
List File With Leading Line Numbers
List group of files
Generate and Read QR Codes
# Generate
$ echo "some data" | base64 -w 0 | qrencode -l Q -t SVG -o /tmp/qr.svg
# Read
$ zbarimg -q /tmp/qr.svg | cut -c 9- | base64 -d
Generate Duplex PDF from Single Page Scan
# Change order of even pages
$ /usr/bin/pdftk EvenPages.pdf cat end-1 output BackWardsEvenPages.pdf
# Merge even and odd pages
$ /usr/bin/pdftk ODD=OddPages.pdf EVEN=backWardsEvenPages.pdf shuffle ODD EVEN output FinalDocument.pdf
# Remove last blank page, if necessary
$ /usr/bin/pdftk FinalDocument.pdf cat 1-r2 output FinalDocumentWithoutLast.pdf
Media Files
Download Videos
Provide a selection of possible variations of audio and video format.
Download with multiple audio tracksdocker run --user="1000:1000" --rm -it --volume=.:/downloads:rw jauderho/yt-dlp:latest -f "bv*+ba/best" "${1}"
Rename mass files
Rename Media Files to Create Date
$ exiftool -d '%Y-%m-%d_%H%M%S.%%e' '-filename<CreateDate' -v 1 *
$ exiftool -d '%Y-%m-%d_%H%M%S.%%e' '-filename<DateTimeOriginal' -v 1 *
Rename File based on Modified Date
Copy Metadata Media
Geotag Pictures
-geosync defines offset in hours
Create Empty File
# create file with size but does not allocate space on disc
truncate -s 1G foo.file
# create file with size also llocate space on disc
fallocate -l 1G foo.file
Remove DRM from PDF
# Login to Adobe DRM
$ adept_activate --username ADOBE_LOGIN_USERNAME --password ADOBE_LOGIN_PASSWORD
# Download PDF from ASCM File
$ acsmdownloader --acsm-file downloadfile.ascm --output-file outputfile
# Remove DRM
$ adept_remove TMPOUT
Rename File in Folder to Lowercase
Convert
Convert AVI to mp4
Convert Markdown to PDF
# Set alias
$ alias pandocker="docker run --rm --volume "`pwd`:/data" --user `id -u`:`id -g` pandoc/latex:2.6"
#Use the command
$ pandocker in.md -o out.pdf
Clear log journal
ZFS
Destroy all Snapshots from Dataset
Remote RDP connection Gnome Shell
# Enable RDP
$ gsettings set org.gnome.desktop.remote-desktop.rdp enable true
$ gsettings get org.gnome.desktop.remote-desktop.rdp view-only false
# Get Fingerprint of Encryption Certificate
$ openssl x509 -in ~/.local/share/gnome-remote-desktop/certificates/rdp-tls.crt -noout -text -fingerprint -sha256
# Disable RDP
$ gsettings set org.gnome.desktop.remote-desktop.rdp enable false
$ gsettings get org.gnome.desktop.remote-desktop.rdp view-only true