首页
首页 » 磁盘管理 » ls(list)

ls(list)

ls(list)
功能说明:列出目录内容。
语  法:ls [-1aAbBcCdDfFgGhHiklLmnNopqQrRsStuUvxX][-I <范本样式>][-T <跳格字数>][-w <每列字符数>][--block-size=<区块大小>][--color=<使用时机>][--format=<列表格式>][--full-time][--help][--indicator-style=<标注样式>][--quoting-style=<引号样式>][--show-control-chars][--sort=<排序方式>][--time=<时间戳记>][--version][文件或目录...]
补充说明:执行ls指令可列出目录的内容,包括文件和子目录的名称。
参  数:
  -1   每列仅显示一个文件或目录名称。
  -a或--all   下所有文件和目录。
  -A或--almost-all   显示所有文件和目录,但不显示现行目录和上层目录。
  -b或--escape   显示脱离字符。
  -B或--ignore-backups   忽略备份文件和目录。
  -c   以更改时间排序,显示文件和目录。
  -C   以又上至下,从左到右的直行方式显示文件和目录名称。
  -d或--directory   显示目录名称而非其内容。
  -D或--dired   用Emacs的模式产生文件和目录列表。
  -f   此参数的效果和同时指定"aU"参数相同,并关闭"lst"参数的效果。
  -F或--classify   在执行文件,目录,Socket,符号连接,管道名称后面,各自加上"*","/","=","@","|"号。
  -g   次参数将忽略不予处理。
  -G或--no-group   不显示群组名称。
  -h或--human-readable   用"K","M","G"来显示文件和目录的大小。
  -H或--si   此参数的效果和指定"-h"参数类似,但计算单位是1000Bytes而非1024Bytes。
  -i或--inode   显示文件和目录的inode编号。
  -I<范本样式>或--ignore=<范本样式>   不显示符合范本样式的文件或目录名称。
  -k或--kilobytes   此参数的效果和指定"block-size=1024"参数相同。
  -l   使用详细格式列表。
  -L或--dereference   如遇到性质为符号连接的文件或目录,直接列出该连接所指向的原始文件或目录。
  -m   用","号区隔每个文件和目录的名称。
  -n或--numeric-uid-gid   以用户识别码和群组识别码替代其名称。
  -N或--literal   直接列出文件和目录名称,包括控制字符。
  -o   此参数的效果和指定"-l" 参数类似,但不列出群组名称或识别码。
  -p或--file-type   此参数的效果和指定"-F"参数类似,但不会在执行文件名称后面加上"*"号。
  -q或--hide-control-chars   用"?"号取代控制字符,列出文件和目录名称。
  -Q或--quote-name   把文件和目录名称以""号标示起来。
  -r或--reverse   反向排序。
  -R或--recursive   递归处理,将指定目录下的所有文件及子目录一并处理。
  -s或--size   显示文件和目录的大小,以区块为单位。
  -S   用文件和目录的大小排序。
  -t   用文件和目录的更改时间排序。
  -T<跳格字符>或--tabsize=<跳格字数>   设置跳格字符所对应的空白字符数。
  -u   以最后存取时间排序,显示文件和目录。
  -U   列出文件和目录名称时不予排序。
  -v   文件和目录的名称列表以版本进行排序。
  -w<每列字符数>或--width=<每列字符数>   设置每列的最大字符数。
  -x   以从左到右,由上至下的横列方式显示文件和目录名称。
  -X   以文件和目录的最后一个扩展名排序。
  --block-size=<区块大小>   指定存放文件的区块大小。
  --color=<列表格式>   培植文件和目录的列表格式。
  --full-time   列出完整的日期与时间。
  --help   在线帮助。
  --indicator-style=<标注样式>   在文件和目录等名称后面加上标注,易于辨识该名称所属的类型。
  --quoting-syte=<引号样式>   把文件和目录名称以指定的引号样式标示起来。
  --show-control-chars   在文件和目录列表时,使用控制字符。
  --sort=<排序方式>   配置文件和目录列表的排序方式。
  --time=<时间戳记>   用指定的时间戳记取代更改时间。
  --version   显示版本信息。

