Misc. command line tools

Misc command line tools

Base64 encoding

  • Without whitespace: base64 --wrap=0

Text encodings

  • Convert ASCII to UTF8: iconv --from-code=ascii --to-code=utf-8

Windows / WSL interop

  • Copy WSL text into the Windows clipboard: echo "Hello äöü" | iconv -f utf-8 -t utf-16le | clip.exe

    • This converts it to UTF16 little endian and pipes it to the Windows clipboard :-)

  • Start a web browser on Windows from WSL: cmd.exe /C "start $( echo "https://github.com/" )"

git tips

chmod +x in git

git update-index --chmod=+x ./sample.sh

Image renaming

Use jhead to extract EXIF metadata, and rename image files.

For example, this renames all images based on the date-taken EXIF metadata

jhead -n%Y-%m-%d--%H-%M-%S_%f *.jpg
  • -n[format-string]

    • %Y-%m-%d Year (4 digit 1980-2036) / month number / day of month

    • %H-%M-%S hour (24h) / minute / second

    • %f original file name

Last updated