In this chapter
Although you can connect a DOS-based computer directly to the Internet (through an ISP using a PPP connection), this is almost never done. Instead, you can more easily use a terminal emulation program to dial in to what is called a shell account with an ISP, such as Netcom. Dialing in this way gives you the appearance of sitting at a Unix-based terminal connected to the Internet. You can use all the Unix tools to perform various tasks on the Internet, such as transferring files from a remote host to your shell account (FTP), opening a terminal session on another computer on the Internet (Telnet), searching for information using Gopher, or getting rudimentary access (text based) to the World Wide Web.
You also need to be aware of another aspect of using DOS with the Internet. Even when you have a Windows-based PC, many of the basic tools for the Internet are text based and work very well in a DOS window. So, you can connect your Windows 9x PC to an ISP; open a DOS window; and run FTP, Telnet, or other DOS-based Internet utilities, for example. In this chapter, you learn about both these DOS-based Internet access methods.
Many ISPs offer a type of account called a shell account. This account enables you to dial in to the ISP's system using just about any type of computer, provided it has a terminal emulation program that is compatible with the terminal emulation of the shell account (most are). After you have connected, the terminal emulation program gives you a window to a Unix host at the ISP (which means that you'll be using Unix commands), from which you can perform most Internet-related work. Most shell accounts include a certain amount of disk space in which you can store files you've retrieved from other systems or have uploaded from your own computer, and often you can even upload Web pages to the disk space and use the WWW services of your ISP to serve those Web pages up to others.
To connect to an ISP with a shell account, you use a terminal emulation program such as Procomm Plus, SmartTerm, or one of many others. Good shareware terminal emulation programs are also available, such as the top-rated Telix, Qmodem, or SlickTerminal, all of which can be downloaded from a number of Internet sites, including www.zdnet.com.
Usually, connecting to the ISP is relatively easy. Using the information provided by the ISP, follow these steps:
Set the terminal emulation program's parameters (COM port, modem type, baud rate, data bits, stop bits, and parity).
Set the phone number for the ISP.
Dial the number.
After connecting, you see a prompt and can use the basic Unix commands listed in Table 21.1.
Keep in mind that, unlike DOS systems, Unix systems are case sensitive. In Unix, you're free to have four files called File
, file
, FILE
, and FiLE
, all in the same directory. This also means that your commands don't work correctly unless you match the case of the file you're operating on exactly.
Another point to keep in mind is that Unix uses the forward slash (/) for directory separators instead of the DOS backslash ().
Whether you are using a shell account or a DOS window on a Windows computer connected to the Internet, you use two key Internet tools. Fortunately, these tools function almost identically either way; Telnet and FTP work similarly under Unix as in a DOS window.
Using the Telnet program is extremely easy. You simply type a command at the shell prompt, followed by the address of the computer to which you want to connect, and press Enter. When you connect to the computer in question, you are prompted for a username and password. After you've logged on to the remote system, you proceed just like you're sitting at a terminal connected to that other system. Working this way can get rather confusing after a while because you can use the remote system to telnet to another system, to yet another system, and so forth.
In some cases, you specify not only the remote system's address, but also a port number. Unix hosts on the Internet can host a number of different services, and often certain services are restricted to certain port numbers. You specify these port numbers after the address, separated by a space.
Most publicly available Telnet systems might not require a username and password; you might be able to connect immediately, although in these cases, you are usually restricted to limited actions on the remote system. For example, if you use Telnet to access um-weather.sprl.umich.edu:3000
(note the port number 3000 being used), you quickly connect to a menu system that gives you up-to-date weather conditions for cities all over the U.S. However, you then cannot use Telnet on that computer to connect to another. Instead, you simply disconnect from that host and open a new host (which is actually what you do all the time anyway; anything else is not very productive).
The abbreviation FTP stands for two different things; it stands for both file transfer protocol as well as file transfer program. In fact, the FTP program uses the FTP protocol to do its work; they were developed at the same time and for the same purpose.
FTP enables you to transfer files to and from an FTP server over the Internet. For example, you might use Microsoft's FTP server to download a patch for one of its products and use the FTP program to do so. You also might have an FTP server in your organization that you transfer files to and from.
You connect to an FTP server by typing FTP at a command prompt (either DOS window or shell account prompt), followed by the address of the server you want to log in to. You then are prompted for your username and password. Note that many FTP servers are set up to allow anonymous access. For these servers, you type anonymous
as the username and your e-mail address as the password.
After you have connected to an FTP server, all the various FTP commands are available to you. Usually, you can get an onscreen list of these commands by typing either ?
or HELP
and pressing Enter. Figure 21.1 shows the DOS FTP client included with Windows 98 with its help screen displayed. To get a limited amount of help with any particular command, type either ?
or HELP
, followed by the name of the command.
The commands in the FTP program are not case sensitive. Keep in mind, however, that the file and directory names that you often work with on Unix are.
There are a number of important and regularly used commands in the FTP program. Table 21.2 details these FTP commands.
Table 21.2. FTP Command Summary
Command | Parameters | Description |
---|---|---|
ASCII
| None | Sets the ASCII file transfer type. Any retrieved or sent files are processed as though they were ASCII files. This is the default mode for FTP but should not be used when you're transferring binary files. |
BINARY
| None | Sets the binary file transfer type, where any received or sent files are sent exactly as they occur, byte by byte. You almost always should issue this command immediately after starting FTP because most file transfers require it for the resulting file to be usable. |
BYE
| None | Closes the connection and exits the FTP program. |
CD
| Directory name
| Changes directory on the remote system. |
CLOSE
| None | Terminates the FTP session with the remote FTP server but leaves the FTP program open and ready to connect to another server. |
DELETE
| Filename
| Deletes a remote file. Note that most FTP servers don't enable you to delete a remote file unless you have complete ownership of the file in question. |
DIR
| Directory or wildcard
| Lists contents of files on remote systems. This command is identical to ls -l .
|
DISCONNECT
| None | Same as the CLOSE command.
|
GET
| Filename
| Retrieves a single file from the remote system. Make sure you choose the right file transfer mode first. |
LCD
| Directory name
| Changes the local directory name. Use this command before you retrieve a file from the remote system if you don't start FTP from the directory in which you want to store the received file. |
LS
| Directory or wildcard
| Functions similarly to the DOS DIR command. You also might (on some systems) append different parameters to get different types of listings. For example, try -l and -w . You need not use a directory or wildcard with this command; again, it's just like DIR in this respect. If you leave off the parameter, all files in the current directory are listed.
|
MDELETE
| Wildcard
| Deletes multiple files. You must have permission to delete files on the remote system. |
MGET
| Wildcard
| Gets multiple files from a remote system. For example, MGET *.* gets all the files in the current directory.
|
MKDIR
| Directory name
| Creates a directory on the remote system. |
MPUT
| Wildcard
| Sends multiple files to a remote system. You must have file create privileges for the directory to which you are sending the files. |
OPEN
| FTP Server Name
| Opens a connection to the specified FTP server. |
PROMPT
| None | Toggles on and off the prompt setting. The default is to prompt you for each file when you use MPUT or MGET . Typing PROMPT before using those commands enables them to proceed much faster, without file-by-file confirmation from you.
|
PUT
| Filename
| Transfers a file to a remote system. You must have file create privileges on the remote system. |
PWD
| None | Displays (prints) the working directory on the remote system. |
QUIT
| None | Closes the FTP connection and exits FTP. |
RECV
| Filename
| Synonymous with GET ; works the same.
|
REMOTEHELP
| None | Displays commands accepted by the remote system. |
RENAME
| Src_file Dest_file
| Renames a file on the remote system. |
RMDIR
| Directory name
| Removes a directory on the remote system. |
SEND
| Filename
| Synonymous with PUT .
|
STATUS
| None | Displays current connection status. |
!
| Various | Placing the exclamation point in front of most of the FTP commands makes them apply to your own computer. For example, !dir lists files in your local directory. Similarly, commands such as !cd , !mkdir , and !rmdir perform those functions on your computer without interrupting your FTP session.
|
Now that you know what FTP does, review this section to see how it actually works. For this example, you see how to start FTP, connect to Microsoft's FTP server (used as an example), display and list directories, navigate to a particular directory, and retrieve the files contained there.
Start from the directory to which you want to transfer files. Starting from this directory saves time because you don't have to perform the !cd
command within the FTP program when you start it.
In this example, the client networking files for MS-DOS will be retrieved from Microsoft's FTP server. The files will be placed in the C:CLIENT
directory, so that directory is chosen before starting the FTP program by simply typing FTP
and pressing Enter. Follow these steps:
After you start FTP, connect to the site by using the OPEN
command, as follows, and then pressing Enter:
open ftp.microsoft.com
After connecting, you are prompted for a username and password. Type anonymous
for the username and your e-mail address as the password. Figure 21.2 shows the results of completing these steps.
After your password is accepted, you can get your bearings on the remote system by using the ls
command. It is preferable to use ls -l
because you then can tell the difference between files and directories. Figure 22.3 shows the results of using the ls -l
command.
Note several important points about the display shown in Figure 21.3. First, the file and directory names are shown at the far right of each line. To their immediate left, you can see the size of the entry. On the extreme left, you can tell whether the entry is a file or directory. If you see the letter d listed in the first column, the entry is a directory; a dash indicates that the entry is a file.
Because you're looking for client software for a server product in this example, you deduce that it might be found in the bussys
subdirectory. Switch to that directory by typing the following command and pressing Enter:
cd bussys
Repeat the ls -l
command to see what's in the bussys
directory. There, you see a directory called Clients
. Switch to it by using cd Clients
(note the case sensitivity) and perform another ls -l
to see what's there. Voil[ag]a! You see a directory called MSCLIENT
, which is what you are looking for. You can make one last change to that directory by typing cd MSCLIENT
and a final ls -l
to see what files are available. Figure 21.4 shows the results of these steps.
You see that this directory contains two files: DSK3-1.EXE
and DSK3-2.EXE
. To retrieve them, follow these additional steps:
Type BINARY
and press Enter to use a binary file transfer mode. Failing to complete this step renders the files unusable. You see the response Type set to I
.
Turn off multiple file-prompting by typing PROMPT
and pressing Enter. You then see the response Interactive mode Off
.
Retrieve both files by typing MGET *.*
and pressing Enter. You see each file transfer (this response might take a while if you're using a slower modem connection).
Figure 21.5 shows the results of these final steps.
After you retrieve the files, simply type QUIT
or BYE
to terminate the connection and exit FTP. That's it!
Unfortunately, the full power of the World Wide Web and Internet is not easily available from the world of DOS. However, you still can perform extremely important tasks from DOS on the Internet, including accessing some important information sources with Telnet and transferring files that you might require. In fact, even if you use a Windows-based PC, you might find that you occasionally prefer to open an MS-DOS prompt to use these tools. Not only can they be very productive, but they also can serve to help troubleshoot any Windows-based versions of these tools that you might be using.
If you plan to use a shell account with an ISP, spend some time combing through the ISP's various help files (most have an extensive library of these files). You also can use the Unix man
(short for Manual) command to access detailed information on all the Unix commands available to you through a shell account. It wasn't really very long ago, actually, when shell accounts were the only thing that worked on the Internet, and in fact I used them extensively before the Web was truly born. Although often cryptic and confusing, a shell account can also be incredibly productive in a Unix system, although mastering it does require an investment of your time.
Some common problems might crop up as you use these tools. The following are things to watch out for:
Remember that Unix is case sensitive. Because most PC operating systems (DOS, Windows, OS/2, and so forth) are not case sensitive, you can easily forget this important fact.
If you are having trouble connecting to a site using Telnet or FTP, make sure the site exists and is operating. Type the command ping
, followed by the name of the site, to perform a basic connectivity test. The ping
command reports whether it can connect to the site and can send and receive a small amount of test data. If ping
can't connect to a site, make sure that you have the correct address and that you're using the right case for the name of the site. You might just need to try again later; sites can often crash and be unavailable until their administrators fix whatever problem they're having.
Many sites have limits to the number of users they allow at any given time. Sometimes Telnet or FTP reports that there are too many users and that you are being disconnected. The only solution to this problem is to keep trying, perhaps during a time when the site is unlikely to be so busy.
If a site doesn't allow anonymous access, you need to have a proper username and password to access the site. Some sites require that you send an e-mail to the site's administrator requesting access or take some other steps to secure an account.
Many sites restrict what commands you can perform on them using Telnet or FTP. For example, some FTP sites enable you to use the command ls -l
, whereas others enable you to use only the short form, ls
. Other commands might be similarly restricted, such as commands that move or delete files. Sites that employ such restrictions usually post a notice that you see after you have logged in, or they might include a text file that describes these restrictions in their /pub
directory.
When you use a shell account and the Unix and Internet tools discussed in this chapter, plan to spend plenty of time learning to use these tools. Most shell account providers have extensive libraries of files describing how to use the tools they make available, in addition to the information you can find by using the Unix man
command. Also, consider purchasing a basic Unix book, such as Que's Practical Unix.
18.226.133.49