PuTTY Series: Using PSFTP

26 May 2006

PSFTP is a nice little program that allows you to upload files from your local Windows machine to another machine such as a remote GNU/Linux/BSD/Unix/Mac OS X server.

It uses the SSH File Transfer Protocol - SFTP, (this has nothing to do with FTP), and can provide secure file transfer over a network.

Starting PSFTP

You start PSFTP by clicking on its option in the PuTTY folder in the start menu.

When you start PSFTP you will see a prompt like this:

psftp>

Connecting to a remote machine

To start a session use the open command, this can be a hostname or an IP Address, so:

open username@host.net

open warrior@google.com

open warrior@192.168.0.99

Moving files

To move a file to the server use the put command, for example:

put image.png

To retrieve a file from the server down to the local machine, use the get command:

get image.png

That is all you really need to know. There are lots of other commands, but because PSFTP is not very forgiving of typing mistakes, I personally find it easier to move files around on the remote server using PuTTY rather than PSFTP.

However for moving files between Windows and a GNU/Linux/Unix machine, PSFTP works really well. However if you do want to know more commands then I have reproduced the program's in-line help below.

PSFTP - command reference

! run a local command

bye finish your SFTP session

cd change your remote working directory

chmod change file permissions and modes

close finish your SFTP session but do not quit PSFTP

del delete files on the remote server

dir list remote files

exit finish your SFTP session

get download a file from the server to your local machine

help give help

lcd change local working directory

lpwd print local working directory

ls list remote files

mget download multiple files at once

mkdir create directories on the remote server

mput upload multiple files at once

mv move or rename file(s) on the remote server

open connect to a host

put upload a file from your local machine to the server

pwd print your remote working directory

quit finish your SFTP session

reget continue downloading files

ren move or rename file(s) on the remote server

reput continue uploading files

rm delete files on the remote server

rmdir remove directories on the remote server

1 elwing says...

Be careful when using PSFTP and pscp for large files - large files (>2GB and > 4GB) don't work. The transfer appears to work, but ends up trying to transfer your file very slowly, and never finishes.

Posted at 9:18 p.m. on May 26, 2006


2 Zeth says...

Well that sucks. :( but thanks Elwing for letting us know. :)

I have moved very large files indeed with normal Linux scp on a LAN between two Linux boxes. So in this case it is either Windows or PuTTY that is the limiting factor.

I assume it is PuTTY here, but in its defence, I know the theoretical maximum of file-size for Windows used to be 4GB. The real size was often much lower. Even when using NTFS, Windows XP's support for large files is still a bit of a curate's egg.

I would consider splitting the file into chunks before sending it across. The Linux/Unix command lxsplit can split files into chunks, as can the graphical Linux program gtk-splitter.

Apparently the Windows program HJSplit can also do that, although I have never used it.

You could also just use good old bittorrent to send such large stuff across. The advantage of BT is that it would also be checksummed along the way so you know that all the King's men have put humpty-dumpy back together correctly.

Posted at 12:38 a.m. on May 27, 2006


3 António says...

I have a problem when I try to use PSFTP with a file with this name 'test:yup.xml' for example, PSFTP does not like ':' and I can't rn the file. Can you help me?

Posted at 10:32 p.m. on January 29, 2007


4 Louis says...

Hello, i will like to know if a zip file for example .zip can be uploaded in the server via putty and also can it be unzip if it can be uploaded. Please if this is possible, whats the command to unzip and unrar.

Posted at 11:11 p.m. on June 22, 2007


5 P.Kalidas says...

Hi,

In Psftp file transfered in Binary mode.How to transfer file in ASCII mode. We have a option in SFTP to transfer the file in Binary or ASCII.

Posted at 6:59 p.m. on April 4, 2009


6 Abhishek Dahnotia says...

I am using PUTTY .58 version. i am trying to send file through the Web Application. The application is hosted on a server and same server having PSFTP.exe. the problem is that if i logged in in the application server, i can able to send the file, but if i logged off to the server i am not able to send file by browser of my machine.

Posted at 10:15 a.m. on April 13, 2009


7 Steven says...

when I bring up the psftp and open to a host as soon as I hit the enter key my command line window disappears.

Posted at 12:28 p.m. on June 7, 2009


8 sreejith says...

I want to download a file from remote server in binary format. Can anyone let me know the command to do so?

Thanks in advance

Posted at 6:23 a.m. on July 3, 2009


9 Manny says...

I keep entering the put index.html command but it wont open it. And yes, it's saved as a text document onto my desktop. How do I fix this problem?

Posted at 11 p.m. on July 8, 2009


10 Jehzeel Laurente says...

btw, how can I move all files at once? For instance i have several files at folder B 1 and I want to move all of the files from folder_b_1 to folder_b? How can I do that in putty?

Here's the arrangement of my folders:

home/folder_b/folder_b_1

