Pin Loon's Wiki
  • Welcome to my technical notes
  • About Me
  • Linux
    • Basic commands
    • Controller Area Network (CAN)
    • Disk
    • Ethernet
    • Systemd Service
    • SSH
  • Microcontroller / Single Board Computer
    • Debugger / Compiler
    • Raspberry Pi 4
  • Application Platform
    • Docker
    • Docker Compose
  • Application Notes
    • Dataype Overflow
    • Macros
    • Wrong Casting
    • Variadic Function
  • Git
    • Create SSH Keys
    • Git submodule
  • VPN
    • Wireguard Setup on Azure
Powered by GitBook
On this page
  • Rsync
  • Scp
  • Sftp
  • References
  1. Linux

SSH

  • Sometimes it is very convenient to transfer files through local network.

  • This could be done by rsync, scp, sftp.

  • Nevertheless the host must have openssh-server installed.

Rsync

  • Sometimes rsync is preferred than scp and sftp as it is able to copy hidden files most of the time.

$ rsync -avzhe ssh <username>@<ip>:/<PATH_TO_BE_COPIED> <DESTINATION_PATH>

Scp

$ scp <PATH_TO_BE_COPIED> <username>@<ip>:/<DESTINATION_PATH> 
  • by installing sshpass, the password can be embedded in the command as well

$ sshpass -p <PASSWORD> scp /<PATH_TO_BE_COPIED> <username>@<ip>:/<DESTINATION_PATH> 

Sftp

  • To get files from a host, sftp is a good choice

$ sftp <username>@<ip>
$ get -r <PATH_TO_BE_COPIED> <DESTINATION_PATH>

References

  1. https://www.tecmint.com/rsync-local-remote-file-synchronization-commands/

PreviousSystemd ServiceNextDebugger / Compiler

Last updated 3 years ago