scp command is being used to copy files from a remote server to a local machine and vice versa. It uses ssh to do secure file transfer. Show 1. Copy a file from a remote server to a local machine It will ask the password for remote user * symbol can be used to copy multiple files by pattern like w3docs* which will copy w3docs.sql, w3docs1.pdf and etc. 2. Copy a directory from a remote server to a local machine -r should be used for directories 3. Copy a file from a local machine to a remote server 4. Copy a directory from a local machine to a remote server -r should be used for directories 5. Copy files by using RSA keys If there is an identity key (RSA) instead of password than -i should be added In my terminal shell, I ssh'ed into a remote server, and I I tried Thanks asked Mar 5, 2015 at 2:32
1 For example, your remote host is example.com and remote login name is user1:
answered Mar 5, 2015 at 2:43
kkpoonkkpoon 1,89913 silver badges23 bronze badges 5 The scp operation is separate from your ssh login. You will need to issue an ssh command similar to the following one assuming jdoe is account with which you log into the remote system and that the remote system is example.com:
The scp command issued from the system where /home/me/Desktop resides is followed by the userid for the account on the remote server. You then add a ":" followed by the directory path and file name on the remote server, e.g., /somedir/table. Then add a space and the location to which you want to copy the file. If you want the file to have the same name on the client system, you can indicate that with a period, i.e. "." at the end of the directory path; if you want a different name you could use /home/me/Desktop/newname, instead. If you were using a nonstandard port for SSH connections, you would need to specify that port with a "-P n" (capital P), where "n" is the port number. The standard port is 22 and if you aren't specifying it for the SSH connection then you won't need that. answered Mar 5, 2015 at 2:52
When you use scp you have to tell the host name and ip address from where you want to copy the file. For instance, if you are at the remote host and you want to transfer the file to your pc you may use something like this:
Example: scp -P22 table :/home/me/Desktop/ On the other hand, if you are at your are actually on your machine you may use something like this:
Example: scp -P22 [fake_user]@222.222.222.222:/remote/path/table /home/me/Desktop/ answered Mar 5, 2015 at 2:39
dgsleepsdgsleeps 6906 silver badges7 bronze badges I would recommend to use sftp, use this command answered Mar 5, 2015 at 5:38
TEDDYTEDDY 81110 silver badges24 bronze badges How can I download a file from a Linux server to my local machine?wget and curl are just two of the most popular commands for downloading files in Linux. There are more such command line tools. Terminal based web-browsers like elinks, w3m etc can also be used for downloading files in command line. Personally, for a simple download, I prefer using wget over curl.
How to copy folder from remote server to local machine in Linux?You can use either scp or rsync to copy folder and files from local to ssh or copy folder and files from ssh to local within in the same or different directory. By default copy files and folders happen sequentially. If you wish to copy directory and contents in parallel then you must use pscp or pssh tool.
|