I hope someone can answer my question. :(

Posted at 12:23 a.m. on August 16, 2009


11 yc says...

Hi Steven,

I've encountered similar problem like yours before, it was because of the host did not open port 22 for your machine where you're accessing the sftp.

You may need to open the port 22 from the host machine.

Posted at 9:32 a.m. on September 23, 2009


12 Boopathi says...

If any possible way to get the latest file(using date and time stamp) present in the folder of SFTP.

Posted at 6:10 a.m. on October 1, 2009


13 Bubba says...

Is there any way psftp can return the true transfer rates oberved during the actual transfer?

Posted at 2:56 p.m. on October 18, 2009


14 Manju says...

I am transferring some files using psftp to other device's FAT partition. But the filestamp of the file being transferred is modified to that of FAT device, after the transfer. Is psftp creates a new file and copy the contents of the original file? I wanted, the file to be copied as it is, including with the date time. Any help is greatly appreciated.

Posted at 5:09 a.m. on November 4, 2009


15 Anis says...

I'm having problem about setting date in creating batch command. In DOS batch command, command as usual is 'set a_date=%date%' , but how realize in psftp batch command ?

Thank's in advance.

Posted at 4:16 a.m. on August 14, 2010


What do you have to say?

Show Editing Help

About

Hello, my name is Zeth, I'll be your host here.

Command Line Warriors is about taking control of your own technology, it looks at our experiences of computing; especially using GNU/Linux, the Python programming language, the command-line and issues such as techno-ethics, best practices and whatever is cool now. If you take control of your technology then you are a Warrior too!

This site is your site too which means that you can contribute and get involved. You can leave comments using the facility provided. For me, the comments and discussions are by far the best part of the site. So please do have your say!

Latest Discussions

Essex Web Design

September 3, 2010
A lot of contract providers give you free internet usage now, but if you have Pay As You Go, then you are going to be paying heavy prices.
Calling time on mobile internet nonsense?

Krasochka

September 2, 2010
Hack again?!
Adding more terminals to your function keys

GenryFlorist

September 2, 2010
<b>Cheap flowers delivery around the world!</b> Celebrate summer with our gorgeous flowers. They?re the perfect gift for any summer occasion. From birthdays to anniversaries, we offer beautiful flowers, lush plants, ...
Burning an iso to CD on Windows

auto-financing.co.cc

September 2, 2010
auto-financing
ReStructuredText tables and doctests

rubaxa

September 1, 2010
FTP = NOT RANDOM software Dominated hands postflop suckout often on all-ins. EX. AK vs. A9 or KQ vs. K6. Both players hit top pair. Bad player goes all in ...
Burning an iso to CD on Windows

empodayaddelm

September 1, 2010
Sorry admin - my post is test
This Week: Heroes and Monsters

increase synthroid dosage

September 1, 2010
Latest world news: 1 <a target="_blank" class="ext" href=http://www.maktabti.org/profiles/blogs/viagra-cialis-buy-no>buy cheap cialis generic levitra viagra</a> Viagra 2 <a target="_blank" class="ext" href=http://www.maktabti.org/profiles/blogs/buy-viagra-online-at-lowest>rainbowpush discussion board buy viagra</a> Viagra 3 <a target="_blank" class="ext" href=http://www.maktabti.org/profiles/blogs/how-to-get-generic-brand>search viagra ...
SFTP in Python: Paramiko

Lacilslaw

September 1, 2010
HYUN JAIMIE enniless and homele JAMILA
This Week: Heroes and Monsters

domaserisk

August 31, 2010
who was shaking his head back and forth knowingly Grissom shifted his eyes over at Brass,
How I Removed Windows from my Laptop

get ready loan

August 30, 2010
Though, by the you kill the legitimate PC user from visiting the site. Also, think about the dynamic IP's issue.
Only the penitent man will pass - on captchas and cotton wool

Packers and movers in pune

August 30, 2010
The topic you disscussed here is very amazing, informative and useful in future...
On Comment Spam

serhanters1

August 30, 2010
?? ???????? ??... ??????...... ??. ????????? ??? ??? ???????D ???????? ??. ????? ????? ???? ??? ???=) ?? ?????- http://letitbit.net/download/8746.894a84bc20f38f1661895aeee0/stereokartinki.html ???http://f-zona.ru ? ? ?? ????????????
Burning an iso to CD on Windows

strona startowa

August 29, 2010
Thanks For This Post, was added to my bookmarks.
Python CGI contact forms

lerexottori

August 29, 2010
?????????????? ??????????
Adding more terminals to your function keys

KelpAugmeme

August 29, 2010
aofaapsymp, http://forums.quark.com/members/jennaq.aspx online stock trading broker, rdgofzary
PuTTY Series: Adding PuTTY to your system path

Cheeday

August 28, 2010
What flowers do you like?
This Week: Heroes and Monsters

magfcvb

August 28, 2010
??????? ?????????????? ?????? - ????? ?????? ?????????????? ??????, ?????????????? ?????? ???????, ?????????????? ?????? crosman, ???? ??????????????? ??????, ?????????????? ?????? ?????? ????????. ???? magazin-oruzhie.ru
Include ODF support in the Linux Standard Base?

noni

August 28, 2010
I find myself coming to your blog more and more often to the point where my visits are almost daily now!
On Comment Spam

Latenadsfes

August 28, 2010
http://mynewblog.for-breastcancer.com/ http://mynewblog.photoblogcentral.com/ http://ilovezebras.thechicks.org/ http://mynewblog.cyberbardsymposium.com/ http://wewphost.com/ilovezebras/
Burning an iso to CD on Windows

LeupoldEst

August 28, 2010
pretty cool stuff here thank you!!!!!!!
OOXML Vote Coverage