Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
LS(1)			    General Commands Manual			 LS(1)

       ls - list contents of directory

       ls [ -1AaCcdFfgikLlqRrstu ] [ file ... ]

       For  each  directory  argument, ls lists	the contents of	the directory;
       for each	file argument, ls repeats its name and any  other  information
       requested.   By	default, the output is sorted alphabetically.  When no
       argument	is given, the current directory	is listed.  When several argu-
       ments are given,	the arguments are first	sorted appropriately, but file
       arguments are processed before directories and their contents.

       The options are as follows:

       -1     force one	entry per line output format; this is the default when
	      output is	not to a terminal.

       -A     List  all	 entries  except for ``.'' and ``..''.	Always set for
	      the super-user.

       -a     List all entries;	in the absence of this option,	entries	 whose
	      names begin with a period	(.)  are not listed.

       -C     force multi-column output; this is the default when output is to
	      a	terminal.

       -c     Use time when file status	was last changed for sorting or	print-

       -d     If  argument is a	directory, list	only its name; often used with
	      -l to get	the status of a	directory.

       -f     Don't sort the output.

       -F     cause directories	to be marked with a trailing `/', sockets with
	      a	 trailing  `=',	 symbolic  links with a	trailing `@', and exe-
	      cutable files with a trailing `*'.

       -g     Include the group	ownership of the file in a long	output.

       -i     For each file, print the i-number	in the first column of the re-

       -k     Modifies	the  -s	 option,  causing  the sizes to	be reported in

       -L     If argument is a symbolic	link, list the file or	directory  the
	      link references rather than the link itself.

       -l     List  in	long  format,  giving type and mode (in	the format de-
	      scribed by strmode(3)), number of	links, owner, size  in	bytes,
	      and  time	 of last modification for each file.  If the file is a
	      special file the size field will instead contain the  major  and
	      minor  device numbers.  If the file is a symbolic	link the path-
	      name of the linked-to file is printed preceded by	``->''.

       -q     force printing of	non-graphic characters in file	names  as  the
	      character	`?'; this is the default when output is	to a terminal.

       -R     recursively list subdirectories encountered.

       -r     Reverse  the  order  of sort to get reverse alphabetic or	oldest
	      first as appropriate.

       -s     Display the sizes	of files and directories in 512-byte blocks.

       -t     Sort by time modified (latest first) instead of by name.

       -u     Use time of last access instead of last modification for sorting
	      (with the	-t option) and/or printing (with the -l	option).

       The -1, -C, and -l options all override each other; the last one	speci-
       fied determines the format used.

       The -c, and -u options override each other; the last one	specified  de-
       termines	the file time used.

       When the	sizes of the files in a	directory are listed, a	total count of
       blocks, including indirect blocks is printed.

       /etc/passwd to get user id's for	`ls -l'.
       /etc/group to get group id's for	`ls -g'.

       The option setting based	on whether the output is a teletype  is	 unde-
       sirable	as  ``ls -s''  is much different than ``ls -s |	lpr''.	On the
       other hand, not doing this setting would	make old shell	scripts	 which
       used ls almost certain losers.

3rd Berkeley Distribution	      1Q				 LS(1)


Want to link to this manual page? Use this URL:

home | help