FTP(1)
π FTP(1) π
okay bestie, welcome to the FTP(1) page from the General Commands Manual β yes the whole thing, we're doing this properly, no skimming, no gatekeeping π«Ά
β¨ NAME β¨
ftp β Internet file transfer program ππ
πΈ SYNOPSIS πΈ
ftp [-46pinegvd] [-z debug] [-z nossl] [-z secure] [-z verbose]
[-z verify=flags] [-z cacert=ca_file] [-z cert=cert_file]
[-z key=key_file] [-z cipher=list] [host [port]]
pftp [-46inegvd] [-z debug] [-z nossl] [-z secure] [-z verbose]
[-z verify=flags] [-z cacert=ca_file] [-z cert=cert_file]
[-z key=key_file] [-z cipher=list] [host [port]]
π¦ DESCRIPTION π¦
Ftp is literally the user interface to the Internet standard File Transfer Protocol. She lets you move files to and from a remote network site, that's the whole job, and she's iconic for it π
You can drop options at the command line, or hand them to the command interpreter, whichever vibe you're on β¨
-4β only use IPv4 to contact any host. 4eva. π-6β IPv6 only. no IPv4 in this house π«4οΈβ£-pβ use passive mode for data transfers. This is the move when a firewall is blocking connections from the outside world back to your machine. Heads up tho: it requires that the ftp server support thePASVcommand. Fun fact: this is the default if you invoke the program aspftpπ«Ά-iβ turns off interactive prompting during multiple file transfers. silence, bestie π€«-nβ restrains ftp from attempting "auto-login" on that first connection. When auto-login is enabled, ftp peeks at the.netrcfile (seenetrc(5)) in your home directory looking for an entry describing an account on the remote machine. No entry? Then ftp prompts you for the remote machine login name (default is your user identity on the local machine), and if it's needed, it'll prompt for a password and an account to login with. π-eβ disables command editing and history support, if it was compiled into the ftp executable. Otherwise? does nothing. literally nothing. girl is unemployed π-gβ disables file name globbing π«β¨-vβ the verbose option forces ftp to show all responses from the remote server, plus report on data transfer statistics. nosy in the best way π-dβ enables debugging π-zoption β set SSL (Secure Socket Layer) parameters. The default is to negotiate via ftp protocol if SSL is available on the server side and then switch it on. In this mode you can connect to both conventional and SSL enhanced ftpd's, so you're covered either way π
The SSL parameters are:
debugβ send SSL related debugging information tostderr.sslβ negotiate SSL at first, then use FTP protocol. Only the FTP protocol negotiation goes encrypted. (Not yet implemented) π§nossl,!sslβ switch off SSL negotiation πsecureβ don't switch back to unencrypted mode (no SSL) if SSL is not available. no downgrades allowed πverboseβ be verbose about certificates etc. πverify=int β set the SSL verify flags. The only sensible value for a client like ftp is1. (See the macrosSSL_VERIFY_*inopenssl/ssl.h).cacert=ca_file β accept the CA-certificates found in ca_file as verification of the remote server.cert=cert_file β use the certificate(s) in cert_file. This file may also carry a key.key=key_file β read the key(s) from key_file whenever the certificate file does not suffice.cipher=ciph_list β set the preferred ciphers to ciph_list. The environment variableSSL_CIPHERserves the same purpose. (Seeopenssl/ssl.hfor suggestions).
The client host and an optional port number with which ftp is to communicate may be specified on the command line. If you do that, ftp will immediately attempt to establish a connection to an FTP server on that host π. Otherwise, ftp enters its command interpreter and awaits instructions from you. When ftp is awaiting commands from you, the prompt ftp> is provided to you π¬
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 macro macro-name that 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, you'll be prompted for an account password in a non-echoing input mode π€appendlocal-file[remote-file]β append a local file to a file on the remote machine. If remote-file is 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 πbellβ arrange that a bell be sounded after each file transfer command is completed πbinaryβ set the file transfer type to support binary image transfer π§¬byeβ terminate the FTP session with the remote server and exit ftp. 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. π β‘οΈπ‘cdremote-directory β change the working directory on the remote machine to remote-directory.cdupβ change the remote machine working directory to the parent of the current remote machine working directory. β¬οΈchmodmode file-name β change the permission modes of the file file-name on the remote system to mode.closeβ terminate the FTP session with the remote server, and return to the command interpreter. Any defined macros are erased π§Ό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. π€οΈqcβ toggle the printing of control characters in the output of ASCII type commands. When this is turned on, control characters are replaced with a question mark if the output file is the standard output. This is the default when the standard output is a tty. βdeleteremote-file β delete the file remote-file on the remote machine. ποΈdebug [debug-value]β toggle debugging mode. If an optional debug-value is specified it is used to set the debugging level. When debugging is on, ftp prints 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 in local-file. If interactive prompting is on, ftp will prompt you 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, or local-file is-, output comes to the terminal. πdisconnectβ a synonym forclose.formformat β set the file transfer form to format. The default format is"file".getremote-file[local-file]β retrieve the remote-file and 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,mgetandmput. 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). π¦
hash [increment]β toggle hash-sign (#) printing for each transferred data block, but only in the absence of an argument. The size of a data block is set to 1024 bytes by default, but can be changed by the argument increment, which also accepts the suffixed multipliers'k'and'K'for kilobytes,'m'and'M'for Megabytes, and finally'g'and'G'for Gigabytes. Setting a size activates hash printing unconditionally. #οΈβ£help [command]β print an informative message about the meaning of command. If no argument is given, ftp prints a list of the known commands. πidle [seconds]β set the inactivity timer on the remote server to seconds seconds. If seconds is omitted, the current inactivity timer is printed. β³ipanyβ allow the address resolver to return any address family.ipv4β restrict the address resolver to look only for IPv4 addresses.ipv6β restrict host adressing to IPv6 only.
still going bestie, don't go anywhere β more of this page is coming π
lcd[directory] β switch up your working directory on the local machine, like your laptop's own little home base π». Don't pass a directory? It just yeets you to the user's home directory. Simple as that.ls[remote-directory] [local-file] β prints a listing of what's inside a directory on the remote machine ποΈ. Heads up bestie, that listing includes whatever system-dependent info the server feels like including β most Unix systems will just hand you the output ofls -l(see alsonlist, okurr). Leave remote-directory out and it uses the current working directory. If interactive prompting is on, ftp will make you confirm that the last argument really is the target local file for receiving thelsoutput β yes ma'am, double-checking. And if no local file is specified, or local-file is-, the output goes straight to your terminal.macdefmacro-name β defines a macro, and everything you type after it gets stored as the macro macro-name β¨. A null line (that's consecutive newline characters in a file, or carriage returns from the terminal) ends macro input mode β so hit enter twice and you're out. There's a cap: 16 macros max, and 4096 total characters across all of them. Macros stay defined until aclosecommand runs. The macro processor treats$and\as special characters. A$followed by a number (or numbers) gets swapped for the corresponding argument on the macro invocation command line. A$followed by anitells the macro processor that the executing macro should be looped β first pass$ibecomes the first argument on the macro invocation command line, second pass it becomes the second argument, and so on forever. A\followed by any character is replaced by that character. Use\to stop$from getting its special treatment π .mdelete[remote-files] β deletes the remote-files on the remote machine. Gone. Poof. π«₯mdirremote-files local-file β literallydir, except you can specify multiple remote files at once π. If interactive prompting is on, ftp prompts you to verify that the last argument is indeed the target local file for receivingmdiroutput.mgetremote-files β expands the remote-files on the remote machine and does agetfor every file name it produces πΈ. Peepglobfor the details on filename expansion. The resulting file names then get processed according to yourcase,ntrans, andnmapsettings. Files land in the local working directory β change that withlcd directory, and make brand-new local directories with! mkdir directoryποΈ.mkdirdirectory-name β makes a directory on the remote machine, iconic behavior β¨.mlsremote-files local-file β likenlist, except multiple remote files may be specified, and local-file is mandatory this time, no skipping it. If interactive prompting is on, ftp will 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 is "stream" mode π.modtimefile-name β shows you the last modification time of the file on the remote machine π°οΈ. Nosy but make it useful.mputlocal-files β expands wild cards in the list of local files you passed as arguments, then does aputfor each file in the resulting list π. Seeglobfor the deets on filename expansion. Resulting file names then get processed according to yourntransandnmapsettings.newerfile-name [local-file] β only grabs the file if the modification time of the remote file is more recent than the file on the current system β±οΈ. If the file doesn't exist on the current system at all, the remote file counts as newer. Other than that, it's identical toget.nlist[remote-directory] [local-file] β prints a list of the files in a directory on the remote machine π. Leave remote-directory unspecified and it uses the current working directory. If interactive prompting is on, ftp prompts you to verify that the last argument is indeed the target local file for receivingnlistoutput. No local file specified, or local-file is-? Output goes to the terminal, easy.nmap[inpattern outpattern] β sets or unsets the filename mapping mechanism π¦. No arguments = unset it. With arguments, remote filenames get mapped duringmputcommands andputcommands issued without a specified remote target filename; local filenames get mapped duringmgetcommands andgetcommands issued without a specified local target filename. This one's your bestie when you're connecting to a non-Unix remote computer with different file naming conventions or practices. The mapping follows the pattern set by inpattern and outpattern. inpattern is a template for incoming filenames (which may have already been processed according to thentransandcasesettings). Variable templating happens by including the sequences$1,$2, ...,$9in inpattern β and use\to prevent that special treatment of$. Every other character is treated literally, and gets used to determine thenmapinpattern variable values. For example, given inpattern$1.$2and the remote file name"mydata.data",$1would have the value"mydata", and$2would have the value"data". The outpattern determines the resulting mapped filename. The sequences$1,$2, ....,$9are replaced by any value resulting from the inpattern template, and the sequence$0is replaced by the original filename. On top of that, the sequence[seq1, seq2]is replaced by seq1 if seq1 is not a null string; otherwise it's replaced by seq2. For example, this command
nmap $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 in outpattern, as in this example: nmap $1 sed "s/ *$//" > $1. Use the \ character to prevent special treatment of the $, [, [, and , characters.
ntrans[inchars [outchars]] β sets or unsets the filename character translation mechanism π . No arguments and it's unset. With arguments, characters in remote filenames get translated duringmputcommands andputcommands issued without a specified remote target filename; characters in local filenames get translated duringmgetcommands andgetcommands issued without a specified local target filename. Again, chef's kiss for connecting to a non-Unix remote computer with different file naming conventions or practices π. Characters in a filename that match a character in inchars get replaced with the corresponding character in outchars. And if the character's position in inchars is longer than the length of outchars, that character gets deleted from the file name entirely.openhost [port] β establishes a connection to the specified host FTP server π. You can optionally hand it a port number, in which case ftp tries to contact an FTP server at that port. If theauto-loginoption is on (and it is by default), ftp will also try to automatically log you in to the FTP server (see below) π.promptβ toggles interactive prompting π. Interactive prompting happens during multiple file transfers so you can selectively retrieve or store files. Turn prompting off (the default is on) and anymgetormputwill transfer every file, and anymdeletewill delete every file. No take-backs, so be careful bestie.proxyftp-command β executes an ftp command on a secondary control connection π―. This lets you connect to two remote ftp servers at the same time and transfer files between them. The firstproxycommand should be anopen, to establish the secondary control connection. Type"proxy ?"to see the other ftp commands you can run on the secondary connection. These commands behave differently when prefaced byproxy:openwill not define new macros during the auto-login process,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 the ftp protocolPASVcommand by the server on the secondary control connection.putlocal-file [remote-file] β stores a local file on the remote machine π€. Leave remote-file unspecified and the local file name gets used β after being processed according to anyntransornmapsettings β to name the remote file. The transfer uses your current settings fortype,format,mode, andstructure.pwdβ prints the name of the current working directory on the remote machine π. Where even am I.quitβ a synonym forbyeπ.quotearg1 arg2 ... β the arguments you specify get sent, verbatim, to the remote FTP server π£οΈ. No edits, no vibes, just exactly what you typed.recvremote-file [local-file] β a synonym forgetπ.regetremote-file [local-file] β it'sget's braver cousin π«Ά. If local-file already exists and it's smaller than remote-file, ftp assumes it's a half-finished copy and picks up from the apparent point of failure instead of starting over. If local-file doesn't exist at all, ftp straight-up won't fetch the file, no cap. Basically made for hauling giant files over networks that keep ghosting you and dropping the connection π.remotehelp[command-name] β ask the remote FTP server for help. Pass a command-name and it gets handed to the server too.remotestatus[file-name] β no arguments? It shows the status of the remote machine. Give it a file-name and it shows the status of that file-name on the remote machine.rename[from] [to] β rename the file from on the remote machine to the file to. glow up πresetβ clears the reply queue. This one re-synchronizes the command/reply sequencing with the remote ftp server. You might need this resync after the remote server violates the ftp protocol, which is giving chaos π©.restartmarker β restarts the immediately followinggetorputat the indicated marker. On Unix systems, marker is usually a byte offset into the file.rmdirdirectory-name β delete a directory on the remote machine. bye bestie πruniqueβ toggles storing files on the local system with unique filenames. If a file already exists with a name equal to the target local filename for agetormgetcommand, a".1"gets appended to the name. If that resulting name matches another existing file, a".2"is appended to the original name. If this keeps going all the way up to".99", an error message is printed and the transfer does not take place π. The generated unique filename will be reported to you. Heads up though:runiquewill not affect local files generated from a shell command (see below). Default value is off.sendlocal-file [remote-file] β a synonym forput. same vibe, different name β¨sendportβ toggles the use ofPORTcommands. By default, ftp will 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, ftp falls back to the default data port. WhenPORTcommands are disabled, no attempt will be made to use them for each data transfer. This is useful for certain FTP implementations which 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. she's got range πstatusβ show the current status of ftp.struct[struct-name] β set the file transfer structure to struct-name. By default the β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β show the type of operating system running on the remote machine.tenexβ set the file transfer type to the one you need to talk to TENEX machines.traceβ toggles packet tracing.type[type-name] β set 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] β set 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 isn't specified and the server needs it, ftp will prompt the user for it (after disabling local echo, so no peeking π). If an account field isn't specified and the FTP server requires it, the user will be prompted for it. If an account field is specified, anaccountcommand will be relayed to the remote server after the login sequence is completed β but only if the remote server didn't require it for logging in. Unless ftp was invoked with βauto-loginβ disabled, this whole process happens 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. Also, if verbose is on, when a file transfer completes, statistics regarding the efficiency of the transfer get 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. How fast this actually happens depends on 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 finished sending the requested file. so you'll just be sitting there like π§ββοΈ
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 come from the ABOR processing described above, or from unexpected behavior by the remote server, including violations of the ftp protocol. And if the delay is because of 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, the stdin (for reading) or stdout (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 (writes) from the 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 the
csh(1); c.f. theglobcommand. If the ftp command 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β (for PDP-10's and PDP-20's mostly). 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.
π ENVIRONMENT
Ftp utilizes the following environment variables.
HOMEβ for default location of a.netrcfile, if one exists.SHELLβ for default shell.SSL_CIPHERβ for acceptable cipher combinations.
π SEE ALSO
π HISTORY
The ftp command appeared in 4.2BSD.
π BUGS
Correct execution of many commands depends upon proper behavior by the remote server. (the way that everything is the server's fault and also not our problem π)
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. periodt. π
and that's the whole page bestie!! π this icon of a manual page came from Linux NetKit (0.17), dated August 15, 1999, and it lives in section FTP(1) β go forth and transfer responsibly π¦β¨
π¦ where this page comes from
- debian bookworm: ftp-ssl 0.17.34+really0.17-1+b1 Β· BSD-4-clause-UC
- debian trixie: ftp-ssl 0.17.34+really0.17-2 Β· BSD-4-clause-UC
- ubuntu jammy: ftp-ssl 0.17.34+really0.17-1 Β· BSD-4-clause-UC
- ubuntu noble: ftp-ssl 0.17.34+really0.17-1build2 Β· BSD-4-clause-UC
- ubuntu questing: ftp-ssl 0.17.34+really0.17-2
- ubuntu resolute: ftp-ssl 0.17.34+really0.17-3 Β· BSD-4-clause-UC
- ubuntu stonking: ftp-ssl 0.17.34+really0.17-3build1 Β· BSD-4-clause-UC
- Copyright (c) 1985, 1989, 1990 The Regents of the University of California
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms