Upload File From Local Machine to Server Using Cmd

In this article, I'll respond a question that often comes upwards in my online courses, which is:

How do you upload a dataset (e.g. csv, txt or tsv raw information files) to a remote server?

It'due south a uncomplicated question and the answer is also very simple. But I get this from time to fourth dimension, then I presume that this is a common problem for people who but got started learning information scientific discipline. And here's the respond!

This article is available in video format, too!

Local computer to remote server

The issue is elementary.

You have your local computer, where y'all have a dataset — have this instance.csv or example2.csv file — and you want to upload this to your remote information server.

data files on local computer

I'll testify you lot two solutions for this problem:

  1. in the start 1, I'll employ the command line (which I call the painful solution)
  2. in the second ane, I'll use Jupyter, which is a web application that I mainly apply to prototype my Python code — but it'll be very handy for this file-upload-issue, too.

Now, if you don't know what a remote information server is or yous don't know what Jupyter is, check out my remote server setup tutorial offset. In that article, I show you how you tin install Python and SQL pace-by-step to learn and exercise data scientific discipline in a real-life-like environment.

Merely if you lot accept these already, then just follow me.

Upload a dataset using the command line

Let'south see the painful solution first. In this article, I'll show you a solution that works on Mac and Linux only. But you can practice similar things on Windows using PuTTY.

Either fashion, y'all don't have to worry about it because I show this to you only to demonstrate how painful it is — then you can better appreciate the second solution that will work on all operating systems anyway. 😉

As a first step, open a Terminal window.

Correct at present, you are on your local estimator. Go to the folder where yous store your data file locally. For me, it's

cd Desktop/example/

And hither, I accept instance.csv and example2.csv.

datasets computer command line

The next step is typing the actual command, which looks like this:

scp /Users/tomimester/Desktop/instance/instance.csv tomi@134.122.73.132:~/upload_demo/

Let's break this down:

  • scp stands for secure re-create protocol and it's the re-create command itself
  • and so you blazon your file proper name (instance.csv) — preferably with the full path included (/Users/tomimester/Desktop/example/example.csv). Note: if y'all are already in the folder where your files are located, it's fine to add just the file name without the full path.
  • The next step is to specify where we desire to copy it to. You accept to add the details of your remote server, more specifically the user name and the IP address (for me it was tomi@134.122.73.132) then a colon and a tilde character (:~). These volition specify that your file goes directly into your user's folder on your remote server. And so you lot have to specify the verbal folder you want to re-create your file into (given that this folder exists on the server). For me, information technology'll be the upload_demo binder that I created earlier.
scp command line data files

So all in all, you need:

  • the copy command
  • the file you want to copy
  • and the destination on your remote server

Striking enter, type your password — and boom: the example.csv file is uploaded!

copy data file to server

Double-check your data file!

If you ssh to your server and go to the correct folder, yous'll run into that the file is at that place every bit it should be.

data server file

Well, this was but a small demo file — but yous tin can upload bigger files, of course, using the scp command.

Anyways: from this point on, you lot can utilize your dataset for your projects that are done on your remote data server. Nice stuff!


Okay, so this is how you tin upload a data file to your data server via the control line. (At least on Mac and Linux, but again: this can exist washed using PuTTY on windows.)

As I said, I notice this process a bit painful, at to the lowest degree compared to the second solution, which is a point-and-click solution and as well works on all operating systems.

Upload a dataset using Jupyter

For this second solution, you'll need Jupyter installed to your remote server already.

I assume that you take this — as virtually people who learn data science and Python adopt to do that using Jupyter Notebooks. Just if y'all don't, bank check out the server setup tutorial I mentioned before.

Anyways, if you have Jupyter on your remote server, then, as a first step, open Terminal (or PuTTY) and log in to your server.

ssh to a server dataset

And once you are logged in, yous can start Juptyer using the:

jupyter notebook --browser whatever

control.

jupyter dataset

Once it's running, go to a browser window (due east.1000. open a Google Chrome) and type [your server's IP]:8888. (Only as we exercise all the time when running a Jupyter notebook.)

For me it'due south going to be:

134.122.73.132:8888

Note: You lot'll also copy-paste your token from Last — or type your password if you have one already set.

The good thing is that in Jupyter you lot tin pretty much upload your file in the point-and-click way — because in the top correct corner, at that place is an UPLOAD button. How convenient is that?

upload a file to a data server with jupyter

So just click to your folder called upload_demo.

Here, y'all'll find the file that you've uploaded via the command line already.

upload a dataset to data server jupyter

And upload the example2.csv file by clicking the Upload button (in the peak right corner), then select example2.csv in the window that pops up…

And and then a new row shows upwardly in your file list — just click Upload again to finalize the uploading process.

upload data file server jupyter

And there is your example2.csv dataset uploaded to your information server!

data file dataset server

Very very simple, just equally I promised!

Decision

Okay, that's information technology, this is the simplest way to upload your datasets to a remote server… well, at to the lowest degree, if you are a information scientist using Jupyter.

If not, y'all tin can still take advantage of the first method and use scp — only again to exist honest, I don't actually apply that method any more, because the Jupyter 1 is much, much more user-friendly.

  • If you desire to learn more than well-nigh how to become a data scientist, take my l-minute video course: How to Become a Data Scientist. (It's free!)
  • Also bank check out my 6-week online course: The Junior Data Scientist'due south First Month video grade.

Cheers,
Tomi Mester

ballraity1973.blogspot.com

Source: https://data36.com/upload-dataset-to-a-server-command-line-jupyter/

0 Response to "Upload File From Local Machine to Server Using Cmd"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel