- Transfer files from Windows to Linux over the network?
- 7 Answers 7
- file transfer from Windows to Linux
- 2 Answers 2
- Cause
- Possible resolutions
- (1) Using dos2unix command
- (2) Data Flow Task
- (3) Using a Script Task — StreamReader/Writer
- (4) Extract using unzip -a
- Copy Files Between Windows and Linux Using Command Line
- Copy File from Windows To Linux
- Copy File From Linux To Windows
- How to upload a file from Windows to Linux?
- 3 Answers 3
- www.makeuseof.com
- Follow MUO
- How to Transfer and Share Files Between Windows and Linux
- 5 Ways to Transfer Files from Windows to Linux
- 1. Share Network Folders Between Linux and Windows
- Access a Linux Share From Windows
- 2. Copy Files via SSH From Windows to Linux
- 3. How to Transfer Files From Linux to Windows Using FTP
- 4. Share Files Between Linux and Windows With Resilio Sync
- 5. Create and Mount a VirtualBox Shared Folder in Linux
- Sharing Files Between Windows and Linux Is Easy
- Subscribe To Our Newsletter
- One More Step…!
Transfer files from Windows to Linux over the network?
I have a Windows machine and a Linux machine both hooked up to the router via Ethernet cables.
What is the easiest way for me to transfer files from the Windows machine to the Linux one?
7 Answers 7
Easiest method is probably going to be SFTP/SCP. You can grab a copy of WinSCP or the Portable version for your windows machine. Then in WinSCP, put the linux machine name as the server (or IP if you can’t connect via name). Once connected, navigate to preferred/necessary directories and drag and drop as desired.
For more «permanent» solution, you could install samba on your linux machine and then connect from the windows machine, but that would require learning how to configure samba so that the two systems can connect to each other.
Another method would be to use a NFS system. Assuming that you have a windows 7 install that is pro or better.
To start you would need to install a couple packages on the linux machine assuming root access. «aptitude install nfs-kernel-server nfs-common portmap» That command would install what you need.
Now you need to edit the file «/etc/exports» to list what you would like to share
Would be a possible entry. The IP address would need to be changed to point to your networks subnet address. The location «/home» would also need to point to the location that you would like to share. Once done with editing the file you will need to save it and run
This updates the NFS systems to start sharing the locations listed in the export file.
Now to set Windows to see the share. going to -> run -> cmd should bring up a command prompt.
Replacing nfs-server-unc-name to the ip address of the linux machine and «share-name» to the name of the directory that you are sharing. «drive letter» would be a letter that you would like the linux machine mounted to.
file transfer from Windows to Linux
I am exporting data in a csv file using ssis. In my ssis package i compress the file in zip format and upload it on a linux server using sftp. The problem is that in the destination file system, the csv files include a ^M character which comes from the dos system.
I found three solutions.
First i could set the sftp transfer mode to ascii and not zip the file (i later found out this is only supported by ftp). Considering that my unzipped file is > 3Gb that is not efficient, the upload will take ages.
Secondly once transferred i could unzip the file and convert it using dos2unix utility, but again dos2unix is not installed and i am not authorized to install it to the target system.
Finally i could use a unix editor like sed to remove ^M from the end of lines. My file is consisted of more than 4 million lines and this would again take ages.
Q: Is there any way to preformat my file in ASCII using ssis, then zip and transfer?
2 Answers 2
While searching on this issue i found a very useful links were they described the cause and possible resolutions of this issue:
Cause
File has been transferred between systems of different types with different newline conventions. For example, Windows-based text editors will have a special carriage return character (CR+LF) at the end of lines to denote a line return or newline, which will be displayed incorrectly in Linux (^M). This can be difficult to spot, as some applications or programs may handle the foreign newline characters properly while others do not. Thus some services may crash or not respond correctly. Often times, this is because the file is created or perhaps even edited on a Microsoft Windows machine and then uploaded or transferred to a Linux server. This typically occurs when a file is transferred from MS-DOS (or MS-Windows) without ASCII or text mode.
Possible resolutions
(1) Using dos2unix command
dos2unix includes utilities to convert text files with DOS or MAC line breaks to Unix line breaks and vice versa. It also includes conversion of UTF-16 to UTF-8.
You can use a similar command via Execute Process Task :
(2) Data Flow Task
You can create a Data Flow task that transfer data from Flat File Source into a new Flat File Destination were both Flat File Connection mAnager has the same structure except the Row Delimiter property (
(3) Using a Script Task — StreamReader/Writer
You can use a script task with a similar code:
(4) Extract using unzip -a
convert text files. Ordinarily all files are extracted exactly as they are stored (as »binary» files). The -a option causes files identified by zip as text files (those with the ‘t’ label in zipinfo listings, rather than ‘b’) to be automatically extracted as such, converting line endings, end-of-file characters and the character set itself as necessary. (For example, Unix files use line feeds (LFs) for end-of-line (EOL) and have no end-of-file (EOF) marker; Macintoshes use carriage returns (CRs) for EOLs; and most PC operating systems use CR+LF for EOLs and control-Z for EOF. In addition, IBM mainframes and the Michigan Terminal System use EBCDIC rather than the more common ASCII character set, and NT supports Unicode.) Note that zip’s identification of text files is by no means perfect; some »text» files may actually be binary and vice versa. unzip therefore prints »[text]» or »[binary]» as a visual check for each file it extracts when using the -a option. The -aa option forces all files to be extracted as text, regardless of the supposed file type. On VMS, see also -S.
So you can use the following command to extract text files with changing line endings:
Copy Files Between Windows and Linux Using Command Line
It is not always that you will need to copy a file from Windows to Linux or vice versa. But at times when you are automating things or trying to achieve some copy functionality using a script, it is good to have a utility to do that. Here is where pscp comes into play. Using pscp you can copy the file to/from windows and Linux. In this guide, I will go through the steps of doing the same.
Copy File from Windows To Linux
1. Download pscp.exe from here
2. copy the pscp.exe executable to the system32 directory of your windows machine. This folder normally exists in C:\Windows\System32 path.
3. Open PowerShell and use the following command to verify if pscp is accessible from the path.
4. Use the following format to copy the file to the Linux box.
- -pw for the password.
- replace password with the Linux user password.
- C:\Users\Admin\Desktop\test.txt represents the path of the file that has to be copied to the Linux system.
- 192.168.33.10 is the IP of the Linux server.
- /home/vagrant is the user-accessible path in the Linux system to copy the file.
If you are using private keys for authentications, you can use -i flag instead of -pw followed by the path to the .ppk file. If your key file is in pem format, you can use the puttygen command to convert it to ppk.
Info: Learn Linux & Windows administration from Pluralsight with its 10 days free account
For key-based authentication, the command looks like below.
Copy File From Linux To Windows
You can use pscp to copy files from Linux to windows. use the following command format for the same.
The above command will copy the file in Linux from the specified path to the Windows desktop.
How to upload a file from Windows to Linux?
I’m using Windows. I want to upload a file to Amazon server using putty from my Windows system.
- How to do this using scp or any other command?
- How do I download a file from the Amazon server to my Windows system?
3 Answers 3
I would recommend a full terminal emulator for Windows like Cygwin, MobaXterm, or BitVise. Cygwin will let you SSH and SCP from the command line. MobaXterm has a built in file transfer pane that will follow the command line’s working directory. Like Moba, BitVise offers a terminal and a graphical interface for moving files to and from the remote system. Following is a picture of the BitVise SFTP interface.
Putty is a terminal client providing you a way to execute commands and view their output on the remote machine. It is not a file transfer client. There is an SCP program in the same family of tools for Windows called PSCP, but it is command line focused for use in a windows console and might not be the easiest place to get started.
Instead I would recommend checking out WinSCP, a graphical client for SCP operations with a two-pane interface for transferring files back and forth that is likely the sort of thing you are looking for. Like all SCP programs it uses the SSH protocol for authentication and over the wire security but is focused on just the file copy operations provided by SCP.
Putty in itself doesn’t support file transfers in the way that you want. You would need to download, install and use PSCP and PSFTP (from PuTTY).
There are other clients too such as WinSCP, Filezilla which may suit your needs better.
www.makeuseof.com
Follow MUO
How to Transfer and Share Files Between Windows and Linux
Moving from Windows to Linux and need to copy data across? Use these tricks to transfer or share files from Windows to Linux.
Copying data from a Windows PC to Linux—or in the other direction—can seem intimidating at first. After all, it’s something that seems like it should be simple, but turns out to be difficult.
In truth, sharing files from Windows to Linux is easy, but only if you know how to do it. Ready to find out?
5 Ways to Transfer Files from Windows to Linux
Transferring data between Windows and Linux operating systems is easier than you think. We’ve compiled five ways for you to do this:
- Share network folders
- Transfer files with FTP
- Securely copy files via SSH
- Share data using sync software
- Use shared folders in your Linux virtual machine
With each of these methods you’ll be able to easily (and in some cases, effortlessly) move files between operating systems.
Let’s look at them in turn and find out which one suits you best.
1. Share Network Folders Between Linux and Windows
The most obvious way to share files between Linux and Windows is to take advantage of network shares. This term refers to folders on one PC that are available to users on other machines. On a Windows-only network this is easy to set up. Adding a Linux device complicates matters slightly, although this can be overcome.
Starting on the Windows machine, right-click the network connection icon in the system tray and select Open Network & internet Settings. Next, click Sharing options and for the current profile enable
- Turn on network discovery
- Turn on file and printer sharing
Click Save changes to confirm, then browse to the folder containing the files you wish to share. Right-click the folder, select Properties and open the Sharing tab. Here, click Advanced Sharing then check the Share this folder box.
You can manage access to the folder via Permissions; this refers to local Windows users, not network devices.
Click OK to confirm the change, then open the Security tab in Properties. Configure this to mirror the settings in the Permissions box previously. You shouldn’t need to do too much here as Windows 10 should include a group called Authenticated Users. This is used for remote access to your computer.
Again, click OK when you’re done.
To find the Windows share from your Linux PC, simply open the file browser and select Network. From here, navigate to the Windows-hosted folder, and start exchanging data.
Access a Linux Share From Windows
To move data in the other direction, you’ll need to install Samba on your Linux computer.
Next, set a username for the samba share
You’ll be prompted for a password for the new account (don’t call it «username»!).
Next, create a directory to share the data from.
Next, edit the smb.conf file in your text editor:
Add the following to the end of the configuration file:
Make the required changes to suit your own needs, then hit Ctrl + X to exit, tapping Y to save. Next, restart Samba:
You’ll then be able to access the share from Windows. Open File Explorer or your browser and input the IP or hostname of the remote Linux device, followed by the folder name. In our example, this is
2. Copy Files via SSH From Windows to Linux
With SSH enabled on your Linux device, you can send data via the command line from one computer to another. For this to work, however, you will need to set up an SSH server on your Linux machine.
Start by opening a terminal and updating and upgrading the OS.
Once complete, install the SSH server. The OpenSSH server is a good option.
Wait while it installs. To check at any time if the OpenSSH server is running, use
To transfer data from Windows, use an SSH client like PuTTY. This needs the PSCP tool downloading to your Windows system to run alongside PuTTY. Find both on the PuTTY homepage.
Note that while PuTTY will need installing, PSCP won’t. However, it should be saved in the root of the C:\ drive or else set up as an environment variable. You’ll also need to confirm the IP address of the Linux device. Check this on the box with
With a connection established, you can send data like this:
You’ll be prompted for your password for the Linux computer before the transfer commences.
Want to copy data from Linux to Windows in the same SSH session? This command will download the specified file to the current directory:
Note the lone period at the end—include this or the transfer will not work.
3. How to Transfer Files From Linux to Windows Using FTP
A file transfer protocol (FTP) application with SSH support can also be used. Transferring files via SFTP in a mouse driven user interface is arguably easier than relying on typed commands.
Again, an SSH server must be running on the Linux machine before you start. You should also ensure you have installed an FTP app like FileZilla, which has SFTP support.
To use this method, run FileZilla, then open File > Site Manager. Create a New Site, taking care to set the Protocol to SFTP. Add the target IP address in Host, then the username and password, setting the Logon Type to Normal.
Click Connect when ready, then use the FTP interface to drag and drop files between the two computers.
4. Share Files Between Linux and Windows With Resilio Sync
Another option you should consider is a file syncing program. These are typically cross-platform and use an encrypted key to manage the connection between devices.
All you need to do is install the app, nominate a sync folder, then create the key. Set this up on the second PC and your data will then sync. Two good options are available for this:
- Resilio Sync: formerly known as BitTorrent Sync, Resilio is available on almost any platform you can think of. There is a paid version, but the free option is enough for syncing two devices.
- SyncThing: for Linux, Windows, macOS, and Android, this Resilio Sync alternative offers a similar feature without the paid component.
Our guide to using Resilio Sync (as well as Syncthing) will guide you through setting up network file transfers between computers.
5. Create and Mount a VirtualBox Shared Folder in Linux
Many people don’t run a separate Linux machine. Instead, it’s common to run Linux in a virtual machine (VM). But is there are way to transfer files between Windows and Linux when one is installed in a VM?
Fortunately, yes. With VirtualBox you can create a virtual shared directory for data syncing.
If you’re running Windows in a VM on Linux (or vice versa), VirtualBox is already set up for sharing. Ensure you have the Guest Additions installed on your virtual machine before proceeding.
In the VirtualBox manager, select the VM and choose Start > Headless Start (Alternatively start the VM then open Devices > Shared Folders). When the status displays that the machine is running, open right-click the VM and select Settings > Shared Folders.
Here, select Machine Folders then click the + symbol on the right (or right-click and select Add Shared Folder). Browse the Folder Path, find the directory you want to use, set a name (if necessary) then OK.
Use the Auto-mount checkbox if you want the share to be available whenever the VM runs. Click OK again to confirm and exit. When you reboot the VM, the share will be ready to swap data between the host PC and guest operating system
Sharing Files Between Windows and Linux Is Easy
Whether you’re new to Linux, or you find Windows unfamiliar, sharing data between them is easier than you think.
We’ve looked at several methods. We’d recommend you try all of them and work out which one you’re most comfortable with.
If you’re syncing data to Linux, there’s a good chance you’re migrating your computing from Windows. Check our guide to switching from Windows to Linux for more tips.
Here are some fun secrets that you can use to take your Netflix experience to the next level.
Deputy Editor for Security, Linux, DIY, Programming, and Tech Explained. He also produces The Really Useful Podcast and has extensive experience in desktop and software support. A contributor to Linux Format magazine, Christian is a Raspberry Pi tinkerer, Lego lover and retro gaming fan.
Subscribe To Our Newsletter
Join our newsletter for tech tips, reviews, free ebooks, and exclusive deals!
One More Step…!
Please confirm your email address in the email we just sent you.