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
  • About Us

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
  • About Us
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

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

Related Posts

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

How to Kill A Process In Linux? Simple...

January 24, 2021

2 Simplest Methods to Take/Capture Desktop Screenshot in...

January 17, 2021

How to remove/delete user in Linux

January 11, 2021

How to rename a Directory in Linux?

January 5, 2021

How to Install VirtualBox in Ubuntu 20.04

January 3, 2021

How to Create a Private Docker Registry in...

December 23, 2020

How to Build a Docker Image from Dockerfile

December 14, 2020

1 comment

How to Copy Files Between Linux Servers Using rsync with examples | Geekdosage February 24, 2021 - 4:37 am

[…] securely through servers is a regular and important task for the system administrators. We can use SCP and rsync as primary command-line tools for achieving this kind of job. rsync (remote sync) is a […]

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 Install Docker on CentOS 7

  • How to Build a Docker Image from Dockerfile

  • Best GPU stress test software to test your GPU

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

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

    February 22, 2021
  • How to Copy, Paste and Delete in Vim / Vi

    February 7, 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