Tuesday, July 22, 2008

How To Do FTP File Operations without Graphical FTP Client

On small and medium scale server environment, most linux servers are not equipped with X (GNOME/KDE) graphical platform that makes the task of uploading and downloading FTP files to and from your current location a much more easier task. Consider a robust FTP client software equipped with user-friendly and graphical menu interface to upload/download FTP files could offer a much more convenient and easier process to accomplish FTP file operations compared to command-line driven FTP commands.

What do you do if your linux system does not support graphical X11 programs? What steps you can follow from your linux desktop without X to process FTP task into your FTP server? Here's a quick entry on how to accomplish that.

Download and Upload FTP Files from Command Line Terminal

Minimum Requirements

1. Existing FTP server
2. Existing FTP user account details

Step One

Connect and log on to your FTP server from terminal.  Supply the required FTP username and password.

# ftp domain.com

Launching the above command would give you similar lines as shown below

Connected to domain.com (83.83.83.83).
220---------- Welcome to Pure-FTPd [TLS] ----------
220-You are user number 2 of 50 allowed.
220-Local time is now 03:32. Server port: 21.
220-This is a private system - No anonymous login
220 You will be disconnected after 15 minutes of inactivity.
Name (domain.com:root): ftpuser
Password: *******
230-User ftpuser has group access to:  ftpuser
230 OK. Current restricted directory is /
Remote system type is UNIX.
Using binary mode to transfer files.

Now, the last line showed that the curent binary mode of file transfer is binary. You can optionally modify this value.

To change FTP file transfer mode to ASCII

To transfer all ASCII file types, simply

ftp> ascii

To change FTP file transfer mode to binary

ftp> bin

Step Two

Identify your current local and remote directory location.

To change your current local directory
ftp> lcd /home/user1
Local directory now /home/user1

To change your current FTP directory folder


ftp> cd www
250 OK. Current directory is /www

To list down all remote FTP files from current directory location

ftp> ls
# ls *.html
# ls *.php

Alternatively, you can use dir

ftp> dir
ftp> dir *.php

When transferring files, by default configuration, the current file transfer status is now shown. You could setup your current connection to shown you current command status and even send you a beep when the last issue FTP command has been completed.

To show FTP file transfer status for file transfer

ftp> hash

To toggle hash status, simply re issue hash command again.

To send alert on FTP command completion

ftp> bell
Step Three

Now that your current local and remote location have been identified, you can now begin your FTP file transfer

To upload a file from local to remote FTP server

ftp> put filename.txt
ftp> put filename.php

To upload multiple files to remote FTP server

ftp> mput *.php

To confirm file changes from remote, simply re issue a directory listing command

ftp> ls

To download FTP files into your local folder

ftp> get filename.txt

To download multiple FTP files from terminal

ftp> mget *.php

To disconnect from FTP connection

ftp> bye
ftp> quit

221-Goodbye. You uploaded 0 and downloaded 1 kbytes.
221 Logout.

The total number of uploaded and download FTP files will be shown to you when disconnecting from FTP server as shown above.

For more ftp commands, issue

ftp> help
All is done.

0 comments:

Sign up for PayPal and start accepting credit card payments instantly.
ILoveTux - howtos and news | About | Contact | TOS | Policy