Command to copy from local to server or server to server
When we start working on server then big question comes in mind when we need to work on the data/file. how to copy a file from one server to another server in linux using ssh.
Command to copy from local to server or server to server
To transfer file or directory from local system to remote, the syntax are sequently:
scp [file_path] [user]@[remote_host]:[remote_dir]
scp -r [local_dir] [user]@[remote_host]:[remote_dir]
To copy file from remote server to local machine, the syntax are respectively:
scp [user]@[remote_host]:[remote_file_path] [local_dir]
scp -r [user]@[remote_host]:[remote_dir] [local_dir]
To transfer file between two remote servers ( passwords required for both system), the syntax is:
scp [user]@[remote_host]:[remote_file_path] [user]@[remote_host]:[remote_dir]