cat id_rsa.pub | ssh USER@SERVER 'cat>> ~/.ssh/authorized_keys'
or alternatively
ssh-copy-id -i ~/.ssh/id_rsa.pub USER@SERVER
ssh -NfL LOCAL_PORT:TARGET_IP_ON_REMOTE_HOST:TARGET_PORT_ON_REMOTE_HOST USER@SERVER
No -f to keep ssh process in foreground.
Forward port to remote MySQL at example.com on local port 3307:
ssh -NfL 3307:127.0.0.1:3306 bob@example.com
This is useful to check the key length of a key.
ssh-keygen -lf ~/.ssh/id_rsa.pub