The Blog

SCP Command in linux

If you want to copy files from one remote server to another, SCP command is one of the many options available. cp command is used to copy files in the same server. SCP works with SSH protocol, so we have to make sure that both the systems have configured SSH.

Let us go through the steps to follow,

Syntax

scp [OPTION] [user@]source:]file [user@]destination:]file

[user@]source:]file : source file

[user@]destination:]file : destination file

There are many options available, let us go through it.

  • -r meaning recursively copy entire directories.
  • -C to enable compression.
  • -l to limit bandwidth.
  • -o for passing ssh options.
  • -P to specify the port to connect to on the remote system.
  • -v to print debugging messages about the progress.
  • -q to disable the progress meter.
  • -p for preserving modification times, access times and modes from the original file.
  • -4 for using IPv4.
  • -6 for using IPv6.
  • -c to specify a cipher.

Example

We have a file called source_file with some data in it. We have to copy it to a remote server

The command to copy the files is,

scp /home/lenovo/source_file root@135.181.194.42:~

The file is copied to the home directory of root, in the remote server.

We can see that the remote server has the file which we transferred using scp command

DevOps Gurukul is one of the best training academies which provides the Best Linux Training Course Institute in Kochi and the Best DevOps Training Course in Kochi. We have experienced training professionals who are passionate about grooming the right candidates to start their successful careers. Come learn with us and have a bright future!

Leave a Comment

Your email address will not be published.

×

Powered by WhatsApp Chat

× How can I help you?