raw
Bind a raw character device to a block device
TLDR
Bind a raw character device to a block device
Query an existing binding instead of setting a new one
Query all bound raw devices
SYNOPSIS
ls [OPTION]... [FILE]...
OPTION: Represents one or more command-line options that modify the behavior of ls. Options typically start with a single hyphen (-) followed by a letter (e.g., -l) or two hyphens for long options (e.g., --all).
FILE: Specifies the path to a directory or file whose contents or information should be listed. If no FILE is specified, ls operates on the current directory. If a FILE is a directory, its contents are listed. If a FILE is a regular file, its information is listed.
PARAMETERS
-a, --all
Do not ignore entries starting with '.' (dot files), which are normally hidden.
-l
Use a long listing format, showing detailed information including permissions, number of hard links, owner, group, size, and modification time.
-h, --human-readable
With -l, print sizes in human-readable format (e.g., 1K, 234M, 2G) instead of bytes.
-R, --recursive
List the contents of subdirectories recursively.
-d, --directory
List directory entries themselves, rather than their contents. Useful when you want to see details about the directory itself, not what's inside it.
-t
Sort the output by modification time, with the newest files appearing first.
-r, --reverse
Reverse the order of the sort. Can be combined with -t for oldest first, or -S for smallest first.
-F, --classify
Append an indicator character to entries: '/' for directories, '*' for executables, '@' for symbolic links, '|' for FIFOs, and '=' for sockets.
-S
Sort the output by file size, with the largest files appearing first.
-1
List one file per line. This is the default output format when output is piped to another command.
DESCRIPTION
The ls command is a fundamental utility in Unix-like operating systems, used to list the contents of directories. When invoked without arguments, it displays the files and subdirectories in the current working directory.
It can be used to view detailed information about files, such as permissions, ownership, size, and modification time, using various options. ls is indispensable for navigating the file system, identifying files, and inspecting their properties, making it one of the most frequently used commands by system administrators and everyday users alike. Its output can be customized extensively to display information in different formats, sort criteria, and filter based on file types.
CAVEATS
For directories containing a very large number of files, the ls output can be extensive and difficult to parse directly without piping to tools like less or grep.
The exact output format and available options for ls can vary slightly between different implementations (e.g., GNU ls on Linux vs. BSD ls on macOS/FreeBSD), though core functionality remains consistent.
User permissions affect what ls can display. If a user lacks read permission for a directory, ls will not be able to list its contents, and if they lack execute permission for a directory, they won't be able to 'cd' into it or access its files by path, even if the files themselves are readable.
EXIT STATUS
The ls command exits with status 0 if all FILE operands were processed successfully, and a non-zero value (>0) if an error occurred. This behavior is crucial for scripting, allowing automated checks on whether the command executed without issues.
COLOR OUTPUT
Many modern ls implementations, especially GNU ls, support colored output to visually distinguish between different file types (e.g., directories in blue, executables in green, symbolic links in cyan). This feature is often controlled by the LS_COLORS environment variable and typically enabled by default via shell aliases (e.g., alias ls='ls --color=auto'
).
HISTORY
The ls command is one of the oldest and most fundamental utilities in the Unix operating system, dating back to its earliest versions developed at Bell Labs in the early 1970s. It was created as a simpler alternative to 'dir', a command on Multics. Over decades, ls has evolved, with significant enhancements added by various Unix distributions and later by the GNU Project.
GNU ls, part of the GNU Coreutils, became the standard on Linux systems, introducing many new features like colored output, human-readable sizes (-h), and more robust sorting options, making it more user-friendly and powerful than its original AT&T Unix counterpart.