Transferring files between windows, linux using WinSCP

In:

Article background

    During software development if you are working on a linux machine, there are few default editors available in linux to edit your source code files in linux. But unfortunately these source code editors are not user friendly. So you need to transfer files from linux to window and once the files are downloaded to windows you can use many user friendly editors like eclipse, sublime text to edit source code and again transfer back your edited the files to linux.
WinSCP is a free software tool used to transfer files between windows, linux and vice-versa. Follow the steps in this article to install and use the WinSCP software.

Article contents

WinSCP download, installation

WinSCP Download.
    WinSCP is a free open source software. We will use WinSCP to transfer files from my Linux machine to my computer and vice-versa. The linux machine IP Address is 192.168.0.4 with user name pi and password raspberry. Visit WinSCP software download page at and download the software. Double click on the downloaded WinSCP software setup.exe file and you will be presented with the following screen to accept the license.
course thumb
Accept the license for WinSCP installation.
    Accept the license for WinSCP by clicking on accept button and installation will be completed in your computer. You will see WinSCP shortcut in your desktop of your computer.

Login using WinSCP, Browsing directories

Login using WinSCP.
    Double click on the WinSCP icon on the Desktop of your computer and WinSCP will be launched with the following screen. Enter the IP address, user name and password of the linux machine from which you want to transfer files to your computer. For my linux machine I have entered IP Address as 192.168.0.4, User name as pi and Password raspberry. Then Click on Login
course thumb
Enter the IP address, user name and password of your linux machine.
    WinSCP uses SSH key along with your user name, password to login to linux machine. You don't have to generate the key. It reads the key on successful login to the machine. If you are using WinSCP for the first time following screen will be presented and click Yes to store the SSH key to the WinSCP cache. On the subsequent login this screen will not be presented for the same linux machine as the key for the machine is already stored in the WinSCP cache.
course thumb
Warning to store the SSH key for your linux machine in WinSCP cache.
    One you click yes to store the SSH key of your machine. You will be presented with the following screen.
course thumb
Directories of your windows computer and linux machine.
Browsing directories.
    In the left panel the directories of your windows computer are presented where as in the right panel the directories of your linux machine are presented. Double click on the directories present on the left and right panel to see the files present inside it. Now on the right panel browse to the directory in the linux machine where the files you want to transfer are present. Also on the left panel browse to the directory in the windows computer to which you want to transfer the files. In the illustration I want to transfer file cli.c from C directory in linux machine to
course thumb
Directories of your windows computer and linux machine.

Transferring files, directories between Linux, Windows

Transferring files, directories.
    At this point you are ready to transfer files from linux machine to your windows computer and vice versa. Click on the file on linux machine to select it and then drag it to the left towards left panel. The file will be transferred to your windows computer without any warning. If you have a file with same name already present in the windows computer it will ask you if you want to overwrite the file and click Yes. The file will be overwritten.
    You can edit the file you transferred to your windows computer to make your changes. Now you want to transfer the file with all your changes from windows computer to your linux machine. Click on the file with all your changes on windows computer to select it and then drag it to the right towards right panel. The file will be transferred to your linux machine. WinSCP will give you warning message. It will ask you if you want to overwrite the file and click Yes. The file will be overwritten. Now you can see all your changes in the changed file in the linux machine.
    To transfer a directory between windows and linux click on the directory to select the directory which you want to transfer. Drag the directory between left panel and right panel to transfer the directory. This will transfer all files present inside the directory.
course thumb
Files transfer completed between linux and windows computer.

Article Conclusion

Conclusion
    You learned on how to transfer files between Linux and Windows computer and vice-versa.
If you find issue in this article or want to contribute a new article send your content to contact@mbed.in.
Share

 Articles

 Linux Software

 C Programming

 Search Code Snippets

 Popular C search examples

 Popular C search MCQs