Useful Shell Commands#

Useful shell commands.

Convert folder of HEIC images to the JPEG format#

This command loops over all files in the current folder ending with .HEIC and converts them in place to JPEGs with a .jpg extension using the sips command (reference).

for i in *.HEIC(:r); do sips -s format jpeg "$i.HEIC" --out "$i.jpg"; done;

Socks tunnel over SSH#

Connect to a server over SSH and run a SOCKS proxy through the tunnel. Useful for systems without an internet egress (eg so APT and other tools can download updates). Be sure to tunnel DNS (socks5h://) through the proxy.

ssh -fN -D 127.0.0.1:1080 -i ~/.ssh/id_ed25519 user@10.0.0.1

Curl command that sends DNS requests through a SOCKS tunnel#

curl --socks5-hostname 127.0.0.1:1080 <remaining command>

SSH Keygen command#

Because I always lose this.

ssh-keygen -t ed25519 -a 100 -o -f ~/.ssh/id_ed25519 -C "gormo@gormo.co"