Introduction
How to use the SCP command in Linux to copy a file from one server to another. it is used to securely copy a file to or from a remote server.
Discover the simplicity and power of using the SCP command in Linux for secure file transfers. This tutorial will guide you through various examples of how to utilize SCP to copy files and directories between servers securely. Whether you are a beginner or an experienced administrator, mastering the SCP command is crucial for managing remote file transfers efficiently.
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 the “-r” recursive option to copy the 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 a 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
With the SCP command, transferring files between servers becomes a seamless task. This guide has shown you several practical examples to help you understand how to use SCP effectively. By integrating these techniques into your workflow, you’ll enhance your server management skills and ensure secure data handling. I hope will this your helpful. Thank you for reading the DevopsRoles page!