Skip to content
SoftwareSolutions.net
Cheat sheet

SSH Basic Commands Cheat Sheet

The ssh and scp commands for connecting to a remote computer and copying files securely, with key-based login notes.

SSH gives a secure command-line connection to another computer. Use keys instead of passwords where you can, since keys are harder to guess.

Connecting

  • ssh user@server: connect to a server
  • ssh -p 2222 user@server: connect to a custom port
  • ssh-keygen -t ed25519: create a new key pair
  • ssh-copy-id user@server: install your public key on the server

Copying files

  • scp file.txt user@server:/path/: copy a file to the server
  • scp user@server:/path/file.txt .: copy a file from the server
  • scp -r folder user@server:/path/: copy a folder

Safety

  • Never share your private key file
  • Turn off password login on servers once keys work
  • Check the server's fingerprint the first time you connect