-
Connect to a remote host:
ssh "<USER>"@"<TARGET>"
-
Test SSH connection with verbose output:
ssh -v "<USER>"@"<TARGET>"
-
Execute a single command on the remote host:
ssh "<USER>"@"<TARGET>" "<COMMAND>"
-
Remove a host key from
known_hosts:ssh-keygen -R "<TARGET>"
-
Generate a new SSH key pair:
ssh-keygen -t rsa-sha2-512
-
Start the SSH agent and add your private key:
eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa
-
Retrieve the public key to add to Git or DevOps platforms:
cat ~/.ssh/id_rsa.pub
-
Copy files to a remote host:
scp "<LOCAL_FILE>" "<USER>"@"<TARGET>":"<REMOTE_PATH>"
-
Copy files from a remote host:
scp "<USER>"@"<TARGET>":"<REMOTE_FILE>" "<LOCAL_PATH>"