TheTAZZone - Internet Chaos

FTP Commands and Usages

ORIGINALLY POSTED BY NOKIA FOR THETAZZONE/TAZFORUM HERE

Do not use, republish, in whole or in part, without the consent of the Author. TheTAZZone policy is that Authors retain the rights to the work they submit and/or post…we do not sell, publish, transmit, or have the right to give permission for such…TheTAZZone merely retains the right to use, retain, and publish submitted work within it’s Network

I thought this may come in handy now we have our own FTP server up and running!

I had it in a ‘gubbins’ file, I C+P’d it from somewhere a long time ago but can’t remember where or I would quote the source.

* ! – Runs the specified command on the local computer
* ? – Displays descriptions for ftp commands
* append – Appends a local file to a file on the remote computer
* ascii – Sets the file transfer type to ASCII, the default
* bell – Toggles a bell to ring after each file transfer command is completed (default = OFF)
* binary – Sets the file transfer type to binary
* bye – Ends the FTP session and exits ftp
* cd – Changes the working directory on the remote computer
* close – Ends the FTP session and returns to the command interpreter
* debug – Toggles debugging (default = OFF)
* delete – Deletes a single file on a remote computer
* dir – Displays a list of a remote directory’s files and subdirectories
* disconnect – Disconnects from the remote computer, retaining the ftp prompt
* get – Copies a single remote file to the local computer
* glob – Toggles filename globbing (wildcard characters) (default = ON)
* hash – Toggles hash-sign (#) printing for each data block transferred (default = OFF)
* help – Displays descriptions for ftp commands
* lcd – Changes the working directory on the local computer
* literal – Sends arguments, verbatim, to the remote FTP server
* ls – Displays an abbreviated list of a remote directory’s files and subdirectories
* mdelete – Deletes one or more files on a remote computer
* mdir – Displays a list of a remote directory’s files and subdirectories
* mget – Copies one or more remote files to the local computer
* mkdir – Creates a remote directory
* mls – Displays an abbreviated list of a remote directory’s files and subdirectories
* mput – Copies one or more local files to the remote computer
* open – Connects to the specified FTP server
* prompt – Toggles prompting (default = ON)
* put – Copies a single local file to the remote computer
* pwd – Displays the current directory on the remote computer (literally, “print working directory”)
* quit – Ends the FTP session with the remote computer and exits ftp (same as “bye”)
* quote – Sends arguments, verbatim, to the remote FTP server (same as “literal”)
* recv – Copies a remote file to the local computer
* remotehelp – Displays help for remote commands
* rename – Renames remote files
* rmdir – Deletes a remote directory
* send – Copies a local file to the remote computer (same as “put”)
* status – Displays the current status of FTP connections
* trace – Toggles packet tracing (default = OFF)
* type – Sets or displays the file transfer type (default = ASCII)
* user – Specifes a user to the remote computer
* verbose – Toggles verbose mode (default = ON)

__________________________________________________________
!
Runs the specified command on the local computer.

Syntax: ! [command]

Parameter(s):
command – Specifies the command to run on the local computer. If command is omitted, the local command prompt is displayed; type “exit” to return to ftp.

?
Displays descriptions for ftp commands. ? is identical to help.

Syntax: ? [command]

Parameter(s):
command – Specifies the name of the command about which you want a description. If command is not specified, ftp displays a list of all commands.

append
Appends a local file to a file on the remote computer using the current file type setting.

Syntax: append local-file [remote-file]

Parameter(s):
local-file – Specifies the local file to add.
remote-file – Specifies the file on the remote computer to which local-file will be added. If remote-file is omitted, the local filename is used for the remote filename.

ascii
Sets the file transfer type to ASCII, the default.

Syntax: ascii

Note
FTP supports two file transfer types, ASCII and binary image. ASCII should be used when transferring text files. See also binary.

In ASCII mode, character conversions to and from the network standard character set are performed. For example, end-of-line characters are converted as necessary, based on the target operating system.

bell
Toggles a bell to ring after each file transfer command is completed. By default, the bell is off.

Syntax: bell

binary
Sets the file transfer type to binary.

Syntax: binary

Note
FTP supports two file transfer types, ASCII and binary image. Binary should be used when transferring executable files. In binary mode, the file is moved byte-by-byte. See also ascii.

bye
Ends the FTP session with the remote computer and exits ftp.

Syntax: bye

cd
Changes the working directory on the remote computer.

Syntax: cd remote-directory

Parameter(s):
remote-directory – Specifies the directory on the remote computer to change to.

close
Ends the FTP session with the remote server and returns to the command interpreter.

Syntax: close

debug
Toggles debugging. When debugging is on, each command sent to the remote computer is printed, preceded by the string —>. By default, debugging is off.

Syntax: debug

delete
Deletes a single file on a remote computer. See also mdelete, which can delete multiple files.

Syntax: delete remote-file

Parameter(s):
remote-file – Specifies the file to delete.

dir
Displays a list of a remote directory’s files and subdirectories. See also mdir, which can list multiple directories.

Syntax: dir [remote-directory] [local-file]

Parameter(s):
remote-directory – Specifies the directory for which you want to see a listing. If no directory is specified, the current working directory on the remote computer is used.
local-file – Specifies a local file to store the listing. If not specified, output is displayed on the screen.

disconnect
Disconnects from the remote computer, retaining the ftp prompt.

Syntax: disconnect

get
Copies a remote file to the local computer using the current file transfer type. See also mget, which can copy multiple files.

Syntax: get remote-file [local-file]

Parameter(s):
remote-file
Specifies the remote file to copy.

local-file
Specifies the name to use on the local computer. If not specified, the file is given the remote-file name.

glob
Toggles filename globbing. Globbing permits use of wildcard characters in local file or path names. By default, globbing is on.

Syntax: glob

hash
Toggles hash-sign (#) printing for each data block transferred. The size of a data block is 2048 bytes. By default, hash mark printing is off.

Syntax: hash

help
Displays descriptions for ftp commands.

Syntax: help [command]

Parameter(s):
command – Specifies the name of the command about which you want a description. If command is not specified, ftp displays a list of all commands.

lcd
Changes the working directory on the local computer. By default, the working directory is the directory in which ftp was started.

Syntax: lcd [directory]

Parameter(s):
directory – Specifies the directory on the local computer to change to. If directory is not specified, the current working directory on the local computer is displayed.

literal
Sends arguments, verbatim, to the remote FTP server. A single FTP reply code is expected in return.

Syntax: literal argument [ …]

Parameter(s):
argument – Specifies the argument to send to the FTP server.

ls
Displays an abbreviated list of a remote directory’s files and subdirectories.

Syntax: ls [remote-directory] [local-file]

Parameter(s):
remote-directory – Specifies the directory for which you want to see a listing. If no directory is specified, the current working directory on the remote computer is used.
local-file – Specifies a local file to store the listing. If not specified, output is displayed on the screen.

mdelete
Deletes one or more files on a remote computer.

Syntax: mdelete remote-files [ …]

Parameter(s):
remote-files – Specifies the remote files to delete.

mdir
Displays a list of a remote directory’s files and subdirectories. Mdir allows you to specify multiple files.

Syntax: mdir remote-files [ …] local-file

Parameter(s):
remote-files – Specifies the directory for which you want to see a listing. Remote-files must be specified; type “-” to use the current working directory on the remote computer.
local-file – Specifies a local file to store the listing. Type “-” to display the listing on the screen.

mget
Copies one or more remote files to the local computer using the current file transfer type.

Syntax: mget remote-files [ …]

Parameter(s):
remote-files – Specifies the remote file(s) to copy to the local computer.

mkdir
Creates a remote directory.

Syntax: mkdir directory

Parameter(s):
directory – Specifies the name of the new remote directory.

mls
Displays an abbreviated list of a remote directory’s files and subdirectories.

Syntax: mls remote-files [ …] local-file

Parameter(s):
remote-files – Specifies the files for which you want to see a listing. Remote-files must be specified; type “-” to use the current working directory on the remote computer.
local-file – Specifies a local file to store the listing. Type “-” to display the listing on the screen.

mput
Copies one or more local files to the remote computer using the current file transfer type.

Syntax: mput local-files [ …]

Parameter(s):
local-files – Specifies the local files to copy to the remote computer.

open
Connects to the specified FTP server.

Syntax: open computer [port]

Parameter(s):
computer – Specifies the remote computer to connect to. Computer can be specified by IP address or computer name (a DNS or HOSTS file must be available). If auto-login is on (default), FTP also attempts to automatically log the user in to the FTP server (see Ftp command-line options to disable auto-login).
port – Specifies a port number to use to contact an FTP server.

prompt
Toggles prompting. Ftp prompts during multiple file transfers to allow you to selectively retrieve or store files; mget and mput transfer all files if prompting is turned off. By default, prompting is on.

Syntax: prompt

put
Copies a local file to the remote computer using the current file transfer type. See also mput, which can copy multiple files.

Syntax: put local-file [remote-file]

Parameter(s):
local-file – Specifies the local file to copy.
remote-file – Specifies the name to use on the remote computer. If not specified, the file is given the local-file name.

pwd
Displays the current directory on the remote computer.

Syntax: pwd

quit
Ends the FTP session with the remote computer and exits ftp.

Syntax: quit

quote
Sends arguments, verbatim, to the remote FTP server. A single FTP reply code is expected in return. Quote is identical to literal.

Syntax: quote argument [ …]

Parameter(s):
argument – Specifies the argument to send to the FTP server.

recv
Copies a remote file to the local computer using the current file transfer type. Recv is identical to get.

Syntax: recv remote-file [local-file]

Parameter(s):
remote-file – Specifies the remote file to copy.
local-file – Specifies the name to use on the local computer. If not specified, the file is given the remote-file name.

remotehelp
Displays help for remote commands.

Syntax: remotehelp [command]

Parameter(s):
command – Specifies the name of the command about which you want help. If command is not specified, ftp displays a list of all remote commands.

rename
Renames remote files.

Syntax: rename filename newfilename

Parameter(s):
filename – Specifies the file you want to rename.
newfilename – Specifies the new filename.

rmdir
Deletes a remote directory.

Syntax: rmdir directory

Parameter(s):
directory – Specifies the name of the remote directory to delete.

send
Copies a local file to the remote computer using the current file transfer type. Send is identical to put.

Syntax: send local-file [remote-file]

Parameter(s):
local-file – Specifies the local file to copy.
remote-file – Specifies the name to use on the remote computer. If not specified, the file is given the local-file name.

status
Displays the current status of FTP connections and toggles.

Syntax: status

trace
Toggles packet tracing; trace displays the route of each packet when running an ftp command.

Syntax: trace

type
Sets or displays the file transfer type.

Syntax: type [type-name]

Parameter(s):
type-name – Specifies the file transfer type; the default is ASCII. If type-name is not specified, the current type is displayed.

Note
FTP supports two file transfer types, ASCII and binary image.

ASCII should be used when transferring text files. In ASCII mode, character conversions to and from the network standard character set are performed. For example, end-of-line characters are converted as necessary, based on the destination’s operating system.

Binary should be used when transferring executable files. In binary mode, the file is moved byte-by-byte.

user
Specifes a user to the remote computer.

Syntax: user user-name [password] [account]

Parameter(s):
user-name – Specifies a user name with which to log in to the remote computer.
password – Specifies the password for user-name. If not specified, but required, ftp prompts for the password.
account – Specifies an account with which to log on to the remote computer. If account is not specified, but required, ftp prompts for the account.

verbose
Toggles verbose mode. If on, all ftp responses are displayed; when a file transfer completes, statistics regarding the efficiency of the transfer are also displayed. By default, verbose is on.

Syntax: verbose

************End of C+P part****************

As a quick reference, this is how to make a new directory on the FTP server and put files in it. And then how to delete them.

To make a directory

Code: Select all
ftp>mkdir Test
257 "Test" directory created.

To CD to the directory on YOUR computer to upload the file

Code: Select all
ftp>lcd My_Documents

To check you are in the right directory on YOUR computer. We use the ‘!’ to issue a command to our own PC:

Code: Select all
ftp>!dir

Change Directory on the FTP server to where we want to upload the files:

Code: Select all
ftp>cd Test

Upload the file, after we have ‘cd’ to the correct directory on both PC’s

Code: Select all
ftp> put test.txt
200 PORT command successful.
150 Opening ASCII mode data connection for test.txt.
226 Transfer complete.

To remove test.txt

Code: Select all
ftp>del test.txt

To remove the Test Directory

Code: Select all
ftp>rmdir Test

To download a file, after cd’ing to the correct remote directory

Code: Select all
ftp>get test.txt

To check what settings you are using with the status command:

Code: Select all
ftp> status
Connected to 86.27.52.153.
Type: ascii; Verbose: On ; Bell: Off ; Prompting: On ; Globbing: On
Debugging: Off ; Hash mark printing: Off .
ftp>

If you want to download or upload an exe file or similar you need to come out of ascii mode and into binary mode:

Code: Select all
ftp>binary

Ascii transfers data 7 bits at a time, binary transfers all eight.

Leave a Reply

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

Advertise

If you'd like to advertise on The Mutt ( aka TheTAZZone.com ) feel free to contact us at: administration[at]thetazzone.com

TheTAZZone is a non-commercial entity. We do not sell any products or services ourselves. Our revenue comes from advertising and donations only.

We appreciate your support! Your advertising revenue ( or donations ) helps us to continue to upgrade, improve, and offset the costs of maintaining this site.

Donations can be made through the page ' Donate '.