-->

Previous | Table of Contents | Next

Page 197


drwxrwxr-x   4 232      19           512 Dec  4 19:37 general

drwxrwxr-x   2 232      19          1024 Dec  4 19:37 graphics-dtp

drwxrwxr-x   2 232      19           512 Dec  4 19:37 macintosh

drwxrwxr-x   2 232      19           512 Dec  4 19:40 mlr

drwxrwxr-x   3 232      19           512 Dec  4 19:37 multimedia

lrwxrwxrwx   1 root     other         13 Dec  4 19:34 net-cd -> ../que/net-cd

drwxrwxr-x   2 232      19           512 Dec  4 19:37 network-comms

drwxrwxr-x   2 232      19          1024 Dec  4 19:37 news-releases

drwxrwxr-x   2 232      19           512 Dec  4 19:38 operating-sys

drwxrwxr-x  35 232      19          2560 Dec  4 19:39 programming

drwxrwxr-x   2 232      19           512 Dec  4 19:39 spreadsheet

drwxrwxr-x   2 232      19           512 Dec  4 19:40 temp

drwxrwxr-x   2 232      19          1024 Dec  4 19:39 utilities

drwxrwxr-x   2 232      19           512 Dec  4 19:40 vrml

drwxrwxr-x   2 232      19           512 Dec  4 19:40 windows-95

drwxrwxr-x   9 232      19           512 Dec  4 19:40 windows-utilities

226 Transfer complete.

ftp> cd operating-sys

250 CWD command successful.

ftp> ls

200 PORT command successful.

150 Opening ASCII mode data connection for /bin/ls.

total 21836

drwxrwxr-x   2 232      19           512 Dec  4 19:38 .

drwxrwxr-x  24 232      19          1024 Dec  4 19:40 ..

-rw-rw-r--   1 232      19       1061074 Jun  5  1997 bjsa200.exe

-rw-rw-r--   1 232      19           660 Jun  5  1997 bjsa200.txt

-rwxr-xr-x   1 19       19       1228592 Apr 22  1997 diskeepr.zip

-rw-rw-r--   1 232      19        308263 Aug 21 20:26 err6000.exe

-rw-r--r--   1 232      19         35930 Dec 20  1994 inidoc.zip

-rw-r--r--   1 232      19        301250 Dec 20  1994 iniexe.zip

-rw-rw-r--   1 232      19        491792 Jul  1 19:37 oleaut32.dll

-rw-rw-r--   1 232      19         47616 Nov 21  1995 os2errat.doc

-rw-rw-r--   1 232      19       1990677 Jun  5  1997 patch.zip

-rwxr-xr-x   1 19       19         29660 Apr 22  1997 pg.exe

-rw-r--r--   1 232      19         15583 Dec 20  1994 shutdo.zip

-rwxr-xr-x   1 19       19          5265 Apr 22  1997 stub.exe

-rwxr-xr-x   1 19       19       1406264 Apr 22  1997 tapedisk.exe

-rw-rw-r--   1 232      19         12968 Apr 23  1996 uslinux.txt

-rwxr-xr-x   1 19       19       4139587 Apr 22  1997 website.exe

226 Transfer complete.

ftp> ascii

200 Type set to A.

ftp> get uslinux.txt

local: uslinux.txt remote: uslinux.txt

200 PORT command successful.

150 Opening ASCII mode data connection for uslinux.txt (12968 bytes).

226 Transfer complete.

13294 bytes received in 5.86 secs (2.2 Kbytes/sec)

ftp>

ftp> bye

221 Goodbye.

#

This sample session shows that I specified the ftp server at Macmillan as the host computer I wanted to connect to and retrieve files. By convention, many system administrators create

Page 198

and maintain a user called ftp, and a directory called ftp, which, although it does not require no password, does require you to enter a mail address in the form of user@somewhere.com. The location of the ftp directory may differ, but if you examine the /etc/passwd file for your Linux system, you'll find an ftp user with a directory under the /home directory, for example:


ftp:*:14:50:FTP User:/home/ftp:

This /etc/passwd entry shows that people can connect to your system (if you're on a network or have enabled user dial-in logins). By convention, when you use the ftp program to connect to other computers, you enter your username at the Name: prompt as anonymous, followed by your email address as the password.

You can see that, after I logged in, I first listed the current directory, then changed directory to the pub directory. After listing that directory, I changed to the software directory, then changed directories to the operating-sys directory. If I had known the full path to the file I wanted, I could have specified that pathname in a single cd command, for example:


> cd pub/software/operating-sys

I then enabled the ftp command's ASCII transfer mode, retrieved the file uslinux.txt with the get command, and then logged off and exited the ftp program with the bye command. As you can see, using the ftp command is not hard and is an easy way to retrieve files.

You can also open an anonymous ftp connection to your own computer to demonstrate how ftp works without having an Internet connection available. You can specify the hostname of your computer, which you can get with the hostname command, or by using your computer's Internet Protocol address, for example:


# hostname

localhost.localdomain

# ftp localhost

Connected to localhost.

220 localhost FTP server (Version wu-2.4.2-academ[BETA-12]

Â(1) Wed Mar 5 12:37:21 EST 1997) ready.

Name (localhost: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 6

drwxr-xr-x   6 root     root         1024 Nov 28 21:25 .

drwxr-xr-x   6 root     root         1024 Nov 28 21:25 ..

d--x--x--x   2 root     root         1024 Nov 28 21:25 bin

d--x--x--x   2 root     root         1024 Nov 28 21:25 etc

drwxr-xr-x   2 root     root         1024 Nov 28 21:25 lib

dr-xr-sr-x   2 root     ftp          1024 Mar  3  1997 pub

Page 199


226 Transfer complete.

ftp > bye

221 Goodbye.

#

You can also log into other computers using an assigned username and password, but for this example, I'll use my own system:


# ftp 127.0.0.0

Connected to 127.0.0.0.

220 localhost FTP server (Version wu-2.4.2-academ[BETA-12](1)

 Wed Mar 5 12:37:21 EST 1997) ready.

Name (127.0.0.0:bball): bball

331 Password required for bball.

Password:

230 User bball logged in.

Remote system type is UNIX.

Using binary mode to transfer files.

ftp> ls documents

200 PORT command successful.

150 Opening ASCII mode data connection for /bin/ls.

total 62

drwxrwxr-x   2 bball    bball        1024 Dec 11 08:46 .

drwxrwxr-x  14 bball    bball        2048 Dec 11 13:39 ..

-rw-rw-r--   1 bball    bball        5289 Oct 23 12:46 FCFCU102397.aw

-rw-rw-r--   1 bball    bball        5381 Nov 24 15:00 IRS112497.aw

-rw-rw-r--   1 bball    bball        4693 Dec  3 20:37 book.as

-rw-rw-r--   1 bball    bball        5852 Oct 30 10:13 compound.as

-rw-r--r--   1 bball    bball       14820 Dec 11 08:46 invest.as

-rw-r--r--   1 bball    bball        6288 Dec  7 20:39 invest.dif

-rw-r--r--   1 bball    bball        2883 Dec  7 20:40 invest.txt

-rw-rw-r--   1 bball    bball        9436 Dec  7 20:41 sc.txt

226 Transfer complete.

ftp> bye

221 Goodbye.

#

In this example, after logging in with my system username and password, I ended up in my home directory, instead of the default ftp directory. If you have an open PPP connection with your ISP, and other users know your computer's IP address, you and other users can access your system's files and upload and download files.

Downloading with the ncftp Command

The ncftp command, found under the /usr/bin directory, is much like the original ftp command, but features some unique improvements, such as

Previous | Table of Contents | Next