Linux Commands: List information about FILEs, by default the current directory.

ls-Linux Command

ls command: List information about FILEs, by default the current directory.
Syntax: ls [Options]... [File]...

Description: The ls command, which lists files, is one of the most essential utilities for Unix and Linux users and, not surprisingly, one of the oldest. In its earliest form it was called listf and was available on the Massachusetts Institute of Technology's Compatible Time Sharing System (CTSS) by July, 1961. By 1963, there were a few options that could be used to vary what listf would list:


list files, newest first

listf rev

list files, oldest first

listf file extension

give information about the named file

listf month day year

list files older than the given date

In 1965, listf was extended to recognize ``*'' as a way to list all files that matched a specific pattern, with further improvements to the pattern matching in an updated version dated January 3, 1966. The 1966 version also generalized the syntax and added lots of options, including:

listf (file)

list only files, not links

listf (auth) user

list files created by the given user

listf (made) mmddyy [mmddyy]

list files created between the given dates

listf (srec)

list by size

listf (smad)

list by date of last modification

listf (rev)

list in reverse order

listf (long)

list in long format

When CTSS was superseded by Multics, the listf command was renamed to list, which could optionally be abbreviated to ls. The early version of ls had fewer options than late versions of listf had, but still included, along with a few others:

list -all

(ls -a)

list everything

list -date_time_modified

(ls -dtm)

list by date of last modification

list -reverse

(ls -rv)

list in reverse order

When Bell Labs dropped out of Multics development in 1969 and work began on Unix, only the abbreviated name of list, ls, was retained. The First Edition (November 3, 1971) Unix manual documented the following options for ls, all of which are still available today:

ls -l  

list in long format

ls -t

sort by time modified

ls -a

list everything, including names starting with `.'

ls -s

include the size of files in the listing

ls -d

list directories' names, not their contents

By the Fifth Edition (manual page dated March 20, 1974) the list of options for ls had expanded to include:

ls -r  

list in reverse order

ls -u

use access time, not modification time

ls -i

list i-number for each file

ls -f

don't sort the listing at all

The Sixth Edition (May, 1975) added one more:

ls -g  

list group IDs in the long format listing

In May and August, 1977, Bill Joy made some modifications of his own to ls at the University of California, Berkeley, which he subsequently distributed as part of the First Berkeley Software Distribution, 1BSD. The most dramatic difference with this version of ls was that it listed files in multiple columns rather than only listing one name per line. The options to control this new format were:

ls -1  

list one name per line (no columns)

ls -c

list in columns

ls -x

list in columns, but sort across, not down

ls -q

show control characters as `?'

ls -m

everything on one line, separated by commas

There was some controversy over whether it was appropriate to include code to print in columns as an integral part of ls or whether instead the formatting into columns should be done by a separate program into which the output of ls (or any other program) could be piped.
At the beginning of 1979, Bell Labs released Seventh Edition Unix. Its version of ls did not incorporate the controversial changes, and had one new option that conflicted with a letter that Joy had also used:

ls -c  

use inode change time, not modification time

A new Berkeley version of ls, dated August 26, 1980 and released with 4.0BSD, resolved the conflict by capitalizing the option to list in columns: ls -C. It also added to what the manual was by this time calling ``an unbelievable number of options:''

ls -F  

mark directories with `/', programs with `*'

ls -R

recursively list subdirectories

ls -b

show control characters as their ASCII codes

Another revision in 4.2BSD (July 28, 1983) removed the -m, -b, and -x options -- but not before System V Release 2 had added all three of these to its own repertoire of options. They temporarily stayed alive there, but none of the three survived POSIX standardization so the 4.2BSD version of ls is essentially ls as we know it today.

Related: dir, dircolors, dirname, quota, rm, rmdir, wc

Other Linux Commands:
alias , break , builtin , cal , case , cat , cd , cfdisk , chgrp , chmod , chown , chroot , cksum , cmp , comm , continue , cp , cron , crontab , csplit , cut , date , dc , dd , declare , df , diff , diff3 , dir , dircolors , dirname , dirs , du , echo , egrep , enable , env , eval , exec , expand , export , expr , factor , false , fdformat , fdisk , fgrep , find , fmt , fold , for , fsck , function , getopts , hash , hashcharacter , head , history , hostname , id , if , import , install , join , kill , less , let , ln , local , locate , logname , logout , lpc , lpr , lprm , ls , m4 , man , mbadblocks , mkdir , mkfifo , mknod , more , mount , mtools , mv , nice , nl , nohup , passwd , paste , period , popd , pr , printf , ps , pushd , pwd , quota , quotacheck , quotactl , ram , rcp , read , readonly , return , rm , rmdir , rsync , Run , sdiff , sed , select , seq , set , shift , shopt , shutdown , sleep , sort , split , su , sum , symlink , sync , tac , tail , tar , tee , Test , time , times , top , touch , tr , traceroute , true , tsort , tty , Type , ulimit , umask , uname , Unexpand , uniq , units , unset , unshar , until , useradd , usermod , users , uuencode , watch , wc , whereis , which , while , who , xargs , yes , :
Product - Benefits - Features - How Does it Works - Pricing - SSL Certificates - Signup - Contactus - Login - Submit Resources