Using ftp in Linux

Recommend this page to Google

FTP stands for File Transfer Protocol. It is a very simple and useful protocol which allows its users to transfer files between computers.

ftp (in lower case) is a program that allows you to transfer your files between computers.

FTP is used by almost all webmasters. They mostly use it to upload their file to the server and to back up the sites locally.

In this article, we would see how it is used in Linux/Unix systems. ftp program comes along with most Linux distributions. So you don't have to worry about downloading, installing, etc.

Running ftp

You can only connect to a system that accepts ftp requests. Typically, it is called the ftp server. To connect to an ftp server, we can use one of the following commands:

$ ftp


$ ftp
ftp> open

Your would then be asked to type in your login and password.

Navigating and listing directories

Once you have logged in successfully, you may use cd and ls to navigate your directories. They function the same way as Linux command line.

Downloading Files

To download, we use:

ftp> get filename

To download multiple files

ftp> mget filename filename filename

You may also use wildcards. For example, acc* would get all files that begin with acc.

ftp> mget acc*

You will be asked before each file is downloaded. You can use the prompt command to get arround this. Uploading Files

Before we can upload, we need to make sure that our local directory is listed correctly. So we will change the directory to the desired directory.

ftp> lcd /home/mysite/

To upload, we use:

ftp> put filename

To upload multiple files

ftp> mput filename filename filename
ftp> mput acc*

You may also use wildcards.

Help and more

To get help, you can type the command help. Following is a list of useful commands and their uses.

make a directory
remove a directory
change permissions
delete file

About the Author:

Copyright Nazim Rahman (c)

Please feel free to publish this article, free of charge, as long as this resource box is visibly published.

No votes yet