ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahz_5.4.0.1/ls.htm

318 lines
8.6 KiB
HTML
Raw Permalink Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content=
"text/html; charset=utf-8">
<title>ls - List directory contents</title>
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</HEAD>
<body bgcolor="#FFFFFF">
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h2>ls - List directory contents</h2>
<strong>Synopsis</strong>
<p><strong>ls [-ACFLRSTacdfiloqrstu1]</strong> [<em>file
...</em>]</p>
<p><strong>Description</strong></p>
<p>For each operand that names a <em>file</em> of a type other than
directory, <strong>ls</strong> displays its name as well as any
requested, associated information. For each operand that names a
file of type directory, <strong>ls</strong> displays the names of
files contained within that directory, as well as any requested,
associated information.</p>
<p>If no operands are given, the contents of the current directory
are displayed. If more than one operand is given, non-directory
operands are displayed first; directory and non-directory operands
are sorted separately and in lexicographical order.</p>
<p><strong>Options</strong></p>
<dl>
<dt><strong>-A</strong></dt>
<dd>List all entries except for "." and "..".</dd>
<dt><strong>-C</strong></dt>
<dd>Force multi-column output; this is the default when output is
to a terminal.</dd>
<dt><strong>-F</strong></dt>
<dd>Display a slash (/) immediately after each path name that is a
directory, an asterisk (*) after each that is executable, and an at
sign (@) after each symbolic link.</dd>
<dt><strong>-L</strong></dt>
<dd>If argument is a symbolic link, list the file or directory the
link references rather than the link itself.</dd>
<dt><strong>-R</strong></dt>
<dd>Recursively list subdirectories.</dd>
<dt>
<strong>-S</strong></dt>
<dd>Display the CCSID attribute for the file.</dd>
<dt><strong>-T</strong></dt>
<dd>Display complete time information for the file, including
month, day, hour, minute, second, and year when the <strong>
-l</strong> option is also specified.</dd>
<dt><strong>-a</strong></dt>
<dd>Include directory entries whose names begin with a dot
(.).</dd>
<dt><strong>-c</strong></dt>
<dd>Use time when file status was last changed for sorting or
printing.</dd>
<dt><strong>-d</strong></dt>
<dd>Directories are listed as plain files (not searched
recursively) and symbolic links in the argument list are not
indirected through.</dd>
<dt><strong>-f</strong></dt>
<dd>Output is not sorted.</dd>
<dt><strong>-i</strong></dt>
<dd>For each file, print the file's file serial number (inode
number).</dd>
<dt><strong>-l</strong></dt>
<dd>(Lowercase letter `ell.') List in long format. See Extended
Description below for details. If the output is to a terminal, a
total sum for all the file sizes is output on a line before the
long listing.</dd>
<dt><strong>-o</strong></dt>
<dd>Include the file flags in a long (<strong>-l</strong>)
output.</dd>
<dt><strong>-q</strong></dt>
<dd>Force printing of non-graphic characters in file names as the
question mark (?) character. This is the default when output is to
a terminal.</dd>
<dt><strong>-r</strong></dt>
<dd>Reverse the order of the sort to get reverse lexicographical
order or the oldest entries first.</dd>
<dt><strong>-s</strong></dt>
<dd>Display the number of bytes actually allocated for each file,
in units of 1024 bytes, where partial units are rounded up to the
next integer value.</dd>
<dt><strong>-t</strong></dt>
<dd>Sort by time modified (most recently modified first) before
sorting the operands by lexicographical order.</dd>
<dt><strong>-u</strong></dt>
<dd>Use time of last access, instead of last modification of the
file for sorting (-t) or printing (-l).</dd>
<dt><strong>-1</strong></dt>
<dd>(The numeric digit one) Force output to be one entry per line.
This is the default when output is not to a terminal.</dd>
</dl>
<p>The <strong>-1</strong>, <strong>-C</strong>, and <strong>
-l</strong> options all override each other. The last one specified
determines the format used.</p>
<p>The <strong>-c</strong>, and <strong>-u</strong> options
override each other. The last one specified determines the file
time used.</p>
<p>By default, <strong>ls</strong> lists one entry per line to
standard output; the exceptions are to terminals or when the
<strong>-C</strong> option is specified.</p>
<p>File information is displayed with one or more blanks separating
the information associated with the <strong>-i</strong>, <strong>
-s</strong>, <strong>-l</strong>, and <strong>-S</strong>
options.</p>
<p><strong>Extended Description</strong></p>
<p>If the <strong>-l</strong> option is specified, the following
long format information is displayed for each file:</p>
<ul>
<li>file mode,</li>
<li>number of links,</li>
<li>owner name,</li>
<li>group name,</li>
<li>number of bytes in the file,</li>
<li>time the file was last modified, and</li>
<li>the path name.</li>
</ul>
<p>If the file was modified
within six months of the current date, the time is displayed as the
abbreviated month, day-of-month, hour, and minute. Otherwise the
time is displayed as the abbreviated month, day-of-month, and
four-digit year.</p>
<p>In addition, for each directory whose contents are displayed,
the total number of bytes used by the files in the directory is
displayed on a line by itself immediately before the information
for the files in the directory.</p>
<p>If the owner or group names are not a known user or group name
the numeric identifiers are displayed.</p>
<p>If the file is a character special or block special file, the
major and minor device numbers for the file are displayed in the
size field. If the file is a symbolic link the pathname of the
linked-to file is preceded by "-&gt;".</p>
<p>The file mode consists of the entry type, owner permissions,
group permissions, and other permissions. The entry type character
describes the type of file, as follows:</p>
<ul>
<li>b for a block special file.</li>
<li>c for a character special file.</li>
<li>d for a directory.</li>
<li>l for a symbolic link.</li>
<li>p for a pipe.</li>
<li>s for a socket.</li>
<li>- for a regular file.</li>
</ul>
<p>The owner permissions, group permissions, and other permissions
are each three characters. Each field has three character
positions:</p>
<ul>
<li>For the first position, if the value is r, the file is readable. If the value
is -, it is not readable.</li>
<li>For the second position, if the value is w, the file is writable. If the
value is -, it is not writable.</li>
<li>For the third position,
<ul>
<li>If the value is S for the owner permissions, the set-user-ID mode is set.
If the value is S for the group permissions, the set-group-ID mode is set.</li>
<li>If the value is s for the owner permissions, the file is executable and the
set-user-ID mode is set. If the value is s for the group permissions, the file
is executable and the set-group-ID mode is set.</li>
<li>If the value is x, the file is executable or the directory
is searchable.</li>
<li>If the value is -, the object is not executable or searchable.</li>
</ul>
</li>
</ul>
<strong>Environment Variables</strong>
<p><strong>ls</strong> is affected by the following environment
variables:</p>
<dl>
<dt><strong>COLUMNS</strong></dt>
<dd>If this variable contains a string representing a decimal
integer, it is used as the column position width for displaying
multiple-text-column output. The <strong>ls</strong> utility
calculates how many path name text columns to display based on the
width provided. See the <strong>-C</strong> option.</dd>
</dl>
<p><strong>Exit Status</strong></p>
<ul>
<li>0 on success</li>
<li>&gt;0 if an error occurs.</li>
</ul>
<p><strong>Related information</strong></p>
<ul>
<li><a href="chgrp.htm">chgrp - Change file group
permission</a></li>
<li><a href="chmod.htm">chmod - Change file modes
(permissions)</a></li>
<li><a href="chown.htm">chown - Change file ownership</a></li>
<li><a href="cp.htm">cp - Copy files</a></li>
<li><a href="ln.htm">ln - Link files</a></li>
<li><a href="mkdir.htm">mkdir - Make directories</a></li>
<li><a href="mv.htm">mv - Move files</a></li>
<li><a href="rm.htm">rm - Remove directory entries</a></li>
<li><a href="rmdir.htm">rmdir - Remove directories</a></li>
</ul>
<strong>Examples</strong>
<ol>
<li>Display the list of files in the current directory using the
long format.
<pre>
ls -l
</pre>
</li>
<li>Display all date and time details for the file "myfile".
<pre>
ls -lT myfile
-rwxrwxrwx 1 abbey 0 592 Sep 12 22:47:01 1998 myfile
</pre>
</li>
</ol>
<!-- end ibmbody========================================================= -->
</body>
</html>