Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using putty to scp from windows to Linux

I'm trying to test some C code that I'm writing. The only issue is that the code needs to be executed on a remote machine. My laptop is pretty old, and there is no driver for my wireless card available for Ubuntu, so booting into Linux to circumvent this problem isn't an option. Here's my question:

I'm using putty to SSH into the remote machine, and I'm writing my code on Notepad++. The location of my file is: C:\Users\Admin\Desktop\WMU\5260\A2.c

My problem is that when I use the command scp C:\Users\Admin\Desktop\WMU\5260\A2.c ~ I get the error could not resolve hostname C:. Name or service not known".

I've also tried scp Users\Admin\Desktop\WMU\5260\A2.c ~ which gives me the error Cannot stat 'Users\Admin\Desktop\WMU\5260\A2.c': no such file or directory

What am I doing incorrectly?

like image 203
Chris Phillips Avatar asked Feb 05 '14 19:02

Chris Phillips


People also ask

Can I scp from Windows to Linux?

Another effective and simplest way to transfer your Windows files to the Linux operating system is via WinSCP Tool. So, to use this tool, we must download it first to install it. Open the Google search engine and write WinSCP in it, and press Enter to proceed.

How do I transfer files from Windows to Linux?

4 Ways to Transfer Files From Windows to LinuxSecurely copy files via SSH. Windows to Linux file transfer with FTP. Share data using sync software. Use shared folders in your Linux virtual machine.


Video Answer


2 Answers

You need to tell scp where to send the file. In your command that is not working:

scp C:\Users\Admin\Desktop\WMU\5260\A2.c ~ 

You have not mentioned a remote server. scp uses : to delimit the host and path, so it thinks you have asked it to download a file at the path \Users\Admin\Desktop\WMU\5260\A2.c from the host C to your local home directory.

The correct upload command, based on your comments, should be something like:

C:\> pscp C:\Users\Admin\Desktop\WMU\5260\A2.c [email protected]: 

If you are running the command from your home directory, you can use a relative path:

C:\Users\Admin> pscp Desktop\WMU\5260\A2.c [email protected]: 

You can also mention the directory where you want to this folder to be downloaded to at the remote server. i.e by just adding a path to the folder as below:

C:/> pscp C:\Users\Admin\Desktop\WMU\5260\A2.c [email protected]:/home/path_to_the_folder/ 
like image 74
nobody Avatar answered Oct 12 '22 22:10

nobody


You can use PSCP to copy files from Windows to Linux.

  1. Download PSCP from putty.org
  2. Open cmd in the directory with pscp.exe file
  3. Type command pscp source_file user@host:destination_file

Reference

like image 35
Swaps Avatar answered Oct 12 '22 23:10

Swaps