Last active
January 11, 2021 19:51
-
-
Save thomascrepain/8216248 to your computer and use it in GitHub Desktop.
Command line magic Cheat Sheet - much used but not remembered
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Search & replace over multiple files (Linux) | |
find . -type f -print0 | xargs -0 sed -i 's/foo/bar/g' | |
# Search & replace over multiple files (Mac OS X) | |
find . -type f -print0 | xargs -0 sed -i '' -e 's/foo/bar/g' | |
# remove empty files in a directory | |
find /tmp -size 0 -print0 |xargs -0 rm | |
# Run command in multiple directories | |
for dir in ./*; do (cd "$dir" && echo "$dir" && cowsay "boo"); done | |
# SSH: bind remote port ([bind_address:]port:host:hostport) | |
ssh -L 3306:localhost:3306 [email protected] | |
# Xdebug on vagrantbox | |
ssh -R 9000:localhost:9000 [email protected] | |
# Write disk image to SD-card | |
df -h | |
sudo umount /dev/mmcblk0p1 | |
xzcat ~/Downloads/img-file.img.xz | sudo dd bs=4M of=/dev/mmcblk0 | |
sudo watch kill -USR1 $(pgrep ^dd) # monitor progress | |
sync | |
# Rename jpg files based on EXIF data | |
find . -iname '*jpg' -exec jhead -n%Y%m%d-%H%M%S {} + | |
# Convert HEIC image file to jpg | |
magick convert foo.HEIC foo.jpg | |
# bulk convert multiple HEIC images to jpg | |
magick mogrify -monitor -format jpg *.HEIC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment