Problem
I have logged onto an ftp server as an anonymous user. I am
unable to use "page", "more" or other commands to list files
in a directory, a page or screen at a time. If I use "ls"
the directory listing is too long. How can I list those files
and directories so they do not scroll off the screen? Solution
Below are three methods to view file and directory listings from an ftp server.
1. This first method lists files from a directory on an
ftp site and pipes them to "more".As an example, use the following (as typed) to list files and pipe the list through "more":
ls -- |moreNote: Most anonymous ftp sites offer only limited commands and
utilities such as "ls", "pwd" and more.2. This second method allows use of local programs or scripts
to process a listing of files. Enclose local commands within a
set of double quotes ("") after listing the directory files.As an example, use the following set of commands (as typed) to sort all files listed that begin with the characters "read", either uncapitalized or capitalized:
ls -- "|grep -y read |sort"3. This third method creates a file on the local system that can be processed with local Unix commands such as "grep", "sed", "more", "tail", "sort" or "head", as well as script files.
As an example, use the following commands while logged onto an
ftp server to page through a directory listing:ftp> lcd /tmpLocal directory now /tmpftp> ls -- filesoutput to local-file: files?_ yftp> !page filesA file in the local directory /tmp will be created and named
"files". Now Unix commands such as grep, sed, more, tail
or head can be used on the file "files". See also
ftp(TC), ls(C), more(C)