How to use SCP command in Linux to copy a file from one server to another. it is used to secure copy a file to or from a remote server. Linux the essential for DevOps Roles.
SCP command example
Copy file from one client location to another server location
$ scp /tmp/local.conf huupv@192.168.1.22:/home/huupv
Use “-r” recursive option to copy directory and sub-directories.
$ scp -r huupv@192.168.1.22:/home/huupv/* ./your-workspace
To copy the remote file to the local directory
$ scp huupv@192.168.1.22:/home/huupv/file-remote.txt /local/folder
Copying a local file to remote directory
$ scp local-text.txt huupv@192.168.1.22:/home/huupv
Using key files like ssh command 🙂
$ scp -i your_key.pem local-text.txt huupv@192.168.1.22:/home/huupv
Conclusion
Thought the article, you can use “SCP command example” as above. I hope will this your helpful. Thank you for reading the DevopsRoles page!