To Index

 Documented in Volume 1 of the UNIX Programmers Manual.


 % ls /usr/smith/bin
  lists files contained in the directory /usr/smith/bin


 % ls -l helpfile
  -rwxrw-r-x  2 kemp         14336 Jul 25 13:22 helpfile

  will list the long-format information about the file named 'helpfile'.
     This shows an ordinary file (-), and user kemp has read, write and execute
  permissions, his group has read and write permissions, and anyone at all can
  read or execute the file.
      The file has two links and is owned by user `kemp', it is 14336 bytes
  long, and was last modified at 1:22PM on July 25th of this year
  (files older than a year are marked with month and year).
      The file's name is 'helpfile'.

  The fields of long ls output appear in this order:
  
  file-modes  link  owner  group  size  access-date  filename
  
      The file-modes appears as ten characters in a row, representing
  graphically the ten pertinent fields of the file's modes.
      The first character is the file type;
 	d for directory,
 	- for ordinary file,
 	s for symbolic link.

      The next nine characters taken together comprise three sub-fields to
  indicate access-permissions for the file:
  	-	means no permission
 	r	means read-only permission is set
 	w	means write permission is set
 	x	means execute permission is set
      The first subfield of three letters shows the read, write and execute
  permissions for the file's OWNER.
      The next subfield of three letters shows permissions for members of the
  file's GROUP.
      The last subfield of three characters shows the permissions for
  OTHER users (anyone not in the two groups above).
  
      Size is always in characters.  Access date is date of most recent
  modification.

      ls attempts to put its output in as many columns as possible.
  If you specify long output format, the output will be one file
  per line.



 % ls -RFC | pr
  when invoked in your login directory, will generate a nicely formatted
  list of all your directories and files within them.


 % ls -F
  will format each type of file entry prior to listing it


 % ls -a
  will do a short format list of all files, even 'dot-files'.


 % ls -ad .*
  will list all and only files whose names start with a period ("dotfiles").
  (This includes the files named . and .. which are 'the present directory'
  and 'parent directory', respectively.)

  From: schoch@ucbvax.ARPA (Steve Schoch) uhpgvax!islenet!dual!ucbvax!schoch

  Subject: Re: Funny file names

    PROBLEM: one (by mistake) creates a file called `ctl-foo' and one
  didn't know that this was happening.  The next time they did an `ls'
  of that directory they'd get a `?' and it would be impossible to remove
  because they don't know the name.

    SOLUTION: you can say

 	% ls | cat -v

  since ls will print the control characters when its output is not a terminal.

To Index