Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Ls
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Behavior == When invoked with no path [[Command-line argument|argument]], <code>ls</code> lists the files of the [[working directory]]. Otherwise, it includes each specified file and each file of a specified directory. Common options include: * {{code|-a}} Includes '''a'''ll files; even those starting with <code>.</code> which on Unix-based systems are otherwise [[Hidden file and hidden directory#Unix and Unix-like environments|not included]] * {{code|-A}} Same as {{code|-a}}, but excludes the special entries <code>.</code> (working directory) and <code>..</code> (parent of working directory) * <code>-l</code> Selects the '''l'''ong output format which extends the default output of the file name with additional information including [[Unix file types|type]] (<code>-</code> for regular file, <code>d</code> for directory, <code>l</code> for [[Symbolic link|symbolic link]], <code>n</code> for [[Network filesystem|network file]], <code>s</code> for [[Network socket|socket]], <code>p</code> for [[named pipe]] (FIFO), <code>c</code> for [[Device file|character special file]], <code>b</code>for [[Device file|block special file]]), permissions, [[hard link]] count, owning user and group, size, last-modified timestamp * <code>-h</code> Output sizes as so-called '''h'''uman readable by using units of KB, MB, GB instead of bytes. This option is not part of the POSIX standard, although implemented in several systems, e.g., GNU coreutils in 1997,<ref>{{cite web |url=http://git.savannah.gnu.org/cgit/coreutils.git/commit/src/ls.c?id=b76a4533046163978f7517f9ea6d3307bfa0a98a |title=(decode_switches): -h and -H override output units. |publisher=coreutils.git |date=1997-12-31 }}</ref> FreeBSD 4.5 in 2002,<ref>{{cite web |url=https://svnweb.freebsd.org/base?view=revision&revision=88591 |title=[base] Log of /stable/10/bin/ls/ls.c |date=2001-12-28}}</ref> and Solaris 9 in 2002.<ref>{{citation |url=http://docs.oracle.com/cd/E19683-01/806-5202/6je7shk5c/index.html |title=What's New in the Solaris 9 Operating Environment |publisher=Sun Microsystems |year=2002}}</ref> * <code>-R</code> Include files of a directory tree, '''r'''ecursively * <code>-t</code> Sort the list by modification time (default sort is alphabetically) * <code>-u</code> Sort the list by last access time * <code>-c</code> Sort the list by last attribute (status) change time * <code>-r</code> Reverse the order, for example most recent time last * <code>--full-time</code> Show times down to the millisecond instead of just the minute * <code>-1</code> One entry per line * <code>-m</code> Stream format; list items across the page, separated by commas. * <code>-g</code> Include group but not owner * <code>-o</code> Include owner but not group (when combined with <code>-g</code> both group and owner are suppressed) * <code>-d</code> Show information about a directory or symbolic link, rather than the contents of a directory or the link's target * <code>-F</code> Append a "/" to directory names and a "*" to executable files
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)