Skip to content

Instantly share code, notes, and snippets.

@ShivamJoker
Last active January 17, 2024 09:43
Show Gist options
  • Save ShivamJoker/e4d0d3a87994833d64366de66c3e88af to your computer and use it in GitHub Desktop.
Save ShivamJoker/e4d0d3a87994833d64366de66c3e88af to your computer and use it in GitHub Desktop.
Some of the useful bash commands which I use everyday

Rename all files extension recursively eg. .js to .jsx

find . -name '*.js' -exec sh -c 'mv "$0" "${0%.js}.jsx"' {} \;

Convert all images in a specific format (eg .png or .jpg to webp)

for i in *; do convert $i "${i%.*}.webp"; done   

Generate ED25519 SSH key pair [more info]

ssh-keygen -t ed25519 -C "[email protected]"

Using rsync to transfer files over SSH

Transfer file in [a]rchive and compressed ([z]ipped) mode with [v]erbose and [h]uman-readable [P]rogress:

rsync -azvhP path/to/local_file remote_host:path/to/remote_directory

Transfer a directory and all its children from a remote to local:

rsync -r remote_host:path/to/remote_directory path/to/local_directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment