Skip to content

Instantly share code, notes, and snippets.

@andrashann

andrashann/cl.sh

Last active Oct 7, 2020
Embed
What would you like to do?
Command line notes – a collection of useful one-liners
# Copyright 2019 A. H.
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# EXIFTOOL
# Add coordinates to images in folder from gpx file
exiftool -P -overwrite_original -geotag=track.gpx /path/to/images
# Name files according to EXIF date and timestamp
exiftool -ext jpg -ext mp4 '-filename<CreateDate' -d '%Y-%m-%d %H.%M.%S%%-c.%%e' ../exiftool_test/
# Delete all EXIF information
exiftool -all= foo.jpg
# Modify file modification/creation date to match EXIF data
exiftool '-DateTimeOriginal>FileModifyDate' foo.jpg
# Modify EXIF creation date to match filename for files in this folder
exiftool "-createdate<filename" "-datetimeoriginal<filename" -overwrite_original_in_place ./
# FFMPEG
# Combine image files as video
cat *.jpg | ffmpeg -f image2pipe -r 24 -vcodec mjpeg -i - -vcodec libx264 out.mp4
# Trim video from -ss to length -t
ffmpeg -i input.mp4 -ss 00:29:21 -t 00:02:26 -async 1 -c copy output.mp4
# convert .mov from fcpx into much smaller mp4
ffmpeg -i input.mov -c:v libx264 -c:a aac -strict experimental output.mp4
# YOUTUBE-DL
# Download with subtitles
youtube-dl url -o output.mp4 --write-sub
# Download audio only from
youtube-dl -f 'bestaudio[ext=m4a]' 'http://youtu.be/videoid'
# GHOSTSCRIPT
# Convert all text to curves in PDF
gs -o file-with-outlines.pdf -dNoOutputFonts -sDEVICE=pdfwrite input-file.pdf
# MKGMAP
# Combine multiple img files into one
java -jar mkgmap.jar --gmapsupp a.img b.img c.img typ.TYP
# MP3INFO
# Print mp3 file names with track lengths of files in current folder
mp3info -p "%f: %m:%02s\n" *.mp3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment