15 practical examples of ftp commands

FTP stands for File Transfer Protocol.

It is one of the most useful command for a system administrator, all administrator almost every day using ftp commands to transfer files between servers.

Suggested Reading

You can also read about FTP command structure

Learn FTP commands structure and syntax to use it frequently for moving backup data or some critical file which needs to move in some safe location.

Here I am going to mention 15 methods to use the FTP command in system admin day-to-day life.

FTP Commands Examples:

Now, let’s discuss on 15 practical uses of ftp commands:

Example 1 – Connect FTP server with IP

Connect to ftp server using ftp command as shown below.

$ ftp 192.168.10.1

We can use above command to connect with server “192.168.10.1”.

Example 2 – Connect FTP server with Hostname

Connect to ftp server using hostname of ftp server as shown below.

$ ftp linuxconcept.com

We can use above command to connect with server “linuxconcept.com”.

Example 3 – Upload files into FTP server

To upload files on ftp server, use put command as shown below.

ftp> put linuxconcept.com

The above command will upload the file “linuxconcept.com” on server.

Example 4 – Download files from FTP server

To download files from ftp server, use get command as shown below.

ftp> get linuxconcept.txt

The above command use to download “linuxconcept.txt” file from server.

Example 5 – Upload multiple files into FTP server

To upload multiple files into server use “mput” command as show below.

ftp> mput *.txt

The above command will upload all file into server which has “txt” extension in current local directory.

Example 6 – Download multiple files from FTP server

To download multiple files from server, use “mget” command as show below.

ftp> mget *.txt

The above command use to download all files from current remote directory which has “txt” extension.

Example 7 – Delete file from FTP server

To delete file from server, use “delete” command as show below.

ftp> delete linuxconcept.txt

The above command is use to delete linuxconcept.txt file from server.

Example 8 – Delete multiple files from FTP server

To delete multiple files from server in single command, use “mdelete” as shown below.

ftp> mdelete *.txt

The above command use to delete all files from server which has “txt” extension.

Example 9 – Use help in ftp terminal

To get help in ftp command, use “help” or “?” as show below.

ftp> help
ftp> ?

If you want detailed help on specific ftp command use below syntax of ftp command.

ftp> help <COMMAND>

Example 10 – Changing FTP mode to binary

To change ftp mode to binary, use “binary” command as shown below.

ftp> binary

Example 11 – Changing FTP mode to Ascii

To change ftp mode to asci, use “asci” command as shown below.

ftp> ascii

Example 12 – Changing remote directory in FTP

To change remote server’s directory in ftp server, use “cd” command as shown below.

ftp> pwd
257  “/linuxconcept” is current directory.
ftp> cd testdir
250  CWD  command successful. “/linuxconcept/testdir” is current directory.
ftp> pwd
257  “/linuxconcept/testdir” is current directory.

The above command use to change directory “testdir” on remote server.

Example 13 – Changing local directory in FTP

To change local system directory on ftp prompt, use “lcd” command as shown below.

ftp> lcd /tmp

The above command use to change “/tmp” local directory.

Example 14 – Listing content of the remote directory in FTP

To list all files and content for FTP server’s remote directory, use “ls” or “dir” command as shown below.

ftp> ls
ftp> dir

Example 15 – Close FTP connection

To close the FTP connection from the server, use “quit” or “close” command.

When using the “quit” command, connection will terminate, and you will be on your system back, as shown below.

ftp> quit
$

When you want to close connection from server without coming out from FTP prompt, use “close” command as shown below.

ftp> close
221 Goodbye.
ftp> 

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Related Articles