Sharing files on the Internet with ftp is similar to getting files; instead of retrieving files, however, you give files to other people (Code Listing 12.3).
1. | ftp ftp.raycomm.com Open the FTP connection as shown in the previous section. |
2. | youruserid
Log in with your userid. |
3. | password
Enter your password. |
4. | cd incoming
Use standard Unix directory commands (ls, cd, and so on) to move into the directory into which you want to put the files (Code Listing 12.3). incoming is often the right directory name to use, particularly on public FTP servers. |
5. | binary
Set the file type. You’ll want to use the binary file type for any files other than text or HTML files; use ascii for text or HTML. |
6. | put myjokes.gz Type put followed by the name of the file you’re making available. |
7. | quit
Type quit when you’re done. |
[ejr@hobbes ejr]$ ftp ftp.raycomm.com Connected to www.raycomm.com. 220 ftp.raycomm.com FTP server (NcFTPd →2.1.2, registered copy) ready. Name (ftp.raycomm.com:ejr): ejray 331 User ejray okay, need password. Password: 230-You are user #8 of 100 simultaneous →users allowed. 230- 230 Logged in. Remote system type is UNIX. Using binary mode to transfer files. ftp> cd incoming 250 "/home/ftp/pub/users/e/ejray/incoming" →is new cwd. ftp> binary 200 Type okay. ftp> put myjokes.gz local: myjokes.gz remote: myjokes.gz 200 PORT command successful. 150 Opening BINARY mode data connection. 226 Transfer completed. 128889 bytes sent in 15.5 secs →(8.1 Kbytes/sec) ftp> quit 221 C-ya! [ejr@hobbes ejr]$ |
✓ Tips
On public FTP servers that accept incoming files, you might not be able to list the files in the incoming directory or see anything in there. In this case, you essentially just cast your file into a big open room and close the door. This allows FTP administrators to screen the incoming files before making them available for downloading.
You can use the mput command to make multiple files available.
If you’re transferring a lot of files at once—say, for example, you’re moving all of your files from your old ISP to your new one—consider using tar and gz to collect and zip up all of your files, and then transferring just a single file. See Chapter 13 for more information about these commands.
Navigate in your local system (for example, to change to a directory containing files to put) with regular Unix commands like ls, pwd, and cd, prefaced with an !. For example, pwd would display the path and name of the current directory on the other system, and !pwd would display the path and name of the current directory on the local system.
Navigating with links
|