dir

Zen and the Art of the Internet

Go to the Table of Contents. Visit Gifcom

 dir
At the ftp> prompt, you can type a number of commands to perform
various functions.  One example is dir---it will list the files
in the current directory. Continuing the example from above:
 
ftp> dir
 
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 3116
drwxr-xr-x  2 7        21            512 Nov 21  1988 .forward
-rw-rw-r--  1 7        11              0 Jun 23  1988 .hushlogin
drwxrwxr-x  2 0        21            512 Jun  4  1990 Census
drwxrwxr-x  2 0        120           512 Jan  8 09:36 ClariNet
                ... etc etc ...
-rw-rw-r--  1 7        14          42390 May 20 02:24 newthisweek.Z
                ... etc etc ...
-rw-rw-r--  1 7        14        2018887 May 21 01:01 uumap.tar.Z
drwxrwxr-x  2 7        6            1024 May 11 10:58 uunet-info
 
226 Transfer complete.
5414 bytes received in 1.1 seconds (4.9 Kbytes/s)
ftp>
 
The file newthisweek.Z was specifically included because we'll
be using it later.  Just for general information, it happens to be a
listing of all of the files added to UUNET's archives during the past
week.
 
The directory shown is on a machine running the Unix operating
system---the dir command will produce different results on other
operating systems (e.g. TOPS, VMS, et al.).  Learning to recognize
different formats will take some time.  After a few weeks of
traversing the Internet, it proves easier to see, for example, how
large a file is on an operating system you're otherwise not acquainted
with.
 
With many FTP implementations, it's also possible to take the output
of dir and put it into a file on the local system with
 
ftp> dir n* outfilename
 
the contents of which can then be read outside of the live FTP
connection; this is particularly useful for systems with very long
directories (like ftp.uu.net).  The above example would put the
names of every file that begins with an n into the local file
outfilename.