🎓 A1Learner
🔍
0 of 50 lessons completed

Shell SSH and SCP

SSH is a way to log in to another computer over a network. SCP uses the same connection to copy files to and from that computer.

Check the SSH version

ssh -V prints the version of SSH on this computer.

ssh -V 2>&1

Log in to another computer

ssh opens a shell on the other computer. It asks for a password or a key first.

ssh ana@example.com

Copy a file to the other computer

scp copies notes.txt to the other computer. The part after the colon is the path there.

scp notes.txt ana@example.com:notes.txt

Copy a file back

Swap the two sides to copy a file from the other computer to this one.

scp ana@example.com:report.txt report-copy.txt

Example

ssh -V 2>&1
command -v scp

Key points

  • SSH: a way to log in to another computer over a network.
  • Use ssh to open a shell on the other computer.
  • SCP: a way to copy files over an SSH connection.
  • Use scp to copy a file to the other computer or back from it.
  • The other computer asks for a password or a key before it lets you in.

In this example, ssh -V shows the SSH version, and command -v shows where scp lives. Both tools are ready before you connect anywhere.

Note

Never type your password into a login prompt you did not expect.

Try it Yourself

Edit the code, then press Run.

Running is simulated

Exercise

What does scp notes.txt ana@example.com:notes.txt do?