列齣有關 FILE 的信息 (默認當前目錄)。
另請參閱: dircolors
ls -l
基本語法
ls [OPTION]... [FILE]...
注意:
長選項強製性參數, 對於短選項也是必需的。
按字母順序排序條目, 若未指定 -cftuvSUX 和 --sort。
退齣狀態
| 參數 | EN 解釋 | 中文翻譯 | 備注 |
|---|---|---|---|
| 0 | if OK | ||
| 1 | if minor problems (e.g., cannot access subdirectory) | 若有小問題 (如:無法訪問子目錄) | |
| 2 | if serious trouble (e.g., cannot access command-line argument) | 如果有嚴重麻煩 (如:無法訪問命令行自變量) |
| 參數 | EN 解釋 | 中文翻譯 | 備注 |
|---|---|---|---|
| -a, --all | do not ignore entries starting with. | 不忽略以 . 開頭的條目 | |
| -A, --almost-all | do not list implied . and .. | 不列齣隱含的 . 和 .. | |
| --author | with -l, print the author of each file | 采用 -l,打印每個文件的作者 | |
| -b, --escape | print C-style escapes for nongraphic characters | 打印 C 樣式轉義,對於非圖形字符 | |
| --block-size=SIZE |
scale sizes by SIZE before printing them; e.g., '--block-size=M' prints sizes in units of 1,048,576 bytes; see SIZE format below |
在打印前按 SIZE 縮放尺寸; 例如,--block-size=M 打印尺寸為 1,048,576 字節; 見 SIZE 格式 |
|
| -B, --ignore-backups | do not list implied entries ending with ~ | 不列齣以 ~ 結尾的隱含條目 | |
| -c |
with -lt: sort by, and show, ctime (time of last modification of file status information); with -l: show ctime and sort by name; otherwise: sort by ctime, newest first |
采用 -lt:按 ctime (文件狀態信息的最後修改時間) 排序並展示; 采用 -l:展示 ctime 並按名稱排序; 否則:按 ctime 排序,最新的在前 |
|
| -C | list entries by columns | 按列列齣條目 | |
| --color[=WHEN] |
colorize the output; WHEN can be 'always' (default if omitted), 'auto', or 'never'; |
著色輸齣; WHEN 可以是 always (默認,若省略) auto 或 never; |
|
| -d, --directory | list directories themselves, not their contents | 列齣目錄本身,而不是其內容 | |
| -D, --dired | generate output designed for Emacs' dired mode | 生成為 Emacs dired 模式設計的輸齣 | |
| -f | do not sort, enable -aU, disable -ls --color | 不排序,啓用 -aU,禁用 -ls --color | |
| -F, --classify | append indicator (one of */=>@|) to entries | 把指示符 (*/=>@| 之一) 追加到條目 | |
| --file-type | likewise, except do not append '*' | 同上,除瞭不追加 * | |
| --format=WORD | across -x, commas -m, horizontal -x, long -l, single-column -1, verbose -l, vertical -C | 跨 -x 逗號 -m 水平 -x 長 -l 單列 -1 冗餘 -l 垂直 -C | |
| --full-time | like -l --time-style=full-iso | 像 -l --time-style=full-iso | |
| -g | like -l, but do not list owner | 像 -l,但不列齣所有者 | |
| --group-directories-first |
group directories before files; can be augmented with a --sort option, but any use of --sort=none (-U) disables grouping |
在文件前分組目錄; 可以采用 --sort 選項進行擴充, 但 --sort=none (-U) 的任何使用都禁止分組 |
|
| -G, --no-group | in a long listing, don't print group names | 在長列齣時,不打印組名 | |
| -h, --human-readable | with -l and/or -s, print human readable sizes (e.g., 1K 234M 2G) | 采用 -l 和/或 -s,打印人類可讀尺寸 (例如 1K 234M 2G) | |
| --si | likewise, but use powers of 1000 not 1024 | 同上,但使用 1000 的冪而不是 1024 | |
| -H, --dereference-command-line | follow symbolic links listed on the command line | 遵循命令行列齣的符號鏈接 | |
| --dereference-command-line-symlink-to-dir | follow each command line symbolic link that points to a directory | 跟隨指嚮目錄的每命令行符號鏈接 | |
| --hide=PATTERN | do not list implied entries matching shell PATTERN (overridden by -a or -A) | 不列齣匹配 shell PATTERN 的隱含條目 (由 -a 或 -A 覆蓋) | |
| --indicator-style=WORD |
append indicator with style WORD to entry names: none (default), slash (-p), file-type (--file-type), classify (-F) |
把帶有 WORD 樣式的指示符追加到條目名稱: none (默認) 斜杠 (-p) 文件類型 (--file-type) 分類 (-F) |
|
| -i, --inode | print the index number of each file | 打印每個文件的索引號 | |
| -I, --ignore=PATTERN | do not list implied entries matching shell PATTERN | 不列齣匹配 shell PATTERN 的隱含條目 | |
| -k, --kibibytes | default to 1024-byte blocks for disk usage | 磁盤默認使用 1024 字節塊 | |
| -l | use a long listing format | 使用長列錶格式 | |
| -L, --dereference |
when showing file information for a symbolic link, show information for the file the link references rather than for the link itself |
當展示符號鏈接的文件信息時, 展示鏈接引用的文件信息,而不是鏈接本身 |
|
| -m | fill width with a comma separated list of entries | 采用逗號分隔的條目列錶填充寬度 | |
| -n, --numeric-uid-gid | like -l, but list numeric user and group IDs | 像 -l,但列齣數值用戶和組 ID | |
| -N, --literal |
print raw entry names (don't treat e.g. control characters specially) |
打印原生條目名 (不特彆對待控製字符) |
|
| -o | like -l, but do not list group information | 像 -l,但不列齣組信息 | |
| -p, --indicator-style=slash | append / indicator to directories | 將 / 指示符追加到目錄 | |
| -q, --hide-control-chars | print ? instead of nongraphic characters | 打印 ? 而不是非圖形字符 | |
| --show-control-chars |
show nongraphic characters as-is (the default, unless program is 'ls' and output is a terminal) |
原樣展示示非圖形字符 (默認,除非程序是 ls 且輸齣是終端) |
|
| -Q, --quote-name | enclose entry names in double quotes | 把條目名稱放在雙引號內 | |
| --quoting-style=WORD |
use quoting style WORD for entry names: literal, locale, shell, shell-always, shell-escape, shell-escape-always, c, escape |
條目名稱使用 WORD 引號樣式: literal, locale, shell, shell-always, shell-escape, shell-escape-always, c, escape |
|
| -r, --reverse | reverse order while sorting | 當排序時反轉次序 | |
| -R, --recursive | list subdirectories recursively | 遞歸列齣子目錄 | |
| -s, --size | print the allocated size of each file, in blocks | 打印每個文件的分配大小 (以塊為單位) | |
| -S | sort by file size, largest first | 按文件尺寸排序,最大的在前 | |
| --sort=WORD |
none (-U), size (-S), time (-t), version (-v), extension (-X) |
按 WORD 而不是名稱排序: none (-U) 尺寸 (-S) 時間 (-t) 版本 (-v) 擴展名 (-X) |
|
| --time=WORD |
with -l, show time as WORD instead of default modification time: atime or access or use (-u); ctime or status (-c); also use specified time as sort key if --sort=time (newest first) |
采用 -l,把時間顯示為 WORD 而不是默認修改時間: atime 或訪問或使用 (-u); ctime 或狀態 (-c); 也使用指定時間作為排序鍵,若 --sort=time (最新的在前) |
|
| --time-style=STYLE |
with -l, show times using style STYLE: full-iso, long-iso, iso, locale, or +FORMAT; FORMAT is interpreted like in 'date';
if FORMAT is FORMAT1
then FORMAT1 applies to non-recent files and FORMAT2 to recent files; if STYLE is prefixed with 'posix-', STYLE takes effect only outside the POSIX locale |
采用 -l,使用 STYLE 樣式展示時間: full-iso long-iso iso locale 或 +FORMAT; FORMAT 的解釋類似 date;
若 FORMAT 是 FORMAT1
那麼,FORMAT1 會應用到非最新文件,且 FORMAT2 會應用到最近文件; 若 STYLE 帶有 posix- 前綴, 則 STYLE 僅在 POSIX 區域設置外纔生效 |
|
| -t | sort by modification time, newest first | 按修改時間排序,最新的在前 | |
| -T, --tabsize=COLS | assume tab stops at each COLS instead of 8 | 假定製錶符在每 COLS 處停止而不是 8 | |
| -u |
with -lt: sort by, and show, access time; with -l: show access time and sort by name; otherwise: sort by access time, newest first |
采用 -lt:按訪問時間排序並展示; 采用 -l:展示訪問時間並按名稱排序; 否則:按訪問時間排序,最新的在前 |
|
| -U | do not sort; list entries in directory order | 不排序; 按目錄順序列齣條目 | |
| -v | natural sort of (version) numbers within text | 自然排序文本中的 (版本) 號 | |
| -w, --width=COLS | set output width to COLS. 0 means no limit | 將輸齣寬度設置為 COLS。 0 意味著沒有限製 | |
| -x | list entries by lines instead of by columns | 按行而不是按列列齣條目 | |
| -X | sort alphabetically by entry extension | 按條目擴展名的字母順序排序 | |
| -Z, --context | print any security context of each file | 打印每個文件的任何安全上下文 | |
| -1 | list one file per line. Avoid '\n' with -q or -b | 每行列齣一個文件。 采用 -q 或 -b 避免使用 \n | |
| --help | display this help and exit | 顯示此幫助並退齣 | |
| --version | output version information and exit | 輸齣版本信息並退齣 |
SIZE 自變量是整數且可選單位 (例如:10K 是 10*1024)。
單位為 K M G T P E Z Y (1024 的冪) 或 KB MB ... (1000 的冪)。
默認情況下和采用 --color=never 兩者會禁用使用顔色去區分文件類型。
采用 --color=auto, ls 纔會發射著色代碼 (當標準輸齣被連接到終端時)。
LS_COLORS 環境變量可以更改設置。 使用 dircolors 命令能進行設置。
| 功能 | 命令 | 文字解釋 | 示例 | 示例解釋 |
|---|---|---|---|---|
| 幫助 | ls --help | 展示幫助信息 | ||
| 版本 | ls --version | 展示版本信息 |
版權聲明: 本文為獨傢原創稿件,版權歸 樂數軟件 ,未經許可不得轉載。