I think I found the need to have a page full of useful snips of code or 1 liners. I use this page a lot, so I consider it my notebook, or scratchpad of useful stuff.
View the contents of an SSL certificate (domain, expiry, etc):
openssl x509 -in certificate.crt -text -noout
View the contents of an SSL Certificate Request:
openssl req -text -noout -in certificate.csr
Lookup a given certificate’s SHA1 fingerprint:
openssl x509 -in certificate.crt -noout -fingerprint
Check that a given RSA Private Key matches an SSL certificate:
crt=`openssl x509 -noout -modulus -in server.crt | openssl md5`; key=`openssl rsa -noout -modulus -in server.key | openssl md5`; if [ "$key" != "$crt" ]; then echo "no match"; else echo "match"; fi;
Recursively fetch contents from FTP:
wget -r -m --follow-ftp -T 10 -c \ ftp://username:email@example.com/path/to/folder
- Note 1: -T is a timeout, in seconds, to wait for a response from the server before retrying.
List all directories within a given directory, ignoring the current directory you’re finding in;
find /path/to/folder/ -maxdepth 1 -type d | grep -Ev "/$"
You can optionally append to this command after a pipe to take action on the values returned (like creating symlinks, chmod’ing, etc);
while read i; do ln -s $i; done