How To Transfer File Using FTP cli in Linux Server?

May 29, 2020 / Nirav Shah

<h2><b>What is File Transfer Protocol?</b></h2>

<ul class=”listing”>
<li><strong>FTP according to Wikipedia</strong>
<ul class=”listcircle”>
<li>“The File Transfer Protocol (FTP) is a standard network protocol used for the transfer of computer files between a client and server on a computer network.”</li>
<li>Don’t worry, if you didn’t get what this means. To understand the real thing you just need to know some points about how the servers work.</li>
</ul>
</li>
<li><strong>Little basics to understand server-client relation</strong>
<ul class=”listcircle”>
<li>There are always two sides on the Internet, first one is the client(i.e. your browser or system’s program who is sending request) and the second one is the server (i.e. the server which is handling the request sent by the client and responding), that’s why we call it client-server connection.</li>
<li>The browser is not the only thing that sends requests to the server, there are so many other programs and codes that can send the request to the same server but all the request entities have to follow some specific protocols.</li>
<li>Inside a server, many programs run, so to send the request to a specific program on a server, we should also know the port number of the program on which it is running on the server.</li>
</ul>
</li>
<li>Best GUI Application for FTP Connection
<ul class=”listcircle”>
<li>TFilezila
<ul class=”square”>
<li>One of the best free FTP Client</li>
</ul>
</li>
</ul>
</li>
<li><strong>Command line commands CLI</strong></li>
<li><strong>Per Requirements</strong>
<ul class=”listcircle”>
<li>TFTP Client</li>
</ul>
</li>
<li>Steps are as follow to upload a file in the server</li>
</ul>

<ul class=”listing”>
<li>To install FTP in the server</li>
</ul>

<pre>$ yum install ftp</pre>

<ul class=”listing”>
<li>To connect to ftp client</li>
</ul>

<pre>$ ftp remote-ip or remote-hostname</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/cliStep1.png” class=”img-responsive” alt=”step-1″>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/cliStep2.png” class=”img-responsive” alt=”step-2″>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/cliStep3.png” class=”img-responsive” alt=”step-3″>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/cliStep4.png” class=”img-responsive” alt=”step-4″>

<ul class=”listing”>
<li>Change to the target directory.</li>
</ul>

<pre>$ ftp> cd target-directory</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/cliStep5.png” class=”img-responsive” alt=”step-5″>

<ul class=”listing”>
<li>Ensure that you have write permission to the target directory.</li>
</ul>

<pre>$ ftp> ls -l target-directory</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/cliStep6.png” class=”img-responsive” alt=”step-6″>

<ul class=”listing”>
<li>Set the transfer type to binary.</li>
</ul>

<pre>$ ftp> binary</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/cliStep7.png” class=”img-responsive” alt=”step-7″>

<ul class=”listing”>
<li>To copy a single file, use the put command.</li>
</ul>

<pre>$ ftp> put filename</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/cliStep8.png” class=”img-responsive” alt=”step-8″>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/cliStep9.png” class=”img-responsive” alt=”step-9″>

<ul class=”listing”>
<li>To copy multiple files at once, use the mput command.</li>
</ul>

<pre>$ ftp> mput filename [filename …]</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/cliStep10.png” class=”img-responsive” alt=”step-10″>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/cliStep11.png” class=”img-responsive” alt=”step-11″>

<ul class=”listing”>
<li>To close the ftp connection, type bye.</li>
</ul>

<pre>$ ftp> bye</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/dfstep12.png” class=”img-responsive” alt=”step-12″>

<ul class=”listing”>
<li><strong>To close the ftp connection, type bye.</strong></li>
<li>To install FTP in the server</li>
</ul>

<pre>$ yum install ftp</pre>

<ul class=”listing”>
<li>To connect to ftp client</li>
</ul>

<pre>$ ftp remote-ip or remote-hostname</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/dfstep1.png” class=”img-responsive” alt=”step-1″>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/dfstep2.png” class=”img-responsive” alt=”step-2″>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/dfstep3.png” class=”img-responsive” alt=”step-3″>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/dfstep4.png” class=”img-responsive” alt=”step-4″>

<ul class=”listing”>
<li>Change to the target directory.</li>
</ul>

<pre>$ ftp> cd target-directory</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/dfstep5.png” class=”img-responsive” alt=”step-5″>

<ul class=”listing”>
<li>Ensure that you have write permission to the target directory.</li>
</ul>

<pre>$ ftp> ls -l target-directory</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/dfstep6.png” class=”img-responsive” alt=”step-6″>

<ul class=”listing”>
<li>Set the transfer type to binary.</li>
</ul>

<pre>$ ftp> binary</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/dfstep7.png” class=”img-responsive” alt=”step-7″>

<ul class=”listing”>
<li>To copy a single file, use the put command.</li>
</ul>

<pre>$ ftp> get filename</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/dfstep8.png” class=”img-responsive” alt=”step-8″>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/dfstep9.png” class=”img-responsive” alt=”step-9″>

<ul class=”listing”>
<li>To copy multiple files at once, use the mput command.</li>
</ul>

<pre>$ ftp> mget filename [filename …]</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/dfstep10.png” class=”img-responsive” alt=”step-10″>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/dfstep11.png” class=”img-responsive” alt=”step-11″>

<ul class=”listing”>
<li>To close the ftp connection, type bye.</li>
</ul>

<pre>$ ftp> bye</pre>

<img src=”https://www.eternalsoftsolutions.com/blog/wp-content/uploads/2020/05/dfstep12.png” class=”img-responsive” alt=”step-12″>


Talk to AWS Certified Consultant

    Spread Love By Sharing:

    Let’s Talk About Your Needed AWS Infrastructure Management Services

    Have queries about your project idea or concept? Please drop in your project details to discuss with our AWS Global Cloud Infrastructure service specialists and consultants.

    • Swift Hiring and Onboarding
    • Experienced and Trained AWS Team
    • Quality Consulting and Programming
    Let’s Connect and Discuss Your Project