public final class Ls extends Object
NAME
ls - list directory contents
SYNOPSIS
ls | |
ls <args> | |
ls <files> | |
ls [-ahlRrt] | |
ls [-ahlRrt] <files> | |
ls [-ahlRrt] <paths> |
See Ls.Interface
for the corresponding command signature methods.
DESCRIPTION
For each operand that names a file of a type other than directory or symbolic link to a directory, ls
writes the name of the file as well as any requested, associated information. For each operand that names a file of type directory, ls
writes the names of files contained within the directory as well as any requested, associated information. If the -l option is specified, for each operand that names a file of type symbolic link to a directory, ls
writes the name of the file as well as any requested, associated information. If the -l option is not specified, for each operand that names a file of type symbolic link to a directory, ls
writes the names of files contained within the directory as well as any requested, associated information.
If no operands are specified, ls
writes the contents of the current directory. If more than one operand is specified, ls
writes non-directory operands first; it sorts directory and non-directory operands separately according to the name of the file or directory.
TODO The ls
utility detects infinite loops; that is, entering a previously visited directory that is an ancestor of the last file encountered. When it detects an infinite loop, ls
aborts the recursion.
NOTES
Options
The following options are supported:
-a | --allFiles | Lists all files in the given directory, including hidden files (those whose names start with \".\" in Unix). By default, these files are excluded from the list. | |||
-h | --humanReadable | Print sizes in human readable format. (e.g., 1K, 234M, 2G, etc.) | |||
-l | --longFormat | Long format, displaying file types, permissions, number of hard links, owner, group, size, date, and filename. | |||
-R | --recurseSubdirs | Recursively lists subdirectories encountered. | |||
-r | --reverseOrder | Reverses the order of the sort to get reverse collating sequence or oldest first. | |||
-t | --timeSorted | Sorts with the primary key being time modified (most recently modified first) and the secondary key being filename in the collating sequence. |
OPERANDS
The following operands are supported:
<files> | : | java.io.File... | The files or directories used as starting point for the listing; relative paths are not resolved (use the string path argument to enable relative path resolving based on the current working directory). | ||
<paths> | : | String... | The files or directories used as starting point for the listing; wildcards * and ? are supported; relative paths are resolved on the basis of the current working directory. | ||
<args> | : | String... | String arguments defining the options and operands for the command. Options can be specified by acronym (with a leading dash "-") or by long name (with two leading dashes "--"). Operands other than the default "--paths" operand have to be prefixed with the operand name (e.g. "--count" for a subsequent count operand value). | ||
<options> | : | LsOptions | The options defining the output format. |
Modifier and Type | Class and Description |
---|---|
static interface |
Ls.Interface<R>
Interface defining all method signatures for the "ls" command.
|
public static final String NAME
public static final LsOptionSets Options
a
, h
, l
, R
, r
, t
.
-a | --allFiles | Lists all files in the given directory, including hidden files (those whose names start with \".\" in Unix). By default, these files are excluded from the list. | |||
-h | --humanReadable | Print sizes in human readable format. (e.g., 1K, 234M, 2G, etc.) | |||
-l | --longFormat | Long format, displaying file types, permissions, number of hard links, owner, group, size, date, and filename. | |||
-R | --recurseSubdirs | Recursively lists subdirectories encountered. | |||
-r | --reverseOrder | Reverses the order of the sort to get reverse collating sequence or oldest first. | |||
-t | --timeSorted | Sorts with the primary key being time modified (most recently modified first) and the secondary key being filename in the collating sequence. |
Copyright © 2024. All rights reserved.