FTP(1)
π FTP(1) β the ARPANET file transfer program π
okay bestie, welcome to FTP(1) from the General Commands Manual. This is ftp, the ARPANET file transfer program, and she is iconic: she lets a user transfer files to and from a remote network site. periodt β¨
πΈ NAME πΈ
ftp β ARPANET file transfer program. That's the whole NAME section, she's concise π
π¦ SYNOPSIS π¦
ftp [-v] [-d] [-i] [-n] [-g] [-k realm] [-f] [-x] [-u] [-t] [host]
π DESCRIPTION π
okay so FTP is your user interface to the ARPANET standard File Transfer Protocol. The program allows a user to transfer files to and from a remote network site. That's the main character energy right there π«Ά
π OPTIONS π
Options may be specified at the command line, or to the command interpreter. both ways, bestie π
-vβ Verbose option forcesftpto show all responses from the remote server, as well as report on data transfer statistics. not me needing every single receipt π-nβ Restrainsftpfrom attempting βauto-loginβ upon initial connection. If auto-login is enabled,ftpwill check the.netrc(see below) file in the user's home directory for an entry describing an account on the remote machine. If no entry exists,ftpwill prompt for the remote machine login name (default is the user identity on the local machine), and, if necessary, prompt for a password and an account with which to login.-uβ Restrainsftpfrom attempting βauto-authenticationβ upon initial connection. If auto-authentication is enabled,ftpattempts to authenticate to the FTP server by sending theAUTHcommand, using whichever authentication types are locally supported. Once an authentication type is accepted, an authentication protocol will proceed by issuingADATcommands. This option also disables auto-login. double-duty icon β¨-iβ Turns off interactive prompting during multiple file transfers.-dβ Enables debugging.-gβ Disables file name globbing.-fβ Causes credentials to be forwarded to the remote host.-xβ Causes the client to attempt to negotiate encryption (data and command protection levelsprivate) immediately after successfully authenticating.-tβ Enables packet tracing.
tiny heads-up bestie: the synopsis lists -k realm, but this page's OPTIONS section doesn't give it a separate writeup. I'm not inventing lore π
π¦ COMMANDS π¦
The client host with which ftp is to communicate may be specified on the command line. If this is done, ftp will immediately attempt to establish a connection to an FTP server on that host; otherwise, ftp will enter its command interpreter and await instructions from the user. When ftp is awaiting commands from the user the prompt ftp> is provided to the user. The following commands are recognized by ftp:
! [command] [args]]β Invoke an interactive shell on the local machine. If there are arguments, the first is taken to be a command to execute directly, with the rest of the arguments as its arguments.$ macro-name [args]β Execute the macromacro-namethat was defined with themacdefcommand. Arguments are passed to the macro unglobbed.account [passwd]β Supply a supplemental password required by a remote system for access to resources once a login has been successfully completed. If no argument is included, the user will be prompted for an account password in a non-echoing input mode.append local-file [remote-file]β Append a local file to a file on the remote machine. Ifremote-fileis left unspecified, the local file name is used in naming the remote file after being altered by anyntransornmapsetting. File transfer uses the current settings for type, format, mode, and structure.asciiβ Set the file transfer type to network ASCII. This is the default type. default queen πbellβ Arrange that a bell be sounded after each file transfer command is completed.binaryβ Set the file transfer type to support binary file transfer.byeβ Terminate the FTP session with the remote server and exitftp. An end of file will also terminate the session and exit.caseβ Toggle remote computer file name case mapping duringmgetcommands. Whencaseis on (default is off), remote computer file names with all letters in upper case are written in the local directory with the letters mapped to lower case.cccβ Turn off integrity protection on the command channel. This command must be sent integrity protected, and a successfulADATcommand has to come before it. Since turning off integrity protection potentially allows an attacker to insert commands onto the command channel, some FTP servers may refuse to honor this command. danger-ish behavior, bestie, read that twice πcd remote-directoryβ Change the working directory on the remote machine toremote-directory.cdupβ Change the remote machine working directory to the parent of the current remote machine working directory.chmod mode file-nameβ Change the permission modes of the filefile-nameon the remote system tomode.clearβ Set the protection level on data transfers toclear. If noADATcommand succeeded, then this is the default protection level.closeβ Terminate the FTP session with the remote server, and return to the command interpreter. Any defined macros are erased.cprotect [protection-level]β Set the protection level on commands toprotection-level. The valid protection levels areclearfor unprotected commands,safefor commands integrity protected by cryptographic checksum, andprivatefor commands confidentiality and integrity protected by encryption. If anADATcommand succeeded, then the default command protection level issafe, otherwise the only possible level isclear. If no level is specified, the current level is printed.cprotect clearis equivalent to theccccommand. options within options, she's layered πcrβ Toggle carriage return stripping during ascii type file retrieval. Records are denoted by a carriage return/linefeed sequence during ascii type file transfer. Whencris on (the default), carriage returns are stripped from this sequence to conform with the UNIX single linefeed record delimiter. Records on non-UNIX remote systems may contain single linefeeds; when an ascii type transfer is made, these linefeeds may be distinguished from a record delimiter only whencris off.delete remote-fileβ Delete the fileremote-fileon the remote machine.debug [debug-value]β Toggle debugging mode. If an optionaldebug-valueis specified it is used to set the debugging level. When debugging is on,ftpprints each command sent to the remote machine, preceded by the string-->dir [remote-directory] [local-file]β Print a listing of the directory contents in the directory,remote-directory, and, optionally, placing the output inlocal-file. If interactive prompting is on,ftpwill prompt the user to verify that the last argument is indeed the target local file for receivingdiroutput. If no directory is specified, the current working directory on the remote machine is used. If no local file is specified, orlocal-fileis-, output comes to the terminal.disconnectβ A synonym forclose.form formatβ Set the file transfer form toformat. The default format isfile.get remote-file [local-file]β Retrieve the fileremote-fileand store it on the local machine. If the local file name is not specified, it is given the same name it has on the remote machine, subject to alteration by the currentcase,ntrans, andnmapsettings. The current settings for type, form, mode, and structure are used while transferring the file.globβ Toggle filename expansion formdelete,mget, andmput. If globbing is turned off withglob, the file name arguments are taken literally and not expanded. Globbing formputis done as incsh(1). Formdeleteandmget, each remote file name is expanded separately on the remote machine and the lists are not merged. Expansion of a directory name is likely to be different from expansion of the name of an ordinary file: the exact result depends on the foreign operating system and ftp server, and can be previewed by doingmls remote-files -Note:mgetandmputare not meant to transfer entire directory subtrees of files. That can be done by transferring atar(1)archive of the subtree (in binary mode). iykyk, globbing has lore πhashβ Toggle hash-sign (#) printing for each data block transferred. The size of a data block is 1024 bytes.help [command]β Print an informative message about the meaning ofcommand. If no argument is given,ftpprints a list of the known commands.idle [seconds]β Set the inactivity timer on the remote server tosecondsseconds. Ifsecondsis omitted, the current inactivity timer is printed.lcd [directory]β Change the working directory on the local machine. If no directory is specified, the user's home directory is used.ls [remote-directory] [local-file]β Print a listing of the contents of a directory on the remote machine. The listing includes any system-dependent information that the server chooses to include; for example, most UNIX systems will produce output from the commandls -l. (See alsonlist.) Ifremote-directoryis left unspecified, the current working directory is used. If interactive prompting is on,ftpwill prompt the user to verify that the last argument is indeed the target local file for receivinglsoutput. If no local file is specified, or iflocal-fileis-, the output is sent to the terminal.macdefmacro-nameβ Define a macro. Subsequent lines are stored as the macromacro-name; a null line (consecutive newline characters in a file or carriage returns from the terminal) terminates macro input mode. There is a limit of 16 macros and 4096 total characters in all defined macros. Macros remain defined until aclosecommand is executed. The macro processor interprets$and\as special characters. A$followed by a number (or numbers) is replaced by the corresponding argument on the macro invocation command line. A$followed by anisignals that the macro processor that the executing macro is to be looped. On the first pass$iis replaced by the first argument on the macro invocation command line, on the second pass it is replaced by the second argument, and so on. A\followed by any character is replaced by that character. Use the\to prevent special treatment of the$. the way this one runsmacdefmacro-nametogether is a whole mood πmdelete [remote-files]β Deleteremote-fileson the remote machine.mdir remote-files local-fileβ Same energy asdir, except you can name multiple remote files. If interactive prompting is on,ftpwill prompt you to verify that the last argument really is the target local file for receivingmdiroutput. πmget remote-filesβ Expandsremote-fileson the remote machine and does agetfor each file name that pops out. Seeglobfor details on the filename expansion. The resulting file names then get processed according tocase,ntrans, andnmapsettings. Files are transferred into the local working directory, which you can change withlcd directory; new local directories can be created with! mkdir directory. β¨mkdir directory-nameβ Makes a directory on the remote machine. Remote girlboss behavior. πmls remote-files local-fileβ Likenlist, except multiple remote files may be specified, and thelocal-filemust be specified. If interactive prompting is on,ftpwill prompt you to verify that the last argument is indeed the target local file for receivingmlsoutput. π«Άmode [mode-name]β Sets the file transfer mode to mode-name. The default mode isstreammode. Streaming, iconic, default. πmodtime file-nameβ Shows the last modification time of the file on the remote machine. π°οΈmput local-filesβ Expands wild cards in the list of local files given as arguments and does aputfor each file in the resulting list. Seeglobfor details of filename expansion. The resulting file names then get processed according tontransandnmapsettings. π₯newer file-nameβ Gets the file only if the modification time of the remote file is more recent than the file on the current system. If the file does not exist on the current system, the remote file is considered newer. Otherwise, this command is identical toget. Newer-file vibe check passed? Then we fetch. βnlist [remote-directory] [local-file]β Prints a list of the files in a directory on the remote machine. If remote-directory is left unspecified, the current working directory is used. If interactive prompting is on,ftpwill prompt you to verify that the last argument is indeed the target local file for receivingnlistoutput. If no local file is specified, or if local-file is-, the output is sent to the terminal. πnmap [inpattern outpattern]β Sets or unsets the filename mapping mechanism. No arguments means the filename mapping mechanism is unset. If arguments are specified, remote filenames are mapped duringmputcommands andputcommands issued without a specified remote target filename. If arguments are specified, local filenames are mapped duringmgetcommands andgetcommands issued without a specified local target filename. This command is useful when connecting to a non-UNIX remote computer with different file naming conventions or practices. The mapping follows the pattern set byinpatternandoutpattern.inpatternis a template for incoming filenames (which may have already been processed according to thentransandcasesettings). Variable templating is accomplished by including the sequences$1,$2, ...,$9ininpattern. Use\to prevent this special treatment of the$character. All other characters are treated literally, and are used to determine thenmapinpatternvariable values. For example, giveninpattern $1.$2and the remote file name"mydata.data",$1would have the value"mydata", and$2would have the value"data". Theoutpatterndetermines the resulting mapped filename. The sequences$1,$2, ...,$9are replaced by any value resulting from theinpatterntemplate. The sequence$0is replaced by the original filename. Additionally, the sequence[seq1, seq2]is replaced by[seq1]ifseq1is not a null string; otherwise it is replaced byseq2. For example, the commandnmap $1.$2.$3 [$1,$2].[$2,file]would yield the output filename"myfile.data"for input filenames"myfile.data"and"myfile.data.old","myfile.file"for the input filename"myfile", and"myfile.myfile"for the input filename".myfile". Spaces may be included inoutpattern, as in the example:nmap $1 sed "s/ *$//" > $1. Use the\character to prevent special treatment of the$,[,], and,characters. This one is giving filename-glow-up wizardry, fr fr. π§ntrans [inchars [outchars]]β Sets or unsets the filename character translation mechanism. No arguments means the filename character translation mechanism is unset. If arguments are specified, characters in remote filenames are translated duringmputcommands andputcommands issued without a specified remote target filename. If arguments are specified, characters in local filenames are translated duringmgetcommands andgetcommands issued without a specified local target filename. This command is useful when connecting to a non-UNIX remote computer with different file naming conventions or practices. Characters in a filename matching a character inincharsare replaced with the corresponding character inoutchars. If the characterβs position inincharsis longer than the length ofoutchars, the character is deleted from the file name. Character makeover era. πopen host [port] [-forward]β Establishes a connection to the specified host FTP server. An optional port number may be supplied, in which case,ftpwill attempt to contact an FTP server at that port. If theauto-authenticateoption is on (default),ftpwill attempt to authenticate to the FTP server by sending theAUTHcommand, using whichever authentication types which are locally supported. Once an authentication type is accepted, an authentication protocol will proceed by issuingADATcommands. If theauto-loginoption is on (default),ftpwill also attempt to automatically log the user in to the FTP server (see below). If the-forwardoption is specified,ftpwill forward a copy of the userβs Kerberos tickets to the remote host. πpassiveβ Toggles passive data transfer mode. In passive mode, the client initiates the data connection by listening on the data port. Passive mode may be necessary for operation from behind firewalls which do not permit incoming connections. Firewall-friendly queen. π‘οΈprivateβ Sets the protection level on data transfers toprivate. Data transmissions are confidentiality and integrity protected by encryption. If noADATcommand succeeded, then the only possible level isclear. πpromptβ Toggles interactive prompting. Interactive prompting occurs during multiple file transfers to allow the user to selectively retrieve or store files. If prompting is turned off (default is on), anymgetormputwill transfer all files, and anymdeletewill delete all files. Prompting: the βbestie, are you sure?β of file transfers. πprotect [protection-level]β Sets the protection level on data transfers to protection-level. The valid protection levels areclearfor unprotected data transmissions,safefor data transmissions integrity protected by cryptographic checksum, andprivatefor data transmissions confidentiality and integrity protected by encryption. If noADATcommand succeeded, then the only possible level isclear. If no level is specified, the current level is printed. The default protection level isclear. π΅οΈββοΈproxy ftp-commandβ Executes anftpcommand on a secondary control connection. This command allows simultaneous connection to two remoteftpservers for transferring files between the two servers. The firstproxycommand should be anopen, to establish the secondary control connection. Enter the commandproxy ?to see otherftpcommands executable on the secondary connection. The following commands behave differently when prefaced byproxy:openwill not define new macros during theauto-loginprocess,closewill not erase existing macro definitions,getandmgettransfer files from the host on the primary control connection to the host on the secondary control connection, andput,mput, andappendtransfer files from the host on the secondary control connection to the host on the primary control connection. Third party file transfers depend upon support of theftpprotocolPASVcommand by the server on the secondary control connection. Two servers, one main-character proxy moment. πput local-file [remote-file]β Stores a local file on the remote machine. If remote-file is left unspecified, the local file name is used after processing according to anyntransornmapsettings in naming the remote file. File transfer uses the current settings fortype,format,mode, andstructure. π€pwdβ Prints the name of the current working directory on the remote machine. Location check, remote edition. πquitβ A synonym forbye. πquote arg1 [arg2] [...]β The arguments specified are sent, verbatim, to the remote FTP server. No edits, no filter, just raw quote energy. π¬recv remote-file [local-file]β A synonym forget. π₯reget remote-file [local-file]βregetacts likeget, except that if local-file exists and is smaller than remote-file, local-file is presumed to be a partially transferred copy of remote-file and the transfer is continued from the apparent point of failure. This command is useful when transferring very large files over networks that are prone to dropping connections. Dropped connection? Pick up where you left off, bestie. πremotehelp [command-name]β Requests help from the remote FTP server. If a command-name is specified, it is supplied to the server as well. πremotestatus [file-name]β With no arguments, shows status of the remote machine. If file-name is specified, shows status of file-name on the remote machine. πrename [from] [to]β Renames the file from on the remote machine, to the file to. Remote rebrand. β¨resetβ Clears reply queue. This command re-synchronizes command/reply sequencing with the remoteftpserver. Resynchronization may be necessary following a violation of theftpprotocol by the remote server. π§Ήrestart markerβ Restarts the immediately followinggetorputat the indicated marker. On UNIX systems, marker is usually a byte offset into the file. Rewind, but make it precise. β±οΈrmdirdirectory-name β yeets a directory off the remote machine. gone. poof. π¨runiqueβ toggles whether local files get saved with unique names. so if a file already exists with a name equal to the target local filename for agetormgetcommand, a.1gets appended to the name. and if that resulting name matches another existing file, a.2gets appended to the original name. and if this whole process keeps going all the way up to.99, an error message is printed and the transfer does not take place (the audacity π). the generated unique filename will be reported to you. quick heads up though:runiquewill not affect local files generated from a shell command (see below). default value is off.safeβ sets the protection level on data transfers to "safe". data transmissions are integrity-protected by cryptographic checksum. if noADATcommand succeeded, then the only possible level is "clear". πsendlocal-file [remote-file] β literally just a synonym forput. same energy, different name. πsendportβ toggles the use ofPORTcommands. by default,ftpwill attempt to use aPORTcommand when establishing a connection for each data transfer. usingPORTcommands can prevent delays when you're doing multiple file transfers. if thePORTcommand fails,ftpwill use the default data port. when the use ofPORTcommands is disabled, no attempt will be made to usePORTcommands for each data transfer β which is useful for certain FTP implementations that do ignorePORTcommands but, incorrectly, indicate they've been accepted. πsitearg1 [arg2] [...] β the arguments you specify are sent, verbatim, to the remote FTP server as aSITEcommand.sizefile-name β returns the size of file-name on the remote machine.statusβ shows the current status offtp. vibe check on your session β¨structstruct-name β sets the file transfer structure to struct-name. by default "stream" structure is used.suniqueβ toggles storing of files on the remote machine under unique file names. the remote ftp server must support the ftp protocolSTOUcommand for this to complete successfully. the remote server will report the unique name. default value is off.systemβ shows the type of operating system running on the remote machine.tenexβ sets the file transfer type to the one you need to talk to TENEX machines.traceβ toggles packet tracing.type[type-name] β sets the file transfer type to type-name. if no type is specified, the current type is printed. the default type is network ASCII.umask[newmask] β sets the default umask on the remote server to newmask. if newmask is omitted, the current umask is printed.useruser-name [password] [account] β identify yourself to the remote FTP server. if the password is not specified and the server requires it,ftpwill prompt the user for it (after disabling local echo π). if an account field is not specified, and the FTP server requires it, the user will be prompted for it. if an account field is specified, an account command will be relayed to the remote server after the login sequence is completed, if the remote server did not require it for logging in. unlessftpis invoked with "auto-login" disabled, this whole process is done automatically on initial connection to the FTP server.verboseβ toggles verbose mode. in verbose mode, all responses from the FTP server are displayed to the user. plus, if verbose is on, when a file transfer completes, statistics regarding the efficiency of the transfer are reported. by default, verbose is on.?[command] β a synonym forhelp.
Command arguments which have embedded spaces may be quoted with quote " marks. π«Ά
π₯ ABORTING A FILE TRANSFER π₯
To abort a file transfer, use the terminal interrupt key (usually Ctrl+C).
Sending transfers will be immediately halted. Receiving transfers will be halted by sending a FTP protocol ABOR command to the remote server, and discarding any further data received. The speed at which this is accomplished depends upon the remote server's support for ABOR processing. If the remote server does not support the ABOR command, an ftp> prompt will not appear until the remote server has completed sending the requested file. π€
The terminal interrupt key sequence will be ignored when ftp has completed any local processing and is awaiting a reply from the remote server. A long delay in this mode may result from the ABOR processing described above, or from unexpected behavior by the remote server, including violations of the ftp protocol. If the delay results from unexpected remote server behavior, the local ftp program must be killed by hand. π
ποΈ FILE NAMING CONVENTIONS ποΈ
Files specified as arguments to ftp commands are processed according to the following rules.
- If the file name
-is specified,stdin(for reading) orstdout(for writing) is used. - If the first character of the file name is
|, the remainder of the argument is interpreted as a shell command. Ftp then forks a shell, usingpopen(3)with the argument supplied, and reads from (writes to)stdout(stdin). If the shell command includes spaces, the argument must be quoted; e.g." ls -lt". A particularly useful example of this mechanism is:dir more. - Failing the above checks, if "globbing" is enabled, local file names are expanded according to the rules used in
csh(1); c.f. theglobcommand. If theftpcommand expects a single local file (e.g.put), only the first filename generated by the "globbing" operation is used. - For
mgetcommands andgetcommands with unspecified local file names, the local filename is the remote filename, which may be altered by acase,ntrans, ornmapsetting. The resulting filename may then be altered ifruniqueis on. - For
mputcommands andputcommands with unspecified remote file names, the remote filename is the local filename, which may be altered by antransornmapsetting. The resulting filename may then be altered by the remote server ifsuniqueis on.
βοΈ FILE TRANSFER PARAMETERS βοΈ
The FTP specification specifies many parameters which may affect a file transfer. The type may be one of "ascii", "image" (binary), "ebcdic", and "local byte size" (mostly for PDP-10's and PDP-20's). Ftp supports the ascii and image types of file transfer, plus local byte size 8 for tenex mode transfers. π§
Ftp supports only the default values for the remaining file transfer parameters: mode, form, and struct. that's it, that's the whole menu, no substitutions bestie π
π THE .netrc FILE π
The .netrc file contains login and initialization information used by the auto-login process. It resides in the user's home directory. The following tokens are recognized; they may be separated by spaces, tabs, or new-lines:
machinename β identify a remote machine name. The auto-login process searches the.netrcfile for amachinetoken that matches the remote machine specified on theftpcommand line or as anopencommand argument. Once a match is made, the subsequent.netrctokens are processed, stopping when the end of file is reached or anothermachineor adefaulttoken is encountered.defaultβ this is the same asmachinename except thatdefaultmatches any name. There can be only onedefaulttoken, and it must be after allmachinetokens. This is normally used as:
default login anonymous password user@site
thereby giving the user automatic anonymous ftp login to machines not specified in .netrc. This can be overridden by using the -n flag to disable auto-login.
loginname β identify a user on the remote machine. If this token is present, the auto-login process will initiate a login using the specified name.passwordstring β supply a password. If this token is present, the auto-login process will supply the specified string if the remote server requires a password as part of the login process. Note that if this token is present in the.netrcfile for any user other thananonymous,ftpwill abort the auto-login process if the.netrcis readable by anyone besides the user. π¨ (yes, permissions actually matter here, do not play)accountstring β supply an additional account password. If this token is present, the auto-login process will supply the specified string if the remote server requires an additional account password, or the auto-login process will initiate anACCTcommand if it does not.macdefname β define a macro. This token functions like theftpmacdefcommand functions. A macro is defined with the specified name; its contents begin with the next.netrcline and continue until a null line (consecutive new-line characters) is encountered. If a macro namedinitis defined, it is automatically executed as the last step in the auto-login process. β¨ main character macro β¨
πΈ ENVIRONMENT πΈ
Ftp utilizes the following environment variables.
HOMEβ for default location of a.netrcfile, if one exists.SHELLβ for default shell.
π¦ SEE ALSO π¦
Lunt, S. J., FTP Security Extensions, Internet Draft, November 1993.
π HISTORY π
The ftp command appeared in 4.2BSD. a true icon, no cap π
π BUGS π
Correct execution of many commands depends upon proper behavior by the remote server.
An error in the treatment of carriage returns in the 4.2BSD ascii-mode transfer code has been corrected. This correction may result in incorrect transfers of binary files to and from 4.2BSD servers using the ascii type. Avoid this problem by using the binary image type. π
and that's the whole page bestie, we did it π so much love to the FTP(1) girlies β this is the FTP(1) page, mwah, catch you in the group chat ππ«Άβ¨
π¦ where this page comes from
- opensuse-leap 16.0: krb5-appl-clients 1.0.3-bp160.2.1 Β· MIT
- opensuse-leap 16.0: krb5-appl-clients 1.0.3-bp160.2.1 Β· MIT
- opensuse-leap 16.0: krb5-appl-clients 1.0.3-bp160.2.1 Β· MIT
- opensuse-leap 16.0: krb5-appl-clients 1.0.3-bp160.2.1 Β· MIT
- Copyright (c) 1985, 1989, 1990 The Regents of the University of California
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms