Before downloading files, there are a few things that you need to take care of.
To turn on hash mark printing, give the command hash.
> hash
Hash mark printing on (8192 bytes/hash mark).
ftp>
Why does the file type matter? Only because on some systems (such as MS-DOS systems), certain characters in a text file, such as carriage returns, need to be converted so that the file will be readable. While transferring in binary mode, no conversion is done-the file is simply transferred byte after byte.
The commands bin and ascii set the transfer mode to binary and text, respectively. When in doubt, always use binary mode to transfer files. If you try to transfer a binary file in text mode, you'll corrupt the file and it will be unusable. (This is one of the most common mistakes made when using FTP.) However, you can use text mode for plain text files (whose filenames often end in .txt).
For our example, we're downloading the file README, which is most likely a text file, so we use the command
> ascii
200 Type set to A.
ftp>
For example, to set the local directory to /home/db/mdw/tmp, use the command
> lcd /home/db/mdw/tmp
Local directory now /home/db/mdw/tmp
ftp>
Now you're ready to actually download the file. The command
is used for this, whereremote-name
![]()
local-name
![]()
For our example, to download the file README, we simply use
> get README
200 PORT command successful.
150 ASCII data connection for README (128.84.181.1,4527) (1433 bytes).
#
226 ASCII Transfer complete.
local: README remote: README
1493 bytes received in 0.03 seconds (49 Kbytes/s)
ftp>