svcadm(8)을 검색하려면 섹션에서 8 을 선택하고, 맨 페이지 이름에 svcadm을 입력하고 검색을 누른다.
ls(1)
ls(1) User Commands ls(1)
NAME
ls - list contents of directory
SYNOPSIS
/usr/bin/ls [-aAbcCdeEfFghHiklLmnopqrRsStuUwvVx1@] [-/ c | v | V]
[-% atime | crtime | ctime | mtime | rtime | all]
[--block-size size] [--color[=when]] [--file-type]
[--scale[=item1,item2,...]] [--si] [--time-style style]
[file]...
/usr/xpg4/bin/ls [-aAbcCdeEfFghHiklLmnopqrRsStuUwvVx1@] [-/ c | v | V]
[-% atime | crtime | ctime | mtime | rtime | all]
[--block-size size] [--color[=when]] [--file-type]
[--scale[=item1,item2,...]] [--si] [--time-style style]
[file]...
/usr/xpg6/bin/ls [-aAbcCdeEfFghHiklLmnopqrRsStuUwvVx1@] [-/ c | v | V]
[-% atime | crtime | ctime | mtime | rtime | all]
[--block-size size] [--color[=when]] [--file-type]
[--scale[=item1,item2,...]] [--si] [--time-style style]
[file]...
DESCRIPTION
For each file that is a directory, ls lists the contents of the direc‐
tory. For each file that is an ordinary file, ls repeats its name and
any other information requested. The output is sorted alphabetically by
default. When no argument is given, the current directory (.) is
listed. When several arguments are given, the arguments are first
sorted appropriately, but file arguments appear before directories and
their contents.
There are three major listing formats. The default format for output
directed to a terminal is multi−column with entries sorted down the
columns. The -1 option allows single column output and -m enables
stream output format. In order to determine output formats for the -C,
-x, and -m options, ls uses an environment variable, COLUMNS, to deter‐
mine the number of character positions available on one output line. If
this variable is not set, the terminfo(5) database is used to determine
the number of columns, based on the environment variable, TERM. If this
information cannot be obtained, 80 columns are assumed. If the -w op‐
tion is used, the argument overrides any other column width.
The mode printed when the -e, -E, -g, -l, -n, -o, -v, -V, or -@ option
is in effect consists of eleven characters. The first character can be
one of the following:
d The entry is a directory.
D The entry is a door.
l The entry is a symbolic link.
b The entry is a block special file.
c The entry is a character special file.
p The entry is a FIFO (or "named pipe") special file.
P The entry is an event port.
s The entry is an AF_UNIX address family socket.
− The entry is an ordinary file.
The next 9 characters are interpreted as three sets of three bits each.
The first set refers to the owner's permissions; the next to permis‐
sions of others in the user-group of the file; and the last to all oth‐
ers. Within each set, the three characters indicate permission to read,
to write, and to execute the file as a program, respectively. For a di‐
rectory, execute permission is interpreted to mean permission to search
the directory for a specified file. The character after permissions is
an ACL or extended attributes indicator. This character is an @ if ex‐
tended attributes are associated with the file and the -@ option is in
effect. Otherwise, this character is a plus sign (+) character if a
non-trivial ACL is associated with the file or a space character if
not.
If -/ and/or -% are in effect, then the extended system attributes are
printed when filesystem supports extended system attributes. The dis‐
play looks as follows:
$ ls -/c file
-rw-r--r-- 1 root root 0 May 10 14:17 file
{AHRSadim-u---}
$ ls -/v file
-rw-r--r-- 1 root root 0 May 10 14:17 file
{archive,hidden,readonly,system,appendonly,
nodump,immutable,av_modified,noav_quarantined,
nounlink,nooffline,nosparse,nosensitive}
$ ls -l -%all file
-rw-r--r-- 1 root root 0 May 10 14:17 file
timestamp: atime Jun 25 12:56:44 2007
timestamp: ctime May 10 14:20:23 2007
timestamp: mtime May 10 14:17:56 2007
timestamp: crtime May 10 14:17:56 2007
except that the system attributes in the second example are printed on
a single line by the actual command. See the option descriptions of the
-/ and -% option for details.
ls -l (the long list) prints its output as follows for the POSIX lo‐
cale:
-rwxrwxrwx+ 1 smith dev 10876 May 16 9:42 part2
Reading from right to left, you see that the current directory holds
one file, named part2. Next, the last time that file's contents were
modified was 9:42 A.M. on May 16. The file contains 10,876 bytes of
data. The owner of the file, or the user, belongs to the group dev
(perhaps indicating development), and their login name is smith. The
number, in this case 1, indicates the number of links to file part2
(see cp(1)). The plus sign indicates that there is an ACL associated
with the file. If the -@ option has been specified, the presence of ex‐
tended attributes supersede the presence of an ACL and the plus sign is
replaced with an 'at' sign (@). Finally, the dash and letters tell you
that user, group, and others have permissions to read, write, and exe‐
cute part2.
The execute (x) symbol occupies the third position of the three-charac‐
ter sequence. A − in the third position would have indicated a denial
of execution permissions.
The permissions are indicated as follows:
r The file is readable.
w The file is writable.
x The file is executable.
− The indicated permission is not granted.
s The set-user-ID or set-group-ID bit is on, and the correspond‐
ing user or group execution bit is also on.
S Undefined bit-state (the set-user-ID or set-group-id bit is on
and the user or group execution bit is off). For group permis‐
sions, this applies only to non-regular files.
t The 1000 (octal) bit, or sticky bit, is on (see chmod(1)), and
execution is on.
T The 1000 bit is turned on, and execution is off (undefined bit-
state).
/usr/bin/ls
l Mandatory locking occurs during access (on a regular file, the
set-group-ID bit is on and the group execution bit is off).
/usr/xpg4/bin/ls and /usr/xpg6/bin/ls
L Mandatory locking occurs during access (on a regular file, the
set-group-ID bit is on and the group execution bit is off).
For user and group permissions, the third position is sometimes occu‐
pied by a character other than x or -. s or S also can occupy this po‐
sition, referring to the state of the set-ID bit, whether it be the
user's or the group's. The ability to assume the same ID as the user
during execution is, for example, used during login when you begin as
root but need to assume the identity of the user you login as.
In the case of the sequence of group permissions, l can occupy the
third position. l refers to mandatory file and record locking. This
permission describes a file's ability to allow other files to lock its
reading or writing permissions during access.
For others permissions, the third position can be occupied by t or T.
These refer to the state of the sticky bit and execution permissions.
OPTIONS
The following options are supported:
/usr/bin/ls, /usr/xpg4/bin/ls, and /usr/xpg6/bin/ls
The following options are supported for all three versions:
-a
--all
Lists all entries, including those that begin with a dot (.), which
are normally not listed.
-A
--almost-all
Lists all entries, including those that begin with a dot (.), with
the exception of the working directory (.) and the parent directory
(..).
-b
--escape
Forces printing of non-printable characters to be in the octal \ddd
notation.
-B
--ignore-backups
Do not display any files ending with a tilde (~).
-c
Uses time of last modification of the i-node (file created, mode
changed, and so forth) for sorting (-t) or printing (-l or -n).
-C
Multi-column output with entries sorted down the columns. This is
the default output format.
-d
If an argument is a directory, lists only its name (not its con‐
tents). Often used with -l to get the status of a directory.
-e
The same as -l, except displays time to the second, and with one
format for all files regardless of age: mmm dd hh:mm:ss yyyy.
-E
The same as -l, except displays time to the nanosecond and with one
format for all files regardless of age: yyyy-mm-dd
hh:mm:ss.nnnnnnnnn (ISO 8601:2000 format).
In addition, this option displays the offset from UTC in ISO
8601:2000 standard format (+hhmm or -hhmm) or no characters if the
offset is indeterminable. The offset reflects the appropriate stan‐
dard or alternate offset in force at the file's displayed date and
time, under the current time zone.
-f
Forces each argument to be interpreted as a directory and list the
name found in each slot. This option turns off -l, -t, -s, -S, -r,
-v, -V, -/, and -%, and turns on -a. Entries are displayed in the
same order as they are in the directory.
-F
--classify
Append a symbol after certain types of files to indicate the file
type. The following symbols are used:
/ Directory
> Door file
| Named pipe (FIFO)
@ Symbolic link
= Socket
* Executable
-g
The same as -l, except that the owner is not printed.
-h
--human-readable
All sizes are scaled to a human readable format, scaled by 1024.
The -h option is equivalent to using the --scale=max,1024 option.
-H
--dereference-command-line
If an argument is a symbolic link that references a directory, this
option evaluates the file information and file type of the direc‐
tory that the link references, rather than those of the link it‐
self. However, the name of the link is displayed, rather than the
referenced directory.
-i
--inode
For each file, prints the i-node number in the first column of the
report.
-k
All sizes are printed in kbytes. Equivalent to --block-size=1024.
-l
Lists in long format, giving mode, ACL indication, number of links,
owner, group, size in bytes, and time of last modification for each
file (see above). If the file is a special file, the size field in‐
stead contains the major and minor device numbers. If the time of
last modification is greater than six months ago, it is shown in
the format 'month date year' for the POSIX locale. When the LC_TIME
locale category is not set to the POSIX locale, a different format
of the time field can be used. Files modified within six months
show 'month date time'. If the file is a symbolic link, the file‐
name is printed followed by '->' and the path name of the refer‐
enced file.
-L
--dereference
If an argument is a symbolic link, this option evaluates the file
information and file type of the file or directory that the link
references, rather than those of the link itself. However, the name
of the link is displayed, rather than the referenced file or direc‐
tory.
-m
Streams output format. Files are listed across the page, separated
by commas.
-n
--numeric-uid-gid
The same as -l, except that the owner's UID and group's GID numbers
are printed, rather than the associated character strings.
-o
--no-group
The same as -l, except that the group is not printed.
-p
Puts a slash (/) after each filename if the file is a directory.
-q
--hide-control-chars
Forces printing of non-printable characters in file names as the
character question mark (?).
-r
--reverse
Reverses the order of sort to get reverse alphabetic, oldest first,
or smallest file size first as appropriate.
-R
--recursive
Recursively lists subdirectories encountered.
-s
--size
Indicate the total number of 512 byte file system blocks consumed
by each file displayed.
When the -h or --scale option is used in conjunction with -s, the
value is converted from blocks to bytes, and is displayed in a hu‐
man readable format. When the -k or --block-size option is used in
conjunction with -s, the value is converted to blocks of the speci‐
fied size.
-S
Sort by file size (in decreasing order) and for files with the same
size by file name (in increasing alphabetic order) instead of just
by name.
-t
Sorts by time stamp (latest first) instead of by name. The default
is the last modification time. See -c, -u and -%.
-u
Uses time of last access instead of last modification for sorting
(with the -t option) or printing (with the -l option).
-U
Output is unsorted.
-v
The same as -l, except that verbose ACL information is displayed as
well as the -l output. ACL information is displayed even if the
file or directory doesn't have an ACL.
-V
The same as -l, except that compact ACL information is displayed
after the -l output.
The -V option is only applicable to file systems that support NFSv4
ACLs, such as the Solaris ZFS file system.
The format of the displayed ACL is as follows:
entry_type : permissions : inheritance_flags : access_type
entry_type is displayed as one of the following:
user:username
Additional user access for username.
group:groupname
Additional group access for group groupname.
owner@
File owner.
group@
File group owner.
everyone@
Everyone access, including file owner and file group owner.
This is not equivalent to the POSIX other class.
The following permissions, supported by the NFSv4 ACL model, are
displayed by using the -v or -V options:
read_data (r)
Permission to read the data of a file.
list_directory (r)
Permission to list the contents of a directory.
write_data (w)
Permission to modify a file's data. anywhere in the file's off‐
set range.
add_file (w)
Permission to add a new file to a directory.
append_data (p)
The ability to modify a file's data, but only starting at EOF.
add_subdirectory (p)
Permission to create a subdirectory to a directory.
read_xattr (R)
Ability to read the extended attributes of a file.
write_xattr (W)
Ability to create extended attributes or write to the extended
attribute directory.
execute (x)
Permission to execute a file.
read_attributes (a)
The ability to read basic attributes (non-ACLs) of a file.
write_attributes (A)
Permission to change basic attributes (non-ACLs) of a file.
delete (d)
Permission to delete a file.
delete_child (D)
Permission to delete a file within a directory.
read_acl (c)
Permission to read the ACL of a file.
write_acl (C)
Permission to write the ACL of a file.
write_owner (o)
Permission to change the owner of a file.
synchronize (s)
Permission to access file locally at server with synchronize
reads and writes.
-
No permission granted
The following inheritance flags, supported by the NFSv4 ACL model,
are displayed by using the -v or -V options:
file_inherit (f)
Inherit to all newly created files.
dir_inherit (d)
Inherit to all newly created directories.
inherit_only (i)
When placed on a directory, do not apply to the directory, only
to newly created files and directories. This flag requires that
either file_inherit and or dir_inherit is also specified.
no_propagate (n)
Indicates that ACL entries should be inherited to objects in a
directory, but inheritance should stop after descending one
level. This flag is dependent upon either file_inherit and/or
dir_inherit also being specified.
successful_access (S)
Indicates if an alarm or audit record should be initiated upon
successful accesses. Used with audit/alarm ACE types.
failed_access (F)
Indicates if an alarm or audit record should be initiated when
access fails. Used with audit/alarm ACE types.
inherited (I)
ACE was inherited.
-
No permission granted.
access_type is displayed as one of the following types:
alarm Permission field that specifies permissions that should
trigger an alarm.
allow Permission field that specifies allow permissions.
audit Permission field that specifies permissions that should be
audited. The PRIV_FILE_AUDIT privilege is required in or‐
der to show this ACE type.
deny Permission field that specifies deny permissions.
For example:
$ ls -dV /sandbox/dir.1
drwxr-xr-x+ 2 root root 2 Jan 17 15:09 dir.1
user:marks:r-------------:fd-----:allow
owner@:--------------:-------:deny
owner@:rwxp---A-W-Co-:-------:allow
group@:-w-p----------:-------:deny
group@:r-x-----------:-------:allow
everyone@:-w-p---A-W-Co-:-------:deny
everyone@:r-x---a-R-c--s:-------:allow
$
||||||||||||||||:||||||+ inherited access
||||||||||||||:||||||+ failed access
||||||||||||||:|||||+--success access
||||||||||||||:||||+-- no propagate
||||||||||||||:|||+--- inherit only
||||||||||||||:||+---- directory inherit
||||||||||||||:|+----- file inherit
||||||||||||||
||||||||||||||+ sync
|||||||||||||+- change owner
||||||||||||+-- write ACL
|||||||||||+--- read ACL
||||||||||+---- write extended attributes
|||||||||+----- read extended attributes
||||||||+------ write attributes
|||||||+------- read attributes
||||||+-------- delete child
|||||+--------- delete
||||+---------- append
|||+----------- execute
||+------------ write data
|+------------- read data
-w cols
--width cols
Multi-column output where the column width is forced to cols.
-x
Multi-column output with entries sorted across rather than down the
page.
-1
Prints one entry per line of output.
-@
The same as -l, except that extended attribute information over‐
rides ACL information. An @ is displayed after the file permission
bits for files that have extended attributes.
-/
The -/ option supports three option arguments c (compact mode), v
(verbose mode), and V (verbose short mode). Displays the long list‐
ing, same as -l. In addition, displays the extended system attrib‐
utes associated with the file when extended system attributes are
fully supported by the underlying file system. See the sysattr(7)
manual page for definitions of the extended system attributes.
The display characters used in compact mode (-/ c) are as follows:
tab(); lw(NaNi) lw(NaNi) lw(NaNi) lw(NaNi) Attribute NameDisplay _
archiveA hiddenH readonlyR systemS appendonlya nodumpd immutablei
av_modifiedm av_quarantinedq sparses nounlinku sensitiveT
The display in verbose mode (-/ v) uses full attribute names when
it is set and the name prefixed by no when it is not set.
The display in verbose short mode (-/ V) uses full attribute names
when it is set and nothing when it is not set.
Attributes representing timestamps - crtime and rtime - are handled
by the -% option described below, and are not listed by the -/ op‐
tion.
The display positions are as follows:
{||||||||||||||}
|||||||||||||+ T (sensitive)
|||||||||||+-- s (sparse)
||||||||||+--- O (offline)
|||||||||+---- u (nounlink)
||||||||+----- q (av_quarantined)
|||||||+------ m (av_modified)
||||||+------- i (immutable)
|||||+-------- d (nodump)
||||+--------- a (appendonly)
|||+---------- S (system)
||+----------- R (readonly)
|+------------ H (hidden)
+------------- A (archive)
-% atime | crtime | ctime | mtime | rtime | all
atime Uses the last access time of the file for sorting or
printing. Equivalent to -u.
crtime Uses the creation time of the file for sorting or print‐
ing.
ctime Uses the last modification time of the i-node (file cre‐
ated, mode changed, and so forth) for sorting or print‐
ing. Equivalent to -c.
mtime Uses the last modification time of the file contents for
sorting or printing.
rtime Uses the retention time of the file contents for sorting
or printing.
If extended system attributes are not supported, or if the user
does not have read permission on the file, or if the crtime ex‐
tended attribute is not set, crtime is treated as a synonym for
mtime.
If extended system attributes are not supported, if the user does
not have read permission on the file, or if the rtime extended at‐
tribute is not set, the retention time is not displayed.
When option argument all is specified, all available timestamps are
printed which includes atime, ctime, mtime, and on the extended
system attribute supporting file systems, crtime (create time) and
rtime (retention time). The option -% all does not affect which
timestamp is displayed in long format and does not affect sorting.
--block-size size
Display sizes in multiples of size. Size can be scaled by suffixing
one of YyZzEePpTtGgMmKk. Additionally, a B can be placed at the end
to indicate powers of 10 instead of 2. For example, 10mB means
blocks of 10000000 bytes while 10m means blocks of 10*2^20 --
10485760 -- bytes. This is mutually exclusive with the -h option.
--color[=when]
--colour[=when]
Display filenames using color on color-capable terminals. when is
an optional argument that determines when to display color output.
Possible values for when are:
always
yes
force
Always use color.
auto
tty
if-tty
Use color if a terminal is present.
no
never
none
Never use color. This is the default
See the Color Output section of this manual page for information on
how to control the output colors.
--file-type
Display a suffix after a file depending on its type, similar to the
-F option, except * is not appended to executable files.
--scale[=item1,item2,...]
All sizes are scaled to a human readable format, for example, 14K,
234M, 2.7G, or 3.0T. Scaling is done by repetitively dividing by
1024, unless otherwise specified. --scale specified without argu‐
ments enables default scaled output, and is equivalent to
--scale=max,1024. See scale(7) for a complete description of
--scale features.
--si
All sizes are scaled to a human readable format, scaled by 1000.
The --si option is equivalent to using the --scale=max,1000 option.
--time-style style
Display times using the specified style. This does not affect the
times displayed for extended attributes (-%).
Possible values for style are:
full-iso
Equivalent to -E.
long-iso
Display in YYYY-MM-DD HH:MM for all files.
iso
Display older files using YYYY-MM-DD and newer files with MM-DD
HH:MM.
locale
Use the default locale format for old and new files. This is
the default.
+FORMAT
Use a custom format. Values are the same as described in strf‐
time(3C). If a NEWLINE appears in the string, the first line is
used for older files and the second line is used for newer
files. Otherwise, the given format is used for all files.
/usr/bin/ls
-F
Marks directories with a trailing slash (/), doors with a trailing
greater-than sign (>), executable files with a trailing asterisk
(*), FIFOs with a trailing vertical bar (|), symbolic links with a
trailing "at" sign (@), and AF_UNIX address family sockets with a
trailing equals sign (=). Follows symlinks named as operands.
--file-type
Marks entries as with -F with the exception of executable files.
Executable files are not marked. Follows symlinks named as
operands.
Specifying more than one of the options in the following mutually ex‐
clusive pairs is not considered an error: -C and -l (ell), -m and -l
(ell), -x and -l (ell), -@ and -l (ell). The -l option overrides the
other option specified in each pair.
Specifying more than one of the options in the following mutually ex‐
clusive groups is not considered an error: -C and -1 (one), -H and -L,
-c and -u, and -e and -E, and -t and -S. The last option specifying a
specific timestamp (-c, -u, -% atime, -% crtime, -% ctime, and -%
mtime) determines the timestamps used for sorting or in long format
listings. The last option -t, -S, or -U determines the sorting behav‐
ior.
/usr/xpg4/bin/ls
-F
Marks directories with a trailing slash (/), doors with a trailing
greater-than sign (>), executable files with a trailing asterisk
(*), FIFOs with a trailing vertical bar (|), symbolic links with a
trailing "at" sign (@), and AF_UNIX address family sockets with a
trailing equals sign (=). Follows symlinks named as operands.
--file-type
Marks entries as with -F with the exception of executable files.
Executable files are not marked. Follows symlinks named as
operands.
Specifying more than one of the options in the following groups of mu‐
tually exclusive options is not considered an error: -C and -l (ell),
-m and -l (ell), -x and -l (ell), -@ and -l (ell), -C and -1 (one), -H
and -L, -c and -u, -e and -E, -t and -S and -U. The last option speci‐
fying a specific timestamp (-c, -u, -% atime, -% crtime, -% ctime, and
-% mtime) determines the timestamps used for sorting or in long format
listings. The last -t, -S, or -U option determines the sorting behav‐
ior.
/usr/xpg6/bin/ls
-F
Marks directories with a trailing slash (/), doors with a trailing
greater-than sign (>), executable files with a trailing asterisk
(*), FIFOs with a trailing vertical bar (|), symbolic links with a
trailing "at" sign (@), and AF_UNIX address family sockets with a
trailing equals sign (=). Does not follow symlinks named as
operands unless the -H or -L option is specified.
--file-type
Marks entries as with -F with the exception of executable files.
Executable files are not marked. Does not follow symlinks named as
operands unless the -H or -L option is specified.
Specifying more than one of the options in the following mutually ex‐
clusive pairs is not considered an error: -C and -l (ell), -m and -l
(ell), -x and -l (ell), -@ and -l (ell), -C and -1 (one), -H and -L, -c
and -u, -e and -E, -t and -S and -U. The last option specifying a spe‐
cific timestamp (-c, -u, -% atime, -% crtime, -% ctime, and -% mtime)
determines the timestamps used for sorting or in long format listings.
The last -t, -S, or -U option determines the sorting behavior.
OPERANDS
The following operand is supported:
file
A path name of a file to display information about, or of a direc‐
tory to list the contents of. If the file or directory specified is
not found, a diagnostic message is output on standard error.
COLOR OUTPUT
If color output is enabled, the environment variable LS_COLORS is
checked. If it exists, its contents are used to control the colors used
to display filenames. If it is not set, a default list of colors is
used. The format of LS_COLORS is a colon separated list of attribute
specifications. Each attribute specification is of the format
filespec=attr[;attr..]
filespec is either of the form *.SUFFIX, for example, *.jar or *.Z, or
one of the following file types:
no Normal file
fi Regular file
di Directory
ln Symbolic link
pi FIFO or named pipe
so Socket
do Door file
bd Block device
cd Character device
ex Execute bit (either user, group, or other) set
po Event port
st Sticky bit set
or Orphaned symlink
sg setgid bit set
su setuid bit set
ow world writable
tw Sticky bit and world writable
attr is a semicolon delimited list of color and display attributes
which are combined to determine the final output color. Any combination
of attr values can be specified. Possible attr values are:
00 All attributes off (default terminal color)
01 Display text in bold
04 Display text with an underscore
05 Display text in bold
07 Display text with foreground and background colors reversed
08 Display using concealed text.
One of the following values can be chosen. If multiple values are spec‐
ified, the last specified value is used.
30 Set foreground to black.
31 Set foreground to red.
32 Set foreground to green.
33 Set foreground to yellow.
34 Set foreground to blue.
35 Set foreground to magenta (purple).
36 Set foreground to cyan.
37 Set foreground to white.
39 Set foreground to default terminal color.
One of the following can be specified. If multiple values are speci‐
fied, the last value specified is used.
40 Set foreground to black.
41 Set foreground to red.
42 Set foreground to green.
43 Set foreground to yellow.
44 Set foreground to blue.
45 Set foreground to magenta (purple).
46 Set foreground to cyan.
47 Set foreground to white.
49 Set foreground to default terminal color.
On some terminals, setting the bold attribute causes the foreground
colors to be high-intensity, that is, brighter. In such cases the low-
intensity yellow is often displayed as a brown or orange color.
At least one attribute must be listed for a file specification.
The appropriate color codes are chosen by selecting the most specific
match, starting with the file suffixes and proceeding with the file
types until a match is found. The no (normal file) type matches any
file.
EXAMPLES
Example 1 Viewing File Permissions
The following example shows how to display detailed information about a
file.
% ls -l file.1
-rw-r--r-- 1 gozer staff 206663 Mar 14 10:15 file.1
The permissions string above (-rw-r--r--) describes that the file owner
has read and write permissions, the owning group has read permissions,
and others have read permissions.
The following example shows how to display detailed information about a
directory.
% ls -ld test.dir
drwxr-xr-x 2 gozer staff 2 Mar 14 10:17 test.dir
The permissions string above (drwxr-xr-x) describes that the directory
owner has read, write, and search permissions, the owning group has
read and search permissions, and others have read and search permis‐
sions.
Another example of listing file permissions is as follows:
% ls -l file.2
-rw-rwl--- 1 gozer staff 206663 Mar 14 10:47 file.2
The permissions string above (-rw-rwl---) describes that the file owner
has read and write permissions, the owning group has read and write
permissions, and the file can be locked during access.
Example 2 Displaying ACL Information on Files and Directories
The following example shows how to display verbose ACL information on a
ZFS file.
% ls -v file.1
-rw-r--r-- 1 marks staff 206663 Mar 14 10:15 file.1
0:owner@:execute:deny
1:owner@:read_data/write_data/append_data/write_xattr/write_attributes
/write_acl/write_owner:allow
2:group@:write_data/append_data/execute:deny
3:group@:read_data:allow
4:everyone@:write_data/append_data/write_xattr/execute/write_attributes
/write_acl/write_owner:deny
5:everyone@:read_data/read_xattr/read_attributes/read_acl/synchronize
:allow
The following example shows how to display compact ACL information on a
ZFS directory.
% ls -dV test.dir
drwxr-xr-x 2 marks staff 2 Mar 14 10:17 test.dir
owner@:--------------:------:deny
owner@:rwxp---A-W-Co-:------:allow
group@:-w-p----------:------:deny
group@:r-x-----------:------:allow
everyone@:-w-p---A-W-Co-:------:deny
everyone@:r-x---a-R-c--s:------:allow
The following example illustrates the ls -v behavior when listing ACL
information on a UFS file.
$ ls -v file.3
-rw-r--r-- 1 root root 2703 Mar 14 10:59 file.3
0:user::rw-
1:group::r-- #effective:r--
2:mask:r--
3:other:r--
Example 3 Printing the Names of All Files
The following example prints the names of all files in the current di‐
rectory, including those that begin with a dot (.), which normally do
not print:
example% ls -a
Example 4 Providing File Information
The following example provides file information:
example% ls -aisn
This command provides information on all files, including those that
begin with a dot (a), the i-number, the serial number of the i-node as‐
sociated with the file—printed in the left-hand column (i); the size
(in blocks) of the files, printed in the column to the right of the i-
numbers (s); finally, the report is displayed in the numeric version of
the long list, printing the UID (instead of user name) and GID (instead
of group name) numbers associated with the files.
When the sizes of the files in a directory are listed, the amount of
storage used, as described for the -s option, is printed.
Example 5 Providing Extended System Attributes Information
This command lists extended system attributes in compact mode:
example% ls -/c file
-rw-r--r-- 1 root root 0 May 10 14:17 file
{AHRSadim-u---}
This command lists extended system attributes in verbose mode. In this
example, av_quarantined is not set. When the actual command is run, the
extended system attributes will be on a single line, without the line
breaks shown here.
example% ls -/v file
-rw-r--r-- 1 root root 0 May 10 14:17 file
{archive,hidden,readonly,system,appendonly,nodump,
immutable,av_modified,noav_quarantined,nounlink,
nooffline,nosparse,nosensitive}
This example shows a file on a filesystem which does not support ex‐
tended system attributes.
example% ls -/v file
-rw-r--r-- 1 root staff 0 May 16 14:48 file
{}
This example shows a file on a filesystem which does support extended
system attributes.
example% ls -/c file
-rw-r--r-- 1 root staff 3 Jun 4 22:04 file
{A------m-----}
archive and av_modified attributes are set by default on an extended
system attribute supported file.
This example displays the timestamp as the creation time:
example% ls -/c -% crtime file
-rw-r--r-- 1 root root 0 May 10 14:17 file
{AHRSadim-u---}
This example displays the all available timestamps for a file which
does not have a retention time set:
example% ls -l -% all file
-rw-r--r-- 1 root root 0 May 10 14:17 file
timestamp: atime Jun 14 08:47:37 2007
timestamp: ctime May 10 14:20:23 2007
timestamp: mtime May 10 14:17:56 2007
timestamp: crtime May 10 14:17:56 2007
In this example the files are sorted by creation time:
example% ls -% crtime -tl file*
-rw-r--r-- 1 foo staff 3 Jun 4 22:04 file1
-rw-r--r-- 1 root root 0 May 10 14:17 file
-rw-r--r-- 1 foo staff 0 May 9 13:49 file.1
ENVIRONMENT VARIABLES
See environ(7) for descriptions of the following environment variables
that affect the execution of ls: LANG, LC_ALL, LC_COLLATE, LC_CTYPE,
LC_TIME, LC_MESSAGES, NLSPATH, and TZ.
COLUMNS Determines the user's preferred column position width for
writing multiple text-column output. If this variable con‐
tains a string representing a decimal integer, the ls
utility calculates how many path name text columns to
write (see -C) based on the width provided. If COLUMNS is
not set or is invalid, 80 is used. The column width chosen
to write the names of files in any given directory is con‐
stant. File names are not be truncated to fit into the
multiple text-column output.
LS_COLORS Determines the coloring scheme used when displaying color
output. If not set and color output is specified, a de‐
fault scheme is used. If TERM is not set, no color output
is used.
TERM Determine the terminal type. If this variable is unset or
NULL, no color output is generated regardless of the value
of the --color option.
EXIT STATUS
0 All information was written successfully.
>0 An error occurred.
ATTRIBUTES
See attributes(7) for descriptions of the following attributes:
/usr/bin/ls
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Availabilitysystem/core-os _ CSIEnabled _ Interface
StabilityCommitted _ StandardSee below.
For all options except -A, -b, -e, -E, -h, -S, -U, -v, -V, -@, -/, -%,
--all, --almost-all, --block-size, --classify, --color, --colour,
--dereference, --dereference-command-line, --escape, --file-type,
--full-time, --human-readable, --ignore-backups, --inode, --no-group,
--numeric-uid-gid, --reverse, --recursive, --scale, --si, --size, and
--time-style, see standards(7).
/usr/xpg4/bin/ls
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Availabilitysystem/xopen/xcu4 _ CSIEnabled _ Interface
StabilityCommitted _ StandardSee below.
For all options except -A, -b, -e, -E, -h, -S, -U, -v, -V, -@, -/, -%,
--all, --almost-all, --block-size, --classify, --color, --colour,
--dereference, --dereference-command-line, --escape, --file-type,
--full-time, --human-readable, --ignore-backups, --inode, --no-group,
--numeric-uid-gid, --reverse, --recursive, --scale, --si, --size, and
--time-style, see standards(7).
/usr/xpg6/bin/ls
tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
TRIBUTE VALUE _ Availabilitysystem/xopen/xcu6 _ CSIEnabled _ Interface
StabilityCommitted _ StandardSee below.
For all options except -A, -b, -e, -E, -h, -S, -U, -v, -V, -@, -/, -%,
--all, --almost-all, --block-size, --classify, --color, --colour,
--dereference, --dereference-command-line, --escape, --file-type,
--full-time, --human-readable, --ignore-backups, --inode, --no-group,
--numeric-uid-gid, --reverse, --recursive, --scale, --si, --size, and
--time-style, see standards(7).
SEE ALSO
chmod(1), cp(1), fgetattr(3C), strftime(3C), terminfo(5), acl(7), at‐
tributes(7), environ(7), fsattr(7), scale(7), standards(7), sysattr(7)
NOTES
Unprintable characters in file names can confuse the columnar output
options.
The total block count is incorrect if there are hard links among the
files.
The sort order of ls output is affected by the locale and can be over‐
ridden by the LC_COLLATE environment variable. For example, if LC_COL‐
LATE equals C, dot files appear first, followed by names beginning with
uppercase letters, followed by names beginning with lowercase letters.
But if LC_COLLATE equals en_US.ISO8859-1, then leading dots as well as
case are ignored in determining the sort order.
HISTORY
Support for the -/V option was added in the Oracle Solaris 11.4.54 re‐
lease.
Support for the --scale option was added in the Oracle Solaris 11.4.30
release.
Support for the -k, -w, -B, -U, --all, --almost-all, --block-size,
--classify, --color, --colour, --dereference-command-line, --derefer‐
ence, --escape, --file-type, --full-time, --hide-control-chars, --hu‐
man-readable, --ignore-backups, --inode, --no-group, --numeric-uid-gid,
--recursive, --reverse, --si, --size, --time-style, and --width options
was added in the Oracle Solaris 11.0.0 release, thanks to a contribu‐
tion to OpenSolaris by Jason King.
Support for the -/c, -/v, and -% options was added in the Oracle So‐
laris 11.0.0 release. See sysattr(7) for details on when support was
added for each individual system attribute.
Support for the -v and -V options was added in the Solaris 10 6/06 (Up‐
date 2) release.
The /usr/xpg6/bin/ls command, and support for the -e, -E, and -H op‐
tions, was added in the Solaris 10 3/05 release.
Support for the -h and -@ options was added in the Solaris 9 release.
The /usr/xpg4/bin/ls command was added in the Solaris 2.5 release.
Support for the -A option was added in the Solaris 2.3 release. (It had
previously been present in Solaris 1.x releases, but was not included
in 2.0 through 2.2.)
Support for the -b, -m, -n, -o, -p, and -x options was added in the So‐
laris 2.0 release.
The /usr/bin/ls command, with support for the -a, -c, -C, -d, -f, -F,
-g, -i, -l, -L, -q, -r, -R, -s, -t, -u, and -1 options, has been in‐
cluded in all Sun and Oracle releases of Solaris.
Oracle Solaris 11.4 7 October 2025 ls(1)