-->
Page 193
This hour introduces you to programs you'll use to get information and programs from the Internet. I'll assume that you have signed up with an Internet Service Provider (ISP) and that you have configured your Linux system to start and stop Point-to-Point Protocol network connections.
Page 194
JUST A MINUTE |
If you already have an account with a local ISP, but have not configured your Linux system to connect to the Internet, read Hour 10, "Connecting to the Internet," for instructions. |
I'll first introduce you to two Internet file transfer programs, and then cover some of the many World Wide Web browsers you'll find for Linux.
There are several ways to retrieve files from other computers on the Internet. You can use email or a Web browser, but if you're interested in just getting files into your computer, you can use the ftp (file transfer) program. The ftp program is one of the oldest programs to support the standard File Transfer Protocol, or FTP, and was the original program designed to transfer files. The FTP protocol lets you send and receive files interactively with the get and put commands.
The next section shows you how to use two FTP transfer programs, ftp and ncftp.
The ftp command, found under the /usr/bin directory, has five different command-line options, but is most often used with a hostname, or name of remote computer, for example:
# ftp ftp.mcp.com
This command line specifies that you want to connect to the ftp server at Macmillan Publishing. You don't have to specify a hostname on the command line, because you can run the ftp program interactively, repeatedly connecting and disconnecting to different computers. The ftp command has more than 70 different built-in commands, including a help facility. This hour doesn't cover all the different commands, but you can get more information about these commands by reading the ftp program's manual page, or by using the built-in help command.
Some of the commands you'll most likely use, especially when all you want to do is retrieve some programs or source code from Linux sites, are
!Prompt for and run a shell command. This is a handy way to view the contents of files, delete files you've just downloaded, or check on how much hard drive space you have left.
asciiDownload any specified files in text form.
binaryDownload any specified files in binary form. You must use this command before downloading most compressed Linux files.
Page 195
byeClose any open connection, and exit the ftp program.
cdChange directories, for example:
> cd ..
closeClose the current connection.
getDownload a specific file from the current directory to your current directory, for example:
> get killbarney.tgz
lsList files or directories in the current directory.
mgetDownload several files, one after another, that match a specified pattern, for example:
> mget kill*.tgz
openOpens a connection to a specified host, for example:
> open ftp.mcp.com
For example, to run the ftp command interactively, all you have to do is type
# ftp ftp> help Commands may be abbreviated. Commands are: ! debug mdir sendport site $ dir mget put size account disconnect mkdir pwd status append exit mls quit struct ascii form mode quote system bell get modtime recv sunique binary glob mput reget tenex bye hash newer rstatus tick case help nmap rhelp trace cd idle nlist rename type cdup image ntrans reset user chmod lcd open restart umask close ls prompt rmdir verbose cr macdef passive runique ? delete mdelete proxy send ftp> help exit exit terminate ftp session and exit ftp> help bye bye terminate ftp session and exit ftp> bye #
CAUTION |
If you have enforced disk quotas for users of your Linux system, users can |
Page 196
easily exceed the quota you've enforced, especially when downloading large files. One way to help users on a quota-enforced system is to tell them to first change directory to the /tmp directory if using ftp, and to then open a connection to download any large files. The /tmp directory will be cleaned out by your housekeeping crontab routines later on to make more room on your hard drive, but your users will be able to download large files without hitting hard limits on their quotas. |
To demonstrate the ftp program in action, I'll show you a sample session:
# ftp ftp.mcp.com Connected to ftp.mcp.com. 220 iq-mcp FTP server (Version wu-2.4(3) Thu Jun 12 14:38:11 EST 1997) ready. Name (ftp.mcp.com:bball): anonymous 331 Guest login ok, send your complete e-mail address as password. Password: 230 Guest login ok, access restrictions apply. Remote system type is UNIX. Using binary mode to transfer files. ftp> ls 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. total 14 drwxr-xr-x 7 root other 512 Dec 4 20:01 . drwxr-xr-x 7 root other 512 Dec 4 20:01 .. d--x--x--x 3 root other 512 Dec 4 18:44 bin dr-xr-xr-x 2 root other 512 Dec 4 18:44 dev d--x--x--x 2 root other 512 Dec 4 21:13 etc drwxr-xr-x 31 672 anon-ftp 1024 Dec 8 14:17 pub dr-xr-xr-x 3 root other 512 Dec 4 20:01 usr 226 Transfer complete. ftp> cd pub 250 CWD command successful. ftp> cd software 250 CWD command successful. ftp> ls 200 PORT command successful. 150 Opening ASCII mode data connection for /bin/ls. total 168 drwxrwxr-x 24 232 19 1024 Dec 4 19:40 . drwxr-xr-x 31 672 anon-ftp 1024 Dec 8 14:17 .. drwxrwxr-x 3 232 19 512 Dec 4 19:34 CAD drwxrwxr-x 3 232 19 1024 Dec 4 19:36 Internet -rw-rw-r-- 1 232 19 7570 Jul 9 14:58 MANUALIN.TXT drwxrwxr-x 2 232 19 512 Dec 4 19:36 WordProc -rwxrwxr-x 1 232 19 47981 Jun 29 1995 aaplay.exe drwxrwxr-x 2 232 19 512 Dec 4 19:40 adstuff drwxrwxr-x 2 232 19 512 Dec 4 19:40 brady drwxrwxr-x 2 232 19 1536 Dec 4 19:36 database -rwxr-xr-x 1 19 19 42 Dec 20 1996 erp drwxrwxr-x 2 232 19 1024 Dec 4 19:37 games