I have connected to a Unix server using SSH from my terminal from my Windows client.
How do I copy files from the Unix server to the Windows client? Can I use the scp and rcp commands? Or are there other ways to do so?
I have connected to a Unix server using SSH from my terminal from my Windows client.
How do I copy files from the Unix server to the Windows client? Can I use the scp and rcp commands? Or are there other ways to do so?
scp
is the way that we do this. If you're using something like putty, it comes with pscp
as part of it.
I prefer pscp
over the standard scp
since it allows you to specify a password on the command line, something useful for scripting.
An example invocation from one of my scripts (details changed to protect the innocent):
pscp -pw paxpwd src.tar.gz [email protected]:/usr/pax/tmp/src.tar.gz
This copies the src.tar.gz
file from my local (Windows) directory to /usr/pax/tmp
on my pax.com
UNIX machine, using the pax/paxpwd
user and password.
Your particular use case would be satisfied by:
pscp -pw biranchipwd [email protected]:abc/xyz.txt xyz.txt
Keep in mind that placing passwords into scripts is not generally a good idea since it means anyone that breaks into your local machine can easily break into the other machine as well.
You can use scp directly on the command prompt itself: For example:
c:>scp [email protected]:/home/myuser/test.properties .
[email protected]'s password:
test.properties 100% 675 0.7KB/s 00:00
Check out WinSCP for a free GUI SFTP client if you don't want to bother with the command line.