TNFTP(1)
โจ NAME โจ
okay so this is TNFTP(1) from the General Commands Manual ๐ and the whole thing is: tnftp โ Internet file transfer program ๐ฆ
๐ SYNOPSIS ๐
tnftp [-46AadefginpRtVv?] [-N netrc] [-o output] [-P port] [-q quittime]
[-r retry] [-s srcaddr] [-T dir,max[,inc]] [-x xfersize]
[[user@]host [port]] [[user@]host:[path][/]] [file:///path]
[ftp://[user[:password]@]host[:port]/path[/][;type=type]]
[http://[user[:password]@]host[:port]/path]
[https://[user[:password]@]host[:port]/path] ...
tnftp -u url file ...
๐ DESCRIPTION ๐
tnftp is the user interface to the Internet standard File Transfer Protocol, and it is giving main character energy โจ It lets you send files to a remote network site and pull them back down again. Iconic behavior.
The last five arguments will fetch a file using the FTP or HTTP protocols, or by direct copying, into the current directory. Literally ideal for scripts ๐ค Check out โAUTO-FETCHING FILESโ below for the full tea.
Options can be specified on the command line, or to the command interpreter. You get to choose your vibe ๐
-4โ Forces tnftp to only use IPv4 addresses. IPv4 only, no cap ๐ธ-6โ Forces tnftp to only use IPv6 addresses. IPv6 only, we're in the future now ๐-Aโ Force active mode FTP. Normally tnftp tries passive mode first and only falls back to active mode if the server doesn't support passive. This option makes tnftp always use an active connection. It's only useful for connecting to very old servers that don't implement passive mode properly, so ngl this is a vintage-only situation ๐ฐ๏ธ-aโ Bypasses the normal login procedure and uses an anonymous login instead. No account drama, just vibes ๐ซถ-dโ Enables debugging. Time to see behind the curtain ๐-eโ Disables command line editing. This is useful for Emacs ange-ftp mode, so if that's your whole life, you're welcome ๐-fโ Forces a cache reload for transfers that go through the FTP or HTTP proxies. Fresh copies only, bestie โจ-gโ Disables file name globbing. No wildcard expansion, we're keeping it literal ๐-iโ Turns off interactive prompting during multiple file transfers. No more "are you sure?" pop-ups, we trust the process ๐-N netrcโ Uses netrc instead of~/.netrc. Refer to โTHE .netrc FILEโ for more information ๐๏ธ-nโ Stops tnftp from trying โauto-loginโ on the initial connection for transfers that aren't auto-fetch. Here's the tea: if auto-login is enabled, tnftp checks the .netrc file (see below) in your home directory for an entry describing an account on the remote machine. If there's no entry, tnftp prompts for the remote machine login name (the default is your local user identity), and if needed, prompts for a password and an account to log in with. To override auto-login for auto-fetch transfers, specify the username (and optionally, password) as appropriate ๐-o outputโ When auto-fetching files, saves the contents to output. The output gets parsed according to the โFILE NAMING CONVENTIONSโ below. If output is not-and doesn't start with|, then only the first file specified gets retrieved into output. All the other files get retrieved into the basename of their remote name ๐-P portโ Sets the port number to port. Pick your door ๐ช-pโ Enables passive mode operation for use behind connection filtering firewalls. โ ๏ธ This option is deprecated, because tnftp now tries passive mode by default and falls back to active mode if the server doesn't support passive connections. So it's giving outdated, but it still exists ๐-q quittimeโ Quits if the connection has stalled for quittime seconds. If it's dead, it's dead ๐-Rโ Restarts all non-proxied auto-fetches. Fresh start, no shame ๐-r waitโ Retries the connection attempt if it failed, pausing for wait seconds first. Persistence is everything ๐ช-s srcaddrโ Uses srcaddr as the local IP address for all connections. You're choosing your outfit for every connection ๐ง-tโ Enables packet tracing. Watching the packets go by is so satisfying ๐-T direction,maximum[,increment]โ Sets the maximum transfer rate for direction to maximum bytes/second, and if specified, the increment to increment bytes/second. Refer toratefor more information ๐ข-u url file ...โ Uploads the files on the command line to url, where url is one of theftp://URL types supported by auto-fetch (with an optional target filename for single-file uploads), and file is one or more local files to upload ๐ซ โก๏ธโ๏ธ-Vโ Disables verbose and progress, overriding the default of enabled when output goes to a terminal. Shh, quiet mode ๐คซ-vโ Enables verbose and progress. This is the default if output goes to a terminal (and in the case of progress, tnftp is the foreground process). It forces tnftp to show all responses from the remote server, and report on data transfer statistics. Full receipts, every single one ๐งพโจ-x xfersizeโ Sets the size of the socket send and receive buffers to xfersize. Refer toxferbuffor more information ๐ฆ-?โ Displays help to stdout, and exits. When in doubt, ask for help ๐
The client host you want to talk to can be specified on the command line. If you do that, tnftp immediately tries to establish a connection to an FTP server on that host. Otherwise, tnftp enters its command interpreter and waits for instructions from you. When tnftp is waiting for commands, the prompt ftp> shows up. These are the commands tnftp recognizes, so let's go โจ
! [command [args]]โ Invokes an interactive shell on the local machine. If there are arguments, the first one is taken as a command to run directly, with the rest of the arguments as its arguments ๐$ macro-name [args]โ Runs the macro macro-name that was defined with themacdefcommand. Arguments are passed to the macro unglobbed ๐ฌaccount [passwd]โ Supplies a supplemental password that a remote system requires for access to resources once a login has been completed. If you don't include an argument, you'll be prompted for an account password in a non-echoing input mode, so nobody sees your secret ๐คappend local-file [remote-file]โ Appends a local file to a file on the remote machine. If remote-file is left unspecified, the local file name is used to name the remote file, after being altered by anyntransornmapsetting. File transfer uses the current settings for type, format, mode, and structure ๐asciiโ Sets the file transfer type to network ASCII. This is the default type, so it's the classic look ๐bellโ Arranges for a bell to sound after each file transfer command is completed. Ding! ๐binaryโ Sets the file transfer type to support binary image transfer ๐ผ๏ธbyeโ Terminates the FTP session with the remote server and exits tnftp. An end of file will also terminate the session and exit, so it's a two-for-one ๐caseโ Toggles remote computer file name case mapping duringget,mgetandmputcommands. 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. Shouting names get a lowercase glow-up ๐กcd remote-directoryโ Changes the working directory on the remote machine to remote-directory ๐cdupโ Changes the remote machine working directory to the parent of the current remote machine working directory. Going up one level, we love a little backtrack ๐chmod mode remote-fileโ Changes the permission modes of the file remote-file on the remote system to mode ๐closeโ Terminates the FTP session with the remote server and returns you to the command interpreter. Any defined macros are erased, so it's a clean slate ๐งนcrโ Toggles 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, and when an ascii type transfer is made, those linefeeds can only be told apart from a record delimiter whencris off. It's a whole thing, but that's the tea โdebug [debug-value]โ Toggles debugging mode. If you include an optional debug-value, it's used to set the debugging level. When debugging is on, tnftp prints each command sent to the remote machine, preceded by the string-->. Receipts for days ๐ต๏ธdelete remote-fileโ Deletes the file remote-file on the remote machine. Bye bye, file ๐๏ธdir [remote-path [local-file]]โ Prints a listing of the contents of a directory on the remote machine. The listing includes any system-dependent information the server chooses to include. For example, most Unix systems will produce output from the commandls -l. If remote-path is left unspecified, the current working directory is used. If interactive prompting is on, tnftp will ask you to verify that the last argument is indeed the target local file for receivingdiroutput. If no local file is specified, or if local-file is-, the output goes straight to the terminal ๐๏ธdisconnectโ A synonym forclose. Same energy, different name ๐ซงeditโ Toggles command line editing, plus context sensitive command and file completion. This is automatically enabled if input is from a terminal, and disabled otherwise. Autocomplete that actually knows what you mean โจ๏ธepsv, epsv4, epsv6โ Toggles the use of the extended EPSV and EPRT commands on all IP, IPv4, and IPv6 connections, respectively. It tries EPSV/EPRT first, and then PASV/PORT. This is enabled by default. If an extended command fails, this option is temporarily disabled for the duration of the current connection, or untilepsv,epsv4, orepsv6is executed again. It's like a fallback outfit, just in case ๐exitโ A synonym forbye. Yes, it's the same thing, we get it ๐ชfeaturesโ Displays what features the remote server supports (using the FEAT command). Show me what you've got ๐fget localfileโ Retrieves the files listed in localfile, which has one line per filename. A whole playlist of files, one line at a time ๐ถform formatโ Sets the file transfer form to format. The default (and only supported) format isnon-print. Simple and iconic ๐งftp host [port]โ A synonym foropen. Same vibe, just a different name ๐งโโ๏ธgate [host [port]]๐ฆ โ Flips gate-ftp mode on or off. This is the old-school mode for connecting through the TIS FWTK and Gauntlet FTP proxies. It won't work unless a gate-ftp server has been set, either by you or through the FTPSERVER environment variable. If you give a host, gate-ftp mode turns on and that becomes the gate-ftp server. Add a port and that's the port it connects to on the gate-ftp server. ๐ชโจget remote-file [local-file]๐ฅ โ Grabs the remote-file and saves it to your machine. No local-file name? It keeps the same name it has on the remote side, but the currentcase,ntrans, andnmapsettings can change it. The currenttype,form,mode, andstructuresettings are used during the transfer. ๐glob๐ธ โ Toggles filename expansion formdelete,mget,mput, andmreget. Turn globbing off and your filename arguments get taken literally, no expanding. Formput, globbing works like csh(1). Formdelete,mget, andmreget, each remote filename gets expanded separately on the remote machine, and the lists don't get merged. Expanding a directory name can behave differently from expanding an ordinary file. The exact result depends on the foreign operating system and FTP server, and you can preview it by runningmls remote-files -. ๐
โ ๏ธ Heads up bestie:mget,mput, andmregetare not built for transferring whole directory trees. If you need that, transfer a tar(1) archive of the subtree instead (in binary mode). ๐ฆ
hash [size]๐ฅ โ Toggles printing a hash sign (#) for every data block transferred. Blocks default to 1024 bytes, but you can change that by giving size in bytes. Turning onhashturns off progress. ๐ โโ๏ธhelp [command]๐ง โ Prints a helpful message about what command does. No argument?tnftpshows you a list of all the commands it knows. ๐idle [seconds]โฐ โ Sets the inactivity timer on the remote server to seconds seconds. Leave out seconds and it just prints the current inactivity timer. ๐ซถimage๐ผ๏ธ โ Same asbinary. Iconic. โจlcd [directory]๐ โ Changes the working directory on your local machine. No directory? You get sent to your home directory. ๐กless file๐ โ Same aspage. ๐lpage local-file๐ โ Shows local-file using whatever program is set in thepageroption. ๐lpwd๐ โ Prints your working directory on the local machine. ๐บ๏ธls [remote-path [local-file]]๐ โ Same asdir. ๐macdef macro-name๐ช โ Defines a macro. Every line after this gets stored as the macro macro-name. A null line (consecutive newlines in a file, or a blank carriage return from the terminal) ends macro input mode. You get up to 16 macros and 4096 total characters across all defined macros. Macro names can be at most 8 characters. Macros only work in the session they were defined in. If you define one outside a session, it belongs to the session opened by your nextopencommand. They stick around until you run aclosecommand. To run a macro, use the$command (see above). ๐ฎ
The macro processor treats $ and \ as special characters. A $ followed by a number (or numbers) gets swapped for the matching argument from the macro invocation command line. A $ followed by an i tells the macro processor to loop the running macro. On the first pass, $i becomes the first argument from the macro invocation command line. On the second pass, it becomes the second argument, and so on. A \ followed by any character becomes that character. Use \ if you want to stop the $ from getting special treatment. ๐
mdelete [remote-files]๐๏ธ โ Deletes the remote-files on the remote machine. ๐mdir remote-files local-file๐ โ Likedir, except you can name multiple remote files. If interactive prompting is on,tnftpwill check with you that the last argument really is the local file you want themdiroutput to go into. ๐คmget remote-files๐ฃ โ Expands the remote-files on the remote machine, then does agetfor each filename that comes out. Checkglobfor the filename expansion details. The resulting filenames then get processed according to thecase,ntrans, andnmapsettings. Files land in your local working directory, which you can change withlcd directory. You can make new local directories with! mkdir directory. ๐mkdir directory-name๐ ๏ธ โ Makes a directory on the remote machine. ๐๏ธmls remote-files local-file๐๏ธ โ Likels, except you can name multiple remote files, and local-file is required. If interactive prompting is on,tnftpwill ask you to confirm that the last argument is the local file for themlsoutput. ๐ซmlsd [remote-path]๐ค โ Shows the contents of remote-path in a machine-parsable form, using MLSD. If you don't give a path, it defaults to the current directory. You can change how it displays withremopts mlst .... ๐ปmlst [remote-path]๐ โ Shows details about remote-path in a machine-parsable form, using MLST. Without a path, it defaults to the current directory. You can change the display format withremopts mlst .... ๐งพmode mode-name๐ โ Sets the file transfer mode to mode-name. The default, and the only supported mode, isstream. ๐modtime remote-file๐ฐ๏ธ โ Shows the last modification time of the file on the remote machine, in RFC 2822 format. โณmore file๐ โ Same aspage. ๐mput local-files๐ค โ Expands wild cards in the local-files you list, then does aputfor each file in the resulting list. Checkglobfor the details on filename expansion. The resulting filenames then get processed according to thentransandnmapsettings. ๐mreget remote-files๐ โ Works just likemget, except it does aregetinstead of aget. ๐ฆmsend local-files๐จ โ Same asmput. ๐newer remote-file [local-file]๐ โ Only gets the file if the remote file's modification time is more recent than the file on your current system. If the file doesn't exist on your system, the remote file counts as newer. Otherwise, this command acts exactly likeget. โจnlist [remote-path [local-file]]๐ โ Same asls. ๐nmap [inpattern outpattern]๐บ๏ธ โ Sets or unsets the filename mapping mechanism. No arguments? It gets unset. With arguments, remote filenames get mapped duringmputcommands and duringputcommands that don't have a specified remote target filename. Local filenames get mapped duringmgetcommands andgetcommands that don't have a specified local target filename. This is super handy when you're connecting to a non-Unix remote computer with different file naming conventions or habits. The mapping follows the pattern set by inpattern and outpattern. ๐
inpattern is a template for incoming filenames. These may already have been processed according to the ntrans and case settings. You make variables by including $1, $2, ..., $9 in inpattern. Use \ to stop that special treatment of the $ character. Every other character is treated literally, and those characters are used to work out the values of the variables. For example, with inpattern $1.$2 and the remote filename mydata.data, $1 would be mydata and $2 would be data. ๐งฉ
outpattern decides the final mapped filename. The sequences $1, $2, ..., $9 get replaced by whatever values came out of the inpattern template. The sequence $0 gets replaced by the original filename. There's also the sequence [seq1,seq2], which becomes seq1 if seq1 isn't a null string, and otherwise becomes seq2. For example, this command:
nmap $1.$2.$3 [$1,$2].[$2,file]
would give the output filename myfile.data for the input filenames myfile.data and myfile.data.old, myfile.file for the input filename myfile, and myfile.myfile for the input filename .myfile. Spaces can go in outpattern too, like in this example:
nmap $1 sed s/ *$// > $1
Use \ to stop special treatment of the $, [, ], and , characters. ๐ซถโจ
Okay so bestie, we're picking up right where the commands list left off ๐ โจ
ntrans [inchars [outchars]]โ filename character translation time! ๐ฆ Use this to set up (or unset) a swap for filename characters. If you don't give it any arguments, the translation gets switched off. If you do give arguments, characters in remote filenames get swapped duringmputandputcommands that don't have a remote target filename. Local filenames get the same treatment duringmgetandgetcommands that don't have a local target filename. It's super handy when you're talking to a non-Unix remote computer with different naming conventions or habits ๐ธ. Any character in a filename that matches one in inchars gets replaced by the matching character in outchars. And if a character's spot in inchars is further along than the length of outchars, that character just gets deleted from the filename ๐.open host [port]โ connect to the FTP server at the host you name ๐. You can add a port number if you want tnftp to knock on a specific port instead. Ifset auto-loginis on (which it is by default), tnftp will also try to log you in automatically ๐ซถ (see below).page fileโ grabs file from the remote machine and shows it using whatever program you've set in theset pageroption ๐.passive [auto]โ flips passive mode on or off when you don't give it anything ๐ง. If you typeauto, it acts likeFTPMODEis set toโautoโ. When passive mode is on (the default), tnftp sends aPASVcommand for every data connection instead of aPORTcommand. WithPASV, the remote server opens a port for the data connection and tells you the address, then it listens there and you connect to it. With the old-schoolPORTcommand, the client is the one listening and it sends that address to the server, which connects back ๐. Passive mode is a lifesaver when you're going through a gateway router or host that controls which direction traffic flows ๐ก๏ธ. (Heads up: RFC 1123 says FTP servers have to supportPASV, but some of them just don't ๐ญ.)pdir [remote-path]โ runsdir [remote-path]and shows the result through the program set in theset pageroption ๐.pls [remote-path]โ runsls [remote-path]and pipes the result to yourset pagerprogram ๐.pmlsd [remote-path]โ runsmlsd [remote-path]and shows the result with yourset pagerprogram ๐ท.preserveโ toggles whether modification times get kept on the files you retrieve ๐ฐ๏ธ.progressโ toggles the transfer progress bar ๐. The bar gets turned off for any transfer where local-file isโ-โor a command that starts withโ|โ. Check out โFILE NAMING CONVENTIONSโ for more on that ๐. Heads up, turningprogresson also disableshash๐ โโ๏ธ.promptโ toggles interactive prompting ๐ฌ. Prompting happens during multi-file transfers so you can pick which files to grab or store. If prompting is off (default is on),mgetandmputwill transfer every file, andmdeletewill delete every file ๐ฅ. When prompting is on, these answers are available at the prompt:aโ say yes to the current file, and automatically say yes to any remaining files for the current command ๐.nโ say no and skip this file ๐ โโ๏ธ.pโ say yes to the current file and turn off prompt mode, same as if you'd typedprompt off๐.qโ stop the current operation entirely ๐.yโ say yes and transfer the file โ .?โ show a help message ๐.
Literally any other response counts as a yes for the current file ๐ .
proxy ftp-commandโ runs an FTP command over a secondary control connection ๐. This is the move when you want to be connected to two remote FTP servers at once and move files between them. Your firstproxycommand should be anopen, which sets up the secondary control connection ๐. Typeproxy ?to see every FTP command you can run on the secondary connection ๐. A few commands act differently withproxyin front:openwon't define new macros during auto-login,closewon't erase existing macro definitions,getandmgetmove files from the host on the primary control connection to the host on the secondary one, andput,mput, andappendmove files from the secondary host to the primary one ๐. Third-party transfers only work if the server on the secondary control connection supports the FTPPASVcommand ๐ซ .put local-file [remote-file]โ stores a local file on the remote machine ๐ค. If you skip remote-file, the local file name gets used, after running through anyntransornmapsettings to become the remote name ๐ท๏ธ. The transfer uses your currenttype,format,mode, andstructuresettings ๐.pwdโ prints the name of the current working directory on the remote machine ๐.quitโ just a synonym forbye๐.quote [arg ...]โ sends whatever arguments you give it, verbatim, straight to the remote FTP server ๐ฃ๏ธ.rate direction [maximum [increment]]โ throttles the maximum transfer rate to maximum bytes per second ๐ข. If maximum is0, the throttle gets switched off ๐ซ. direction can be one of these:allโ both directions ๐.getโ incoming transfers โฌ๏ธ.putโ outgoing transfers โฌ๏ธ.
maximum can be tweaked on the fly by increment bytes (default: 1024) every time one of these signals arrives ๐ก:
SIGUSR1โ bumps maximum up by increment bytes โฌ๏ธ.SIGUSR2โ knocks maximum down by increment bytes. The result has to stay a positive number โ ๏ธ.
If you don't supply maximum, you'll see the current throttle rates instead ๐.
Note: rate isn't implemented yet for ascii mode transfers ๐ง.
rcvbuf sizeโ sets the size of the socket receive buffer to size ๐ชฃ.recv remote-file [local-file]โ a synonym forget๐.reget remote-file [local-file]โ basicallyget, but with a twist ๐. If local-file already exists and is smaller than remote-file, tnftp assumes it's a partial copy of remote-file and continues the transfer from where it apparently failed. This is perfect for huge files over flaky networks that keep dropping connections ๐ฅน.remopts command [command-options]โ sets options on the remote FTP server for command to command-options (what happens when they're missing depends on the command) ๐ ๏ธ. The remote FTP commands known to support options include:MLST(used forMLSDandMLST) ๐งพ.rename [from [to]]โ renames the file from on the remote machine to the name to โ๏ธ.resetโ clears the reply queue ๐งน. This re-syncs the command and reply sequencing with the remote FTP server. You might need this after the remote server breaks the FTP protocol ๐ค.restart markerโ restarts the very nextgetorputat the marker you name ๐. On Unix systems, the marker is usually a byte offset into the file ๐ข.rhelp [command-name]โ asks the remote FTP server for help ๐. If you give a command-name, it gets passed along to the server too ๐จ.rmdir directory-nameโ deletes a directory on the remote machine ๐๏ธ.rstatus [remote-file]โ with no arguments, shows the status of the remote machine ๐ก. If you name a remote-file, it shows the status of that file on the remote machine instead ๐.runiqueโ toggles storing files locally under unique filenames ๐ฆ. If a file already exists with the same name as the target local filename for agetormget, a.1gets appended to the name. If that name is also taken, a.2gets appended to the original name instead. This keeps going up to.99, and if it gets that far, an error message prints and the transfer doesn't happen ๐ฑ. The generated unique filename gets reported back to you. Note thatruniquewon't touch local files generated from a shell command (see below) ๐. The default is off.send local-file [remote-file]โ a synonym forput๐ฎ.sendportโ toggles the use ofPORTcommands ๐. By default, tnftp tries to use aPORTcommand when setting up a connection for each data transfer. UsingPORTcommands can keep things from lagging when you're doing lots of file transfers ๐โโ๏ธ. If thePORTcommand fails, tnftp falls back to the default data port. WhenPORTcommands are disabled, tnftp won't try to use them for any data transfer. This is useful for certain FTP implementations that ignorePORTcommands but, incorrectly, say they've been accepted ๐.set [option value]โ sets option to value โ๏ธ. If you don't give option and value, you'll see every option and its current value ๐. The currently supported options are:anonpassโ defaults to$FTPANONPASS๐.ftp_proxyโ defaults to$ftp_proxy๐.http_proxyโ defaults to$http_proxy๐.https_proxyโ defaults to$https_proxy๐.
no_proxy โ Defaults to $no_proxy. ๐ธ
pagerโ Defaults to$PAGER. ๐promptโ Defaults to$FTPPROMPT. ๐ฌrpromptโ Defaults to$FTPRPROMPT. ๐ซถsslnoverifyโ Defaults to$FTPSSLNOVERIFY. ๐site [arg ...]โ Whatever you type here gets shipped, word for word, to the remote FTP server as aSITEcommand. No edits, no cap. ๐size remote-fileโ Asks the remote machine how bigremote-fileis. ๐sndbuf sizeโ Sets the size of the socket send buffer tosize. ๐ฆstatusโ Shows you the current status of tnftp. Main character check! ๐struct struct-nameโ Sets the file transfer structure tostruct-name. The default, and honestly the only supported one, is โfileโ. ๐งฑsuniqueโ Flips storing files on the remote machine under unique file names on or off. Heads up: the remote FTP server has to support the FTPSTOUcommand for this to finish successfully. The server will tell you the unique name it picked. The default is off. ๐ฆsystemโ Shows what type of operating system is running on the remote machine. ๐ปtenexโ Sets the file transfer type to whatever is needed to talk to TENEX machines. Very retro, very iconic. ๐ฐ๏ธthrottleโ Just a synonym forrate. Same energy, different name. ๐ซtraceโ Toggles packet tracing. ๐ต๏ธโโ๏ธtype [type-name]โ Sets the file transfer type totype-name. If you don't give it one, it prints the current type instead. The default type is network ASCII. ๐คumask [newmask]โ Sets the default umask on the remote server tonewmask. If you leavenewmaskout, the current umask gets printed. ๐unset optionโ Unsetsoption. Check outsetif you want the full tea. โusage commandโ Prints the usage message forcommand. Forgot how something works? This is your rescue. ๐user user-name [password [account]]โ Introduces you to the remote FTP server. If you don't pass a password and the server wants one, tnftp will ask you for it, and local echo gets turned off so nobody can peek over your shoulder ๐๐. If you skip the account field and the server needs one, you'll get prompted for that too. If you DO give an account, anaccountcommand gets relayed to the remote server after the login sequence finishes, but only if the server didn't need it to log you in. Unless tnftp was started with โauto-loginโ disabled, this whole dance happens automatically the first time you connect. โจverboseโ Toggles verbose mode. When it's on, every response from the FTP server gets shown to you. Also, if verbose is on when a transfer finishes, you'll get stats on how efficient the transfer was. By default, verbose is on. ๐ฃxferbuf sizeโ Sets the size of the socket send and receive buffers tosize. ๐? [command]โ A synonym forhelp. Literally just a shortcut. ๐
Command arguments with embedded spaces can be wrapped in quote โ"โ marks, so the shell doesn't split them up on you. ๐งฉ
Commands that toggle settings can also take an explicit on or off argument if you want to force the setting one way or the other. No guessing needed! ๐ฏ
Commands that take a byte count (like hash, rate, and xferbuf) support an optional suffix that changes how the number gets read. Here are the suffixes, bestie:
bโ Causes no modification. (Optional, so you don't even need to type it ๐)kโ Kilo! Multiplies the argument by 1024. ๐mโ Mega! Multiplies the argument by 1048576. ๐gโ Giga! Multiplies the argument by 1073741824. ๐ฅ
๐ญ Heads up: if tnftp gets aSIGINFO(check the status argument of stty(1) for that one) or aSIGQUITsignal while a transfer is happening, it'll dump the current transfer rate statistics to the standard error output. The format matches the standard completion message, so you'll feel right at home. ๐
โจ AUTO-FETCHING FILES โจ
Okay so, on top of the regular commands, this version of tnftp has an auto-fetch feature that is literally so good. ๐คฉ To turn it on, just pass a list of hostnames and/or files on the command line. Easy peasy. ๐ซถ
These are the formats that count as valid syntax for an auto-fetch element:
[user@]host:[path][/]โ The โClassicโ FTP format. ๐ฎ
If path has a glob character in it and globbing is enabled (see glob), tnftp does the equivalent of mget path. ๐ช
If the directory part of path has no globbing characters, the file gets stored locally with the basename(1) of path, in the current directory. Otherwise, the full remote name is used as the local name, relative to the local root directory. ๐๏ธ
ftp://[user[:password]@]host[:port]/path[/][;type=type]โ An FTP URL! It gets retrieved with the FTP protocol as long as setftp_proxyisn't defined. If it IS defined, the URL gets transferred over HTTP through the proxy set inftp_proxy. Ifftp_proxyisn't defined and you gave auser, tnftp logs in as that user. You can pass apasswordtoo, and if you don't, you'll get prompted for one. ๐
If the URL ends with a ;type=A or ;type=I suffix, the transfer happens as ascii or binary (respectively). The default transfer type is binary. ๐ค
To play nice with RFC 3986, tnftp reads the path part of an ftp:// auto-fetch URL like this:
- The
/right afterhost[:port]is treated as a separator before the path, not as part of the path itself. โ๏ธ - The path is read as a
/-separated list of name components. For every component except the last one, tnftp does the equivalent of acdcommand. For the last component, it does the equivalent of agetcommand. ๐งญ - Empty name components (which happen with
//inside the path, or with an extra/at the very start) will cause the equivalent of acdcommand with no directory name. This is unlikely to be useful, so maybe don't count on it. ๐ - Any
%XXcodes (per RFC 3986) inside the path components get decoded, whereXXis a character code in hexadecimal. The decoding happens after the path is split into components, but before each component gets used in the equivalent of acdorgetcommand. Some popular codes:%2F(which is/) and%7E(which is~). ๐ธ
Here's what that means in practice:
- The path is read relative to the default login directory of the specified user, or of the
anonymoususer. If you need the/directory, start your path with%2F. If you need a user's home directory (and the remote server supports that syntax), start your path with%7Euser/. For example, to grab /etc/motd fromlocalhostas the usermynamewith the passwordmypass, useftp://myname:mypass@localhost/%2fetc/motd๐ - You can control the exact
cdandgetcommands by choosing carefully where to put/and where to put%2F(or%2f). For example, these URLs line up with the equivalent commands listed next to them:
ftp://host/dir1/dir2/file cd dir1, cd dir2, get file.
ftp://host/%2Fdir1/dir2/file cd /dir1, cd dir2, get file.
ftp://host/dir1%2Fdir2/file cd dir1/dir2, get file.
- You need the right access permissions for every intermediate directory used in the equivalent of a
cdcommand. No permissions, no party. ๐ช
http://[user[:password]@]host[:port]/pathโ An HTTP URL, retrieved with the HTTP protocol. If sethttp_proxyis defined, it gets used as a URL to an HTTP proxy server. If HTTP authorization is needed to retrievepath, and auser(and optionally apassword) is in the URL, those get used for the first authentication attempt. ๐https://[user[:password]@]host[:port]/pathโ An HTTPS URL, retrieved with the HTTPS protocol. If sethttps_proxyis defined, it gets used as a URL to an HTTPS proxy server. If HTTPS authorization is needed to retrievepath, and auser(and optionally apassword) is in the URL, those get used for the first attempt to authenticate. โ ๏ธ There is currently no certificate validation and verification, so be careful with anything sensitive. ๐file:///pathโ A local URL, copied from/pathon the local host. ๐about:topicโ Displays information abouttopic. No file is retrieved for this auto-fetched element. Supported values include: ๐about:ftpโ Information about tnftp. ๐about:versionโ The version of tnftp. Super useful to include when you're reporting problems, so bring it! ๐
Unless noted otherwise above, and if -o output is not given, the file gets stored in the current directory as the basename(1) of path. Note that if an HTTP redirect comes back, the fetch gets retried using the new target URL the server supplied, with a matching new path. ๐ Using an explicit -o output is recommended so you don't accidentally write to some unexpected file name. ๐
If a classic format or an FTP URL format has a trailing / or an empty path component, tnftp will connect to the site and cd to the directory given as the path, then leave you in interactive mode, ready for more input. This won't work if set ftp_proxy is being used. ๐
โโ๏ธ
Direct HTTP transfers use HTTP 1.1. Proxied FTP and HTTP transfers use HTTP 1.0. ๐
If you pass -R, all auto-fetches that don't go through the FTP or HTTP proxies will be restarted. For FTP, this is done by using reget instead of get. For HTTP, it's done with the Range: bytes= HTTP/1.1 directive. Resume game strong! ๐
If WWW or proxy WWW authentication is required, you'll be prompted to enter a username and password to authenticate with. ๐
When you're specifying IPv6 numeric addresses in a URL, you need to wrap the address in square brackets. E.g.: ftp://[::1]:21/. This is because colons show up in IPv6 numeric addresses AND act as the separator for the port number, so the brackets keep everything from getting confused. ๐ง โจ
โจ ABORTING A FILE TRANSFER โจ
okay so if you need to bail on a transfer, just hit the terminal interrupt key (usually Ctrl-C) ๐. Sending transfers get halted immediately. Receiving transfers get halted by sending an FTP protocol ABOR command to the remote server and then tossing out any extra data that comes in ๐๏ธ. How fast that happens depends on how well the remote server handles ABOR processing ๐ข. If the remote server doesn't support the ABOR command at all, the prompt won't come back until the server has finished sending the requested file, so just vibe and wait ๐ซ .
โ ๏ธ bestie, if you hit the terminal interrupt key while tnftp is waiting on the remote server's reply to the ABOR, the connection gets closed ๐. This is different from the traditional behaviour (which ignores the terminal interrupt during this phase), but it's considered more useful โจ.
๐ FILE NAMING CONVENTIONS ๐
okay so every file you pass as an argument to a tnftp command gets processed using these rules ๐:
- If the file name is
-, then stdin (for reading) or stdout (for writing) gets used ๐ฏ. - If the first character of the file name is
|, the rest of the argument is treated as a shell command ๐. tnftp then forks a shell, using popen(3) with the argument you gave it, and reads from (or writes to) the stdout (or stdin) ๐ช. If the shell command has spaces in it, the argument has to be quoted, like"| ls -lt". A super useful example of this isdir "" |more๐ . - If the above checks don't match and globbing is enabled, local file names get expanded using the rules from csh(1); see the
globcommand ๐. If the tnftp command expects a single local file (likeput), only the first filename the globbing produces gets used โ๏ธ. - For
mgetcommands andgetcommands with no local file name given, the local file name is the remote file name ๐ฅ. That name can get altered by acase,ntrans, ornmapsetting. The resulting name may then get altered again ifruniqueis on ๐. - For
mputcommands andputcommands with no remote file name given, the remote file name is the local file name ๐ค. That can get altered by anntransornmapsetting. The resulting name may then get altered by the remote server ifsuniqueis on ๐.
๐ฆ FILE TRANSFER PARAMETERS ๐ฆ
the FTP spec has a ton of parameters that can affect a file transfer, so buckle up ๐ซถ. The type can be one of โasciiโ, โimageโ (binary), โebcdicโ, and โlocal byte sizeโ (mostly for PDP-10's and PDP-20's, lol) ๐ฅ๏ธ. tnftp supports the ascii and image types, plus local byte size 8 for tenex mode transfers โจ.
tnftp only supports the default values for the remaining file transfer parameters: mode, form, and struct ๐โโ๏ธ. no notes, no drama.
๐ THE .netrc FILE ๐
okay so the .netrc file holds the login and initialization info used by the auto-login process ๐. It lives in the user's home directory, unless you override it with the -N netrc option, or set it in the NETRC environment variable ๐ . These tokens are recognized, and they can be separated by spaces, tabs, or new-lines ๐งฉ:
machine nameโ identifies a remote machine name ๐ฅ๏ธ. The auto-login process searches the.netrcfile for amachinetoken that matches the remote machine you gave on the tnftp command line or as anopencommand argument ๐. Once it finds a match, it processes the following.netrctokens, and stops when it hits the end of the file or anothermachineordefaulttoken ๐.defaultโ basically the same asmachine name, exceptdefaultmatches any name ๐. There can be only onedefaulttoken, and it has to come after all themachinetokens ๐. This is normally used like this:
default login anonymous password user@site
which gives you an automatic anonymous FTP login to machines not listed in .netrc ๐. You can override this by using the -n flag to disable auto-login ๐
โโ๏ธ.
login nameโ identifies a user on the remote machine ๐ค. If this token is there, the auto-login process starts a login with the name you specified ๐ช.password stringโ supplies a password ๐คซ. If this token is there, the auto-login process supplies the string if the remote server asks for a password during login ๐. Heads up: if this token is in the.netrcfile for any user other thananonymous, tnftp will abort the auto-login process if the.netrcfile is readable by anyone besides the user ๐จ.account stringโ supplies an extra account password ๐ณ. If this token is there, the auto-login process supplies the string if the remote server asks for an additional account password ๐โโ๏ธ. If the server doesn't ask for one, the auto-login process starts anACCTcommand instead ๐.macdef nameโ defines a macro ๐งช. This token works just like the tnftpmacdefcommand does ๐ค. The macro gets defined with the name you give it, and its contents start on the next.netrcline and keep going until a blank line (consecutive new-line characters) shows up ๐. Like the other.netrctokens, amacdefonly applies to the machine definition right before it ๐. Amacdefentry can't be shared by multiple machine definitions, so you have to define it after each machine you want it to work with ๐ฏ. If a macro namedinitis defined, it gets automatically executed as the last step in the auto-login process โญ. For example:
default
macdef init
epsv4 off
and then a blank line after it, so the macro knows where to stop ๐ซง.
๐ป COMMAND LINE EDITING ๐ป
tnftp supports interactive command line editing through the editline(3) library ๐ช. You turn it on with the edit command, and it's enabled by default if input is coming from a tty โ
. You can recall and edit previous lines with the arrow keys, and other GNU Emacs-style editing keys work too ๐ง .
The editline(3) library gets configured with a .editrc file, so check out editrc(5) for more info ๐.
There's also an extra key binding that gives tnftp context sensitive command and filename completion (including remote file completion) ๐คฉ. To use it, bind a key to the editline(3) command ftp-complete. By default this is bound to the TAB key โจ๏ธ.
๐ธ COMMAND LINE PROMPT ๐ธ
by default, tnftp shows the user a command line prompt of ftp> ๐ฌ. You can change that with the set prompt command ๐จ.
You can also show a prompt on the right side of the screen (after the command input) with the set rprompt command ๐.
The following formatting sequences get replaced by the info they stand for ๐ง:
%/โ the current remote working directory ๐.%c[[0]n],%.[[0]n]โ the trailing component of the current remote working directory, or n trailing components if a digit n is given ๐งฉ. If n begins with0, the number of skipped components goes in front of the trailing component(s), formatted as/<number>trailing(for%c) or...trailing(for%.) ๐ข.%Mโ the remote host name ๐ฅ๏ธ.%mโ the remote host name, up to the first dot.๐ช.%nโ the remote user name ๐ค.%%โ a single percent character%๐ฏ.
๐ ENVIRONMENT ๐
tnftp uses the following environment variables, so these are the ones to know ๐ซถ.
FTPANONPASSโ the password to send in an anonymous FTP transfer ๐. It defaults to โ`whoami`@โ.FTPMODEโ overrides the default operation mode ๐. Supported values are:activeโ active mode FTP only ๐ฃ.autoโ automatic determination of passive or active (this is the default) ๐ค.gateโ gate-ftp mode ๐ช.passiveโ passive mode FTP only ๐คซ.
FTPPROMPTโ the command-line prompt to use ๐ฌ. It defaults toftp>. Check out โCOMMAND LINE PROMPTโ for more info ๐.FTPRPROMPTโ the command-line right side prompt to use ๐. It defaults to an empty string. Check out โCOMMAND LINE PROMPTโ for more info ๐.FTPSERVERโ the host to use as the gate-ftp server when gate is enabled ๐ช.FTPSERVERPORTโ the port to use when connecting to the gate-ftp server when gate is enabled ๐. The default is the port returned by a getservbyname(3) lookup of โftpgate/tcpโ ๐.FTPUSERAGENTโ the value to send for the HTTP User-Agent header ๐ต๏ธโโ๏ธ.FTPSSLNOVERIFYโ set this to1to not verify SSL certificates ๐.HOMEโ used for the default location of a.netrcfile, if one exists ๐ก.NETRCโ an alternate location of the.netrcfile ๐.PAGERโ used by various commands to display files ๐. It defaults to more(1) if it's empty or not set ๐.SHELLโ used for the default shell ๐.ftp_proxyโ the URL of the FTP proxy to use when making FTP URL requests ๐. If it's not defined, the standard FTP protocol gets used instead ๐.
See http_proxy for further notes about proxy use ๐.
http_proxyโ the URL of the HTTP proxy to use when making HTTP URL requests ๐. If proxy authentication is required and there's a username and password in this URL, they get used automatically in the first attempt to authenticate to the proxy ๐.
If โunsafeโ URL characters are needed in the username or password (for example @ or /), encode them with RFC 3986 %XX encoding ๐งผ.
โ ๏ธ the use of a username and password inftp_proxyandhttp_proxymay be incompatible with other programs that use them (such as lynx(1)) ๐.
๐ NOTE: this is not used for interactive sessions, only for command-line fetches ๐ฏ.
https_proxyโ the URL of the HTTPS proxy to use when making HTTPS URL requests ๐.
See http_proxy for further notes about proxy use ๐.
no_proxyโ a space or comma separated list of hosts (or domains) that should not be proxied ๐ โโ๏ธ. Each entry can have an optional trailing:port, which restricts the matching to connections to that port ๐ฏ.
โจ EXTENDED PASSIVE MODE AND FIREWALLS โจ
okay so bestie, some firewall setups just don't vibe with tnftp using extended passive mode ๐ if even a plain ls seems to hang forever after printing something like this:
229 Entering Extended Passive Mode (|||58551|)
that's your sign ๐ฉ you need to turn extended passive mode off with epsv4 off. the "The .netrc File" section above has an example of how to make that happen automatically so you never have to think about it again ๐ซถ
๐ฆ SEE ALSO ๐ฆ
okay here's where to go for more info, no cap ๐
๐ STANDARDS ๐
tnftp really tries to be compliant with these bad boys ๐
- RFC 959 โ File Transfer Protocol
- RFC 1123 โ Requirements for Internet Hosts - Application and Support
- RFC 1635 โ How to Use Anonymous FTP
- RFC 2389 โ Feature negotiation mechanism for the File Transfer Protocol
- RFC 2428 โ FTP Extensions for IPv6 and NATs
- RFC 2616 โ Hypertext Transfer Protocol -- HTTP/1.1
- RFC 2822 โ Internet Message Format
- RFC 3659 โ Extensions to FTP
- RFC 3986 โ Uniform Resource Identifier (URI)
๐ HISTORY ๐
the tnftp command first showed up in 4.2BSD, iconic origin story โจ
okay but then it got a whole glow-up ๐ features like command line editing, context sensitive command and file completion, a dynamic progress bar, automatic fetching of files and URLs, modification time preservation, transfer rate throttling, a configurable command line prompt, and a bunch of other enhancements over the standard BSD tnftp were added in NetBSD 1.3 and later releases. the main brain behind all that was Luke Mewburn โจlukem@NetBSD.orgโฉ ๐ง
IPv6 support came from the WIDE/KAME project ๐ธ heads up though, it might not be in every non-NetBSD version of this program, since it depends on whether the operating system supports IPv6 in a similar manner to KAME.
๐ BUGS ๐
not gonna lie, a lot of commands only work right if the remote server behaves properly ๐
the 4.2BSD ascii-mode transfer code had a carriage return bug, and that's been fixed ๐ but the fix can mess up binary files moving to and from 4.2BSD servers using the ascii type. to dodge this, use the binary image type instead.
also tnftp assumes every IPv4 mapped address (IPv6 addresses that look like ::ffff:10.1.1.1) points to an IPv4 destination that AF_INET sockets can handle. in some IPv6 network setups, though, that's just not true ๐ญ in those environments, IPv4 mapped addresses have to be passed straight to AF_INET6 sockets. for example, if your site uses a SIIT translator for IPv6-to-IPv4 translation, tnftp can't support that configuration, sorry bestie ๐ฅบ
Manpage brought to you by Debian, last updated February 25, 2023, for TNFTP(1) ๐๐ stay hydrated and keep those transfers flowing, bestie โจ๐ฆ
๐ฆ where this page comes from
- debian trixie: tnftp 20230507-2+b1 ยท BSD-4-Clause
- fedora 43: tnftp 20230507-7.fc43 ยท 0BSD AND BSD-2-Clause AND BSD-3-Clause AND ISC
- fedora 44: tnftp 20230507-7.fc43 ยท 0BSD AND BSD-2-Clause AND BSD-3-Clause AND ISC
- opensuse-leap 16.0: tnftp 20230507-bp160.1.13 ยท BSD-3-Clause
- opensuse-leap 16.0: tnftp 20230507-bp160.1.13 ยท BSD-3-Clause
- opensuse-leap 16.0: tnftp 20230507-bp160.1.13 ยท BSD-3-Clause
- opensuse-leap 16.0: tnftp 20230507-bp160.1.13 ยท BSD-3-Clause
- ubuntu noble: tnftp 20230507-2build3 ยท BSD-4-Clause
- ubuntu questing: tnftp 20230507-2build3 ยท BSD-4-Clause
- Copyright (c) 1996-2023 The NetBSD Foundation, Inc
- Copyright (c) 1985, 1989, 1990, 1993 The Regents of the University of California. All rights reserved
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms