728x90 AdSpace

Tuesday, 5 September 2017

ftp Linux Command


ftp [options] [hostname]
Transfer files to and from remote network site hostname. ftp prompts the user for a command. The commands are listed after the options. Some of the commands are toggles, meaning they turn on a feature when it is off and vice versa. Note that versions may have different options.


Enable debugging.

Disable filename globbing.

Turn off interactive prompting.

No autologin upon initial connection.

Verbose. Show all responses from remote server.


![command [args] ]
Invoke an interactive shell on the local machine. If arguments are given, the first is taken as a command to execute directly, with the rest of the arguments as that command's arguments.

$macro-name [args]
Execute the macro macro-name that was defined with the macdef command. Arguments are passed to the macro unglobbed.

account [passwd]
Supply a supplemental password that will be required by a remote system for access to resources once a login has been successfully completed. If no argument is given, the user will be prompted for an account password in a non-echoing mode.

append local-file [remote-file]
Append a local file to a file on the remote machine. If remote-file is not given, the local filename is used after being altered by any ntrans or nmap setting. File transfer uses the current settings for type, format, mode, and structure.

Set the file transfer type to network ASCII (default).

Sound a bell after each file transfer command is completed.

Set file transfer type to support binary image transfer.

Terminate FTP session and then exit ftp.

Toggle remote-computer filename case mapping during mget. The default is off. When case is on, files on the remote machine with all-uppercase names will be copied to the local machine with all-lowercase names.

cd remote-directory
Change working directory on remote machine to remote-directory.

Change working directory of remote machine to its parent directory.

chmod [mode] [remote-file]
Change file permissions of remote-file. If options are omitted, the command prompts for them.

Terminate FTP session and return to command interpreter.

Toggle carriage-return stripping during ASCII-type file retrieval.

delete remote-file
Delete file remote-file on remote machine.

debug [debug-value]
Toggle debugging mode. If debug-value is specified, it is used to set the debugging level.

dir [remote-directory] [local-file]
Print a listing of the contents in the directory remote-directory and, optionally, place the output in local-file. If no directory is specified, the current working directory on the remote machine is used. If no local file is specified or - is given instead of the filename, output comes to the terminal.

Synonym for close.

form format
Set the file transfer form to format. Default format is file.

get remote-file [local-file]
Retrieve the remote-file and store it on the local machine. If the local filename is not specified, it is given the same name it has on the remote machine, subject to alteration by the current case, ntrans, and nmap settings. If local file is -, output comes to the terminal.

Toggle filename expansion for mdelete, mget, and mput. If globbing is turned off, the filename arguments are taken literally and not expanded.

