Upload Files To Linux From Windows Using PSCP

I am a regular user of Putty a Linux simulator for windows which allows you to use the functionality of Linux boxes within windows.

Something putty lacks though is a bridge between the windows and Linux boxes.

To overcome this I have been using Cygwin which brings in a Linux OS like functionality within my Windows machine, wherein I can copy files from my Windows machine to a Linux box without using a graphical interface like WinSCP or and FTP client, use Linux command from within my windows machine, and lots of other Linux based functionality like Vim etc.

Now for you to use Cygwin you will have to do a complete install, and mind you when I say complete install I will stress on it.

As when you install cygwin it just installs the default version without scp (Secure file copy), ssh (secure file transfer) and lots of other features. You can get a very indepth tutorial on using cygwin from Lifehacker.

Now if you just want to use cygwin to upload files then installing cygwin is not the only solution you have and you can simply use PSCP which is a software from the creator’s of Putty to use that functionality.

PSCP (Command line secure file copy) requires no installs and can directly run from your windows prompt, if you add it to your classpath then it makes it much more easier.

Here is how you can use PSCP to copy files from your windows machine to your Linux boxes.

Source: howtogeek.com

Download a copy of PSCP and place it on any drive of your windows machine, assuming you copied the file to C:\downloads\pscp.exe, I will start this tutorial here.

1. Open a command prompt in your windows machine

2. If PSCP is not in your classpath you can run command to add it set PATH=%PATH;C:\downloads\

Note: adding %PATH; will ensure you do not lose the old path’s for the command prompt you are on, windows command prompt’s are session based and If you close this command window again all manual set path’s will disappear and you will have to set the same thing starting again from step 1.

3. It will open to your default specified location, just navigate to your folder where you have the file placed to upload, assuming you have placed it in C:\upload, type cd C:\upload.

4. Issue this command

C:\uploads>C:\pscp.exe filename.extension [email protected]:directory/subdirectory -pw password

Simply issuing this command C:\whichever directory>C:\pscp.exe will output you with a help menu for usage of pscp as given below

Source: redfigmedia.com.au

C:\service>c:\pscp.exe
PuTTY Secure Copy client
Release 0.58
Usage: pscp [options] [user@]host:source target
pscp [options] source [source…] [user@]host:target
pscp [options] -ls [user@]host:filespec
Options:
-V        print version information and exit
-pgpfp    print PGP key fingerprints and exit
-p        preserve file attributes
-q        quiet, don’t show statistics
-r        copy directories recursively
-v        show verbose messages
-load sessname  Load settings from saved session
-P port   connect to specified port
-l user   connect with specified username
-pw passw login with specified password
-1 -2     force use of particular SSH protocol version
-4 -6     force use of IPv4 or IPv6
-C        enable compression
-i key    private key file for authentication
-batch    disable all interactive prompts
-unsafe   allow server-side wildcards (DANGEROUS)
-sftp     force use of SFTP protocol
-scp      force use of SCP protocol

You can download copies of PSCP for your usage free and start uploading now without need for any Graphical user interface.

Part 2 sneak peek: Downloading files from Linux to windows, downloading files on Linux box, Zipping, taring, unzipping files and emailing files using putty, cygwin on a Linux box.