ls - list file/directory information


ls [-1RSacdfiklnrstu] [file ...]


This programs lists information about files and directories. If it is invoked without file/directory name arguments, it lists the contents of the current directory. Otherwise, ls lists information about the files and information about the contents of the directories (but see -d). Furthermore, without any option arguments ls justs lists the names of files and directories. All files are listed before all directories. The default sort order is ascending ASCII on filename.


The BSD options '1ACFLRSTWacdfgiklmnopqrstux' are recognized, but only '1RSacdfiklnrstu' are implemented:


List entries 1 per line (default if output is not a tty).


Recursively list the contents of all directories, breadth-first.


Sort descending by size.


List all files (normally files starting with '.' are ignored).


Sort by decending last modification time of inode.


Do not list directory contents.


Do not sort -- list in whatever order files/directories are returned by the directory read function.


List file inode number. (Doesn't mean much on non-inode systems.)


When used with -s, list file/directory size in 1024-byte blocks.


Long format listing of mode -- # of links, owner name, group name, size in bytes, time of last modification, and name.


List numeric uid and gid (default on platforms without getpwuid()).


Reverse sorting order.


List file/directory size in 512-byte blocks. (May not mean much on non-Unix systems.)


Sort by decending last modification time.


Sort by decending last access time.



The file metadata from stat() is used, which may not necessarily mean much on non-Unix systems. Specifically, the uid, gid, inode, and block numbers may be meaningless (or less than meaningful at least).

The -l option does not yet list the major and minor device numbers for special files, but it does list the value of the 'dev' field as 2 hex 16-bit words. Doing this properly would probably require filesystem type probing.


This Perl implementation of ls was written by Mark Leighton Fisher of Thomson Consumer Electronics,


This program is free and open software. You may use, modify, distribute, and sell this program (and any modified variants) in any way you wish, provided you do not restrict others from doing the same.