Centos 5.4: How do I manage ftp space from command line.

I would like to manage some FTP space that is only accessible from my server. I don't want to install anything new. I just want to use the standard FTP command.



Could you show me how to (from the command line):

1. Login to the ftp account
2. Get a list of files and directories
3. Create a directory called "backups"
4. Download a file from the backups directory.
5. Upload a file to the backups directory.

Kind Regards,

Adrian Smith
Who is Participating?
JelcinConnect With a Mentor Commented:
You have to distinguish between the shell on your linux computer and the ftp command line you call within your linux shell.

To go to the directory of your choice (with your linux shell) on your local machine you just need four commands.

1. ls (list the content of the directory you are currently in)
2. cd (go to one of the directories within your directory you are currently in)
3. cd .. ( go one directory backwards )
4. pwd (prints the directory tree you are currently in)

so if you are in "/home/fred" (check by typing "pwd") directory and there is a directory called "download" in your /home/fred/ directory you can change to the "download" directory by typing "cd download". Than your current directory should be "/home/fred/download". If you want to go back in your directory tree just type "cd .." and you will be back in "/home/fred".

So first you need to go to the directory of your choice on your local machine (where you would like to store the files to be downloaded).
Than you can call the ftp command line, connect to the ftp server and download the file you need to.
The file will then be downloaded to the local directory you was in before you called the ftp command line.

Below is a log of my linux shell doing the described above...

1. ftp [ipadress]
2. dir
3. mkdir backups
4. cd backups
5. get [file-from-ftp-directory]
6. put [file-from-local-directory]

for help type "help"
for more instructions on ftp type in the shell "man ftp"
Kerem ERSOYPresidentCommented:

Yu can use vsftpd install it with this command:

yum install vsftpd

After the install is complete you can start it:

service vsftpd start

if you want to run it after reboot autoatically

chckonfig vsftpd on

once it is active you vcan ftp it from a remote host:

ftp your_cents_system

it will respond with user and pass prompts fill in the user information .

once you've logged on you will have a promt such as this:


enter :


and you'll get a listing of remote directory.


will show you the contents of the current directory at your local system where you run ftp client.

mkdir backup

will create a directory called backup at the remote host

cd backup

will change your remote directory to newly created backup directory.


will set your ftp to binary mode. (some ftp clients default to text mode which might disrupt binary content)

put filename

will send the file to the remote host

get filename

will get the file from the remote server.

If you want to get several files you'd better use

or mget

these commands will also accept wildcard characters.


Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

AdrianSmithUKAuthor Commented:
Hi Jelcin

Thanks for the sppedy response. I'm getting an error at point 1. I typed

ftp> ftp backup500.onlinehome-server.info

I will also need to include my username and password at some point.

I know the ftp space is accessible because I have a shell script that uses it.

AdrianSmithUKAuthor Commented:
Hi KeremE:

Many thanks for the info but as I said in the question - I don't want to install anything.

I want to stay with an absolutely minimal server.
If you are already in the ftp command line you need to press "o" for open a connection.
AdrianSmithUKAuthor Commented:
Hi Jelcin

Many thanks and you've earned the points. However, before I close the issue could you explain the difference between GET and PUT.

Could you also show me how to save a file to a directory called Fred on my server.
AdrianSmithUKAuthor Commented:
Sorry Jelcin - I see you mentioned the first poin already.
Also important as KeremE mentioned:

will set your ftp to binary mode. (some ftp clients default to text mode which might disrupt binary content)

If you are going to transfer text files (includes txt, html, shell scripts, css files etc) you need to set the file transfer mode to ascii using "ascii" command.

On the other hand if you are going to transfer binary files (like images, pdf, MS office files, compiled code or executables etc) you need to set the file transfer mode to binary using "binary" command.
AdrianSmithUKAuthor Commented:
Sorry, I think you missed the second part of my question 3 posts up.

To close the issue could you give me instructions on how to transfer a file from the ftp directory

FTP Directory:
backups/backup123.sql.gz (Gzip sql file)

Local Directory

1. Change the current local working directory to fred

2. ftp [ipadress] or ftp> o [ipadress]
3. dir
4. cd backups
5. binary
6. get backup123.sql.gz
7. quit

"get" is to get files from FTP server and "put" is to upload files to the FTP server.
AdrianSmithUKAuthor Commented:
Sorry Jelcin - How do I get it into the directory stated above?
wait a moment please i will do a screenshot of my shell
AdrianSmithUKAuthor Commented:
Many thanks. You're a star.

Kind Regards,

Adrian Smith
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.