Toggle hash sign (#) printing for each data block transferred.

help [command]
Print help information for command. With no argument, ftp prints a list of commands.

idle [seconds]
Get/set idle timer on remote machine. seconds specifies the length of the idle timer; if omitted, the current idle timer is displayed.

Same as binary.

lcd [directory]
Change working directory on local machine. If directory is not specified, the user's home directory is used.

ls [remote-directory] [local-file]
Print listing of contents of directory on remote machine, in a format chosen by the remote machine. If remote-directory is not specified, current working directory is used.

macdef macro-name
Define a macro. Subsequent lines are stored as the macro macro-name; a null line terminates macro input mode. When $i is included in the macro, loop through arguments, substituting the current argument for $i on each pass. Escape $ with \.

mdelete remote-files
Delete the remote-files on the remote machine.

mdir remote-files local-file
Like dir, except multiple remote files may be specified.

mget remote-files
Expand the wildcard expression remote-files on the remote machine and do a get for each filename thus produced.

mkdir directory-name
Make a directory on the remote machine.

mls remote-files local-file
Like nlist, except multiple remote files may be specified, and the local file must be specified.

mode [mode-name]
Set file transfer mode to mode-name. Default mode is stream mode.

modtime [file-name]
Show last modification time of the file on the remote machine.

mput [local-files]
Expand wildcards in local-files given as arguments and do a put for each file in the resulting list.

newer remote-file [local-file]
Get file if remote file is newer than local file.

nlist [remote-directory] [local-file]
Print list of files in a directory on the remote machine to local-file (or to the screen if local-file is not specified). If remote-directory is unspecified, the current working directory is used.

nmap [inpattern outpattern]
Set or unset the filename mapping mechanism. The mapping follows the pattern set by inpattern, a template for incoming filenames, and outpattern, which determines the resulting mapped filename. The sequences $1 through $9 are treated as variables; for example, the inpattern $1.$2, along with the input file readme.txt, would set $1 to readme and $2 to txt. An outpattern of $1.data would result in an output file of readme.data. $0 corresponds to the complete filename. [string1, string2] is replaced by string1 unless that string is null, in which case it's replaced by string2.

ntrans [inchars [outchars ] ]
Set or unset the filename character translation mechanism. Characters in a filename matching a character in inchars are replaced with the corresponding character in outchars. If no arguments are specified, the filename mapping mechanism is unset. If arguments are specified:

Characters in remote filenames are translated during mput and put commands issued without a specified remote target filename.

Characters in local filenames are translated during mget and get commands issued without a specified local target filename.

open host [port]
Establish a connection to the specified host FTP server. An optional port number may be supplied, in which case ftp will attempt to contact an FTP server at that port.

Toggle interactive prompting.

proxy ftp-command
Execute an FTP command on a secondary control connection (i.e., send commands to two separate remote hosts simultaneously).

put local-file [remote-file]
Store a local file on the remote machine. If remote-file is left unspecified, the local filename is used after processing according to any ntrans or nmap settings in naming the remote file. File transfer uses the current settings for type, file, structure, and transfer mode.

Print name of the current working directory on the remote machine.

Synonym for bye.

quote arg1 arg2...
Send the arguments specified, verbatim, to the remote FTP server.

recv remote-file [local-file]
Synonym for get.

reget remote-file [local-file]
Retrieve a file (like get), but restart at the end of local-file. Useful for restarting a dropped transfer.

remotehelp [command-name]
Request help from the remote FTP server. If command-name is specified, remote help for that command is returned.

remotestatus [filename]
Show status of the remote machine or, if filename is specified, of filename on remote machine.

rename [from] [to]
Rename file from on remote machine to to.

Clear reply queue.

restart marker
Restart the transfer of a file from a particular byte count.

rmdir [directory-name]
Delete a directory on the remote machine.

Toggle storing of files on the local system with unique filenames. When this option is on, rename files as .1 or .2, and so on, as appropriate, to preserve unique filenames, and report each such action. Default value is off.

send local-file [remote-file]
Synonym for put.

Toggle the use of PORT commands.

site [command]
Get/set site-specific information from/on remote machine.

size filename
Return size of filename on remote machine.

Show current status of ftp.

struct [struct-name]
Set the file transfer structure to struct-name. By default, stream structure is used.

Toggle storing of files on remote machine under unique filenames.

Show type of operating system running on remote machine.

Set file transfer type to that needed to talk to TENEX machines.

Toggle packet tracing.

type [type-name]
Set file transfer type to type-name. If no type is specified, the current type is printed. The default type is network ASCII.

umask [mask]
Set user file-creation mode mask on the remote site. If mask is omitted, the current value of the mask is printed.

user username [password] [account]
Identify yourself to the remote FTP server. ftp will prompt the user for the password (if not specified and the server requires it) and the account field.

Toggle verbose mode.

? [command]
Same as help.
Annamalai Thangaraj

Annamalai is working as Technical Lead in Leading Telecom company with 5+ years experience in Identity and Access Management , Telecom and Networks, BigData, Java, Spring, Struts, Hibernate, AngularJS, and Enterprise Web Application Development.

Website: Java Tutorials Corner

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments


Post a Comment

Item Reviewed: ftp Linux Command Rating: 5 Reviewed By: Annamalai Thangaraj