Scp

From XPUB & Lens-Based wiki

You can upload files to a server in the terminal with scp!

scp stands for: OpenSSH secure file copy

How to use it?

  1. open a terminal
  2. navigate to the file/folder you would like to upload
  3. use scp to upload this file/folder, see examples below
  4. log in to the server with SSH
  5. find the uploaded file/folder in your home folder

Without SSH shortcut

$ scp filename.ext USERNAME@192.145.139.xxx:
$ scp -r foldername USERNAME@192.145.139.xxx:

With SSH shortcut

$ scp filename.ext shortcut:
$ scp -r foldername shortcut:

For example:

$ scp hello.html cerealbox:

Tips!

  • don't forget the ":", scp requires it; it means that it uploads something to your home folder
  • you can upload the file/folder to a specific location on the server, by adding a path after the ":", for example:
$ scp filename.ext shortcut:public_html/

or

$ scp filename.ext shortcut:/var/www/html/