Scp: Difference between revisions

From XPUB & Lens-Based wiki
(Created page with "You can upload files to a server in the terminal with '''scp'''! scp stands for: OpenSSH secure file copy ==How to use it?== # open a terminal # navigate to the file/folder you would like to upload # use scp to upload this file/folder, see examples below # log in to the server with SSH # 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...")
 
No edit summary
 
Line 8: Line 8:
# navigate to the file/folder you would like to upload
# navigate to the file/folder you would like to upload
# use scp to upload this file/folder, see examples below
# use scp to upload this file/folder, see examples below
# log in to the server with SSH
# log in to the server with [[SSH]]
# find the uploaded file/folder in your home folder
# find the uploaded file/folder in your home folder



Latest revision as of 10:51, 21 October 2024

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/