ls

ls [options] [names]

List contents of directories. If no names are given, list the files in the current directory. With one or more names, list files contained in a directory name or that match a file name. names can include filename metacharacters. The options let you display a variety of information in different formats. The most useful options include -F, -R, -l, and -s. Some options don't make sense together (e.g., -u and -c).

Options

-1, --format=single-column

Print one entry per line of output.

-a, --all

List all files, including the normally hidden files whose names begin with a period.

-b, --escape

Display nonprinting characters in octal and alphabetic format.

-c, --time-ctime, --time=status

List files by status change time (not creation/modification time).

--color =when

Colorize the names of files depending on the type of file. Accepted values for when are never, always, or auto.

-d, --directory

Report only on the directory, not its contents.

-f

Print directory contents in exactly the order in which they are stored, without attempting to sort them.

--full-time

List times in full, rather than using the standard abbreviations.

-g

Long listing like -l, but don't show file owners.

-h

Print sizes in kilobytes and megabytes.

--help

Print a help message and then exit.

-i, --inode

List the inode for each file.

--indicator-style=none

Display filenames without the flags assigned by -p or -f (default).

-k, --kilobytes

If file sizes are being listed, print them in kilobytes. This option overrides the environment variable POSIXLY_CORRECT.

-l, --format=long, --format=verbose

Long format listing (includes permissions, owner, size, modification time, etc.).

-m, --format=commas

Merge the list into a comma-separated series of names.

-n, --numeric-uid-gid

Like -l, but use group ID and user ID numbers instead of owner and group names.

-o

Long listing like -l, but don't show group information.

-p, --filetype, --indicator-style=file-type

Mark directories by appending / to them.

-q, --hide-control-chars

Show nonprinting characters as ? (default for display to a terminal).

-r, --reverse

List files in reverse order (by name or by time).

-s, --size

Print file size in blocks.

--show-control-chars

Show nonprinting characters verbatim (default for printing to a file).

--si

Similar to -h, but uses powers of 1,000 instead of 1,024.

-t, --sort=time

Sort files according to modification time (newest first).

-u, --time=atime, --time=access, --time=use

Sort files according to file-access time.

--version

Print version information on standard output, then exit.

-x, --format=across, --format=horizontal

List files in rows going across the screen.

-v, --sort=version

Interpret the digits in names such as file.6 and file.6.1 as versions, and order filenames by version.

-w, --width=n

Format output to fit n columns.

-A, --almost-all

List all files, including the normally hidden files whose names begin with a period. Does not include the . and .. directories.

-B, --ignore-backups

Do not list files ending in ~ unless given as arguments.

-C, --format=vertical

List files in columns (the default format).

-D, --dired

List in a format suitable for Emacs dired mode.

-F, --classify, --indicator-style=classify

Flag filenames by appending / to directories, * to executable files, @ to symbolic links, | to FIFOs, and = to sockets.

-G, --no-group

In long format, do not display group name.

-H, --dereference-command-line

When symbolic links are given on the command line, follow the link and list information from the actual file.

-I, --ignore pattern

Do not list files whose names match the shell pattern pattern, unless they are given on the command line.

-L, --dereference

List the file or directory referenced by a symbolic link rather than the link itself.

-N, --literal

Display special graphic characters that appear in filenames.

-Q, --quote-name

Quote filenames with "; quote nongraphic characters.

-R, --recursive

List directories and their contents recursively.

-Rfile, --reload-state file

Load state from file before starting execution.

-S, --sort=size

Sort by file size, largest to smallest.

-U, sort=none

Do not sort files.

-X, sort=extension

Sort by file extension, then by filename.