DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Directories and files

Listing the files in a directory

There are several different commands you can use to list files. All of these are variations on the ls (list) command.

Two common ways of listing files are ls and lc. ls lists files alphabetically in a single column down your screen:

   $ ls /etc
   accton
   adfmt
   asktime
   at.mvw
   at.sys
   atstart.sys
   badtrk
   brand
   checklist
   ...
lc (list columns) lists files in columns across your screen:
   $ lc /etc
   accton      fd135ds9boot0   logger       opasswd       tpmd.perms
   adfmt       fd135ds18boot0  login        passwd        ttys
   ...
lf (list files) is another variation on ls. lf lists files in columns across your screen, marking programs with a ``*'', symbolic links with a ``@'' and directories with a ``/'':
   $ lf /etc
   accton@         gettydefs@       mkinittab@       siomake@
   adfmt@          gettydefs.orig@  mknod@           sioput@
   ...
If symbolic links are present in a directory, using the -L option as in the example below identifies the types of file being referred to by the link. The files would look like this:
   $ lf -L /etc
   accton*         gettydefs        mkinittab*       siomake*
   adfmt*          gettydefs.orig   mknod*           sioput*
   ...
See ls(C) for more information about all the file listing commands.

Try listing the contents of /bin, a directory where many UNIX commands live:

  1. Type cd /bin and press <Enter>.

  2. Type pwd and press <Enter> to check where you are.

  3. List the directory by typing lf -L and pressing <Enter>. Your screen should look something like the screen display below.

  4. Type cd and press <Enter> to return to your home directory.
    $ cd /bin
    $ pwd
    /bin
    $ lf -L
    adb*     dc*        fsck*        mesg*      restor*     tee*
    ar*      dd*        getopt*      mkdir*     restore*    telinit*
    arV*     df*        gets*        mv*        restorL*    test*
    as*      diff*      grep*        ncheck*    restorS*    time*
    asm*     diff3*     grpcheck*    newgrp*    rm*         tmp.spx.si
    asx*     dircmp*    hd*          nice*      rmdir*      touch*
    ...
    $ cd
    


Next topic: Hidden files
Previous topic: Files

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005