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>&1Log in to another computer
ssh opens a shell on the other computer. It asks for a password or a key first.
ssh ana@example.comCopy 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.txtCopy 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.txtExample
ssh -V 2>&1
command -v scpKey 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?