Code Yarns ‍👨‍💻
Tech BlogPersonal Blog

scp cheatsheet

📅 2019-Oct-15 ⬩ ✍️ Ashwin Nanjappa ⬩ 🏷️ cheatsheet, scp ⬩ 📚 Archive

scp is a tool to securely copy files across remote and local systems using the SSH protocol. There are similar tools like sftp and rsync. However, scp is simpler than those tools and is the closest analog of the Unix cp command. It is the best tool when you know the source and destination paths and all you want is to copy files.

$ scp your-name@remote-system:/path/on/remote/system /path/on/local/system

Since scp uses SSH, it will use your SSH key pairs if they are available or prompt you for the remote password if needed.

$ scp /path/on/local/system your-name@remote-system:/path/on/remote/system
$ scp 'your-name@remote-system:/path/on/remote/system/*.h' /path/on/local/system
$ scp -r your-name@remote-system:/path/on/remote/system /path/on/local/system

Tried with: Ubuntu 18.04