Some useful Bash commands

This blog post includes a few useful Bash commands. Other blog posts will follow.

Delete recursive all files with the same extension. To verify if the right files are found, use the command without the option -delete:

find . -name "*.bak" -type f -delete

Print the fingerprint of a public key without importing the key:

gpg2 --with-fingerprint <public-key.asc>

Upgrade python packages for python3 via pip

pip3 freeze --local | grep -v '^\-e' | cut -d = -f 1  | xargs -n1 pip3 install -U

New versions of ssh show the fingerprint as sha256. If you have an older version installed on your server, it's printed as MD5 hash. To make it easier to compare the fingerprints, specify the following option if you connect via ssh from the client:

ssh -o FingerprintHash=md5