FTP Linux Commands

Linux Commands of FTP Server



Command to connect ftp server

ftp ftp.example.com

ftp 192.268.10.20

ftp user@ftp.example.com


This command will attempt to connect to the ftp server. If it succeeds, it will ask to log in using a username and password. Public ftp servers often allow you to log in using the username "anonymous".


FTP Prompt

When you enter your loginname and password for the ftp server, it returns the prompt

ftp>

You need to type all commands in front of the ftp> prompt.


FTP Help

ftp> help

or

ftp> ?

To get more information about the FTP commands

Listing current directory File

ftp> ls

This command prints the names of the files and subdirectories in the current directory on remote system.

ftp> !ls

A '!' in front will execute the specified command on the local computer. So '!ls' lists the file names and directory names of the current directory on the local computer.


Changing the directory

ftp> cd subdir

This command changes will change the current directory to subdir.

ftp> cd ..
This command changes the current directory to the parent directory (comes one directory before).

Change Local Directory

To change directory on your local system

ftp> lcd DirName
ftp> lcd Directory_path


Print local directory path

ftp> lpwd


Setting the Mode of File Transfer

To set the mode of file transfer to ASCII

ftp> ascii

"Ascii" is default mode and good for transferring text files.

To set the mode of file transfer to binary

ftp> binary

"Binary" mode is used for transferring all files that are not text files. The binary mode is recommended for almost all sorts of files including images, zip files and much more. The binary mode provides less chance of a transmission error.


Downloading file

ftp> get FileName

This command downloads the file FileName from the remote computer to the local computer.

ftp> get FileName NewFileName

This command downloads the file FileName from the remote computer and copy as name NewFileName on the local computer.


Uploading File

ftp> put FileName

This command uploads the file from the local computer to the remote computer.


Downloading multiple files

ftp> mget *

This command downloads all files from remote computer to local computer.

ftp> mget *.jpg

This command downloads all files that end with ".jpg".


Uploading multiple Files

ftp> mput *

This commands uploads all files from local computer to remote computer.

ftp> mput *.jpg

This commands uploads all files that end with ".jpg".


Deleting Files

ftp> delete deletefile

This command deletes the file from remote system


Deleting Multiple Files

ftp> mdelete *

This command deletes all files.


Turn On / Off Interactive Prompting

ftp> prompt

The ftp command prompt sets interactive prompting. “On” enables prompting so that you can verify of each step of the multiple commands, “off" allows the commands to act without user confirmation.

ftp> prompt on
ftp> mput *.jpg

This command Prompted for a yes/no (Y/N) answer before transferring each file.

ftp> prompt off
ftp> mget *.pl


This transfer file without user confirmation.


Connecting To Another FTP Server

To open a connection with another ftp server

ftp> open ftp.ftpserver.com

This command opens a new FTP connection with ftp.ftpserver.com.


Exit the FTP Session

ftp> quit
OR
ftp> bye


It exits the ftp program.



No comments: