Geekdosage
  • Home
  • Computer hardware
    • GPU
      • AMD
      • Nvidia
    • Processor
  • Linux
    • CentOS
    • Ubuntu
  • Docker
  • Computer Software
    • Operating System
      • Windows
      • MacOS
      • Android
  • Gaming
  • Computer Science
    • Network Engineering
    • Comparisons

Geekdosage

  • Home
  • Computer hardware
    • GPU
      • AMD
      • Nvidia
    • Processor
  • Linux
    • CentOS
    • Ubuntu
  • Docker
  • Computer Software
    • Operating System
      • Windows
      • MacOS
      • Android
  • Gaming
  • Computer Science
    • Network Engineering
    • Comparisons
CentOSLinuxUbuntuWindows

SCP Linux – Securely Copy Files in Linux Using SCP with examples

by GeekDosage February 22, 2021
written by GeekDosage February 22, 2021
scp command linux

SCP stands for Secure copy protocol. This command already available in all Linux distributions. SCP command uses to securely copy files and directories between remote hosts such as servers, network computers, etc.

SCP is based on Secure Shell (SSH), and it uses the same security concepts of ssh for ensuring security during the file transfer.

Before jump into scp examples, let’s have an idea about what are the options we can use with scp command.

Refer to scp manual page for more information.

$ man scp

scp command is now listed as deprecated. It is recommended to use the rsync command-line tool.

Photo by Sora Shimazaki from Pexels

Helpful SCP options

-P  Use to specify the ssh port. 
-p  Preserves attributes (modification times, access times, and modes) of the original source.
-q  proceed without showing warning or process status.
-v  Show process steps, warnings, and errors. useful in debugging steps.
-r  recursive mode. use especially when copying directories recursively.

SCP Examples

How to copy files from localhost to a remote server

$ scp /local/path/file.txt [email protected]:/remote/path/
  • NOTE: remote-host can be an IP address or a hostname

How to copy files from a remote server to localhost

$ scp [email protected]:/remote/path/file.txt   /local/path/
  • NOTE: remote-host can be an IP address or a hostname

How to copy directories in localhost to a remote server

$ scp -rv /local/path/directory    [email protected]:/remote-path/

How to copy files from a remote server to localhost

$ scp -rv  [email protected]:/remote-path/directory  /local/path/

Use-q option to avoid command executing status messages and ssh warning messages.

$ scp -rq /local/path/directory    [email protected]:/remote-path/
Photo by Vitaly Vlasov from Pexels

Conclusion

SCP is a handy command in work with servers related tasks. Scp command is straightforward to use because of its simplicity. However, SCP is now considered outdated and recommends using the “rsync” command or “sftp” command.

Read More:

How to Copy Files Between Linux Servers Using rsync with examples

passwd: Module is unknown issue in Ubuntu

GeekDosage
copy files from remote server linuxcopy files to remote servercopy files using scpscpscp commandscp command linux
1 comment
0
FacebookTwitterPinterest
previous post
How to Copy, Paste and Delete in Vim / Vi
next post
How to Exit Vim

Related Posts

How to fix “dial unix /var/run/docker.sock: connect: permission...

August 10, 2021

How to connect to your VirtualBox VM from...

August 8, 2021

How To Install Cloudflare Origin SSL Certificate with...

July 20, 2021

How to Stop all Docker Containers

June 8, 2021

Cloudflare Origin SSL vs. Let’s encrypt SSL

May 9, 2021

Best 10 Docker Hosting Services

April 7, 2021

How to Exit Vim

March 11, 2021

How to Copy, Paste and Delete in Vim...

February 7, 2021

How to Copy Files Between Linux Servers Using...

February 4, 2021

passwd: Module is unknown issue in Ubuntu

January 26, 2021

1 comment

How to connect to your VirtualBox VM from your Host OS using SSH | Geekdosage August 8, 2021 - 3:07 pm

[…] March 11, 2021 […]

Reply

Leave a Comment Cancel Reply

Save my name, email, and website in this browser for the next time I comment.

In This Article

  • 1 Helpful SCP options
  • 2 SCP Examples
      • 2.0.1 How to copy files from localhost to a remote server
      • 2.0.2 How to copy files from a remote server to localhost
      • 2.0.3 How to copy directories in localhost to a remote server
      • 2.0.4 How to copy files from a remote server to localhost
  • 3 Conclusion
  • 4 Read More:

Keep in touch

Facebook Twitter Google + Instagram Pinterest Email

Popular Posts

  • How to change the forgotten root password in CentOS 8

  • How to remove/delete user in Linux

  • How to Create a Private Docker Registry in Ubuntu 20.04

  • How to Build a Docker Image from Dockerfile

About Geekdosage

Geekdosage is a technology based website which mainly focuses on network engineering, computer science, automation, computer hardware and software and internet technologies. Our purpose is to create a platform where anyone can access the subject areas without barriers.

Recent Posts

  • How to fix “dial unix /var/run/docker.sock: connect: permission denied” error

    August 10, 2021
  • How to connect to your VirtualBox VM from your Host OS using SSH

    August 8, 2021

Find us

Facebook Twitter Instagram Pinterest Email
  • About Us
  • Contact Us
  • Disclaimer
  • Terms and Conditions
  • Cookie Privacy policy
  • Privacy Policy
  • DCMA

@2021 - All Right Reserved | Designed and Developed by GeekDosage