Linux每日一命令--Day 1 ls
ls
名稱
ls
功能
listdirectory contents.
列出目標目錄中所有的子目錄和文件。
格式
ls[OPTION]... [FILE]…
ls [選項] [目錄名]
參數p
-a,—all
donot ignore entries starting with .
列出目錄下的所有文件,包括以.開頭的隱含文件
-A, --almost-all
donot list implied . and ..
列出目錄下的所有文件,但不包括以.和..開頭的隱含文件
--author
with-l, print the author of each file
配合-l:打印出每個文件的作者
-b,--escape
printoctal escapes for nongraphic characters
以八進制 ( \nnn) 表示法顯示非打印字符
--block-size=SIZE
useSIZE-byte blocks.
使用SIZE-byte塊
-B,--ignore-backups
donot list implied entries ending with ~
不輸出以 “~”結束的備份文件
-c
with-lt: sort by, and show, ctime (time of last modification of file statusinformation)
with-l: show ctime and sort by name otherwise: sort by ctime
配合-lt:根據 ctime 排序及顯示 ctime (文件狀態最後更改的時間)
配合-l:顯示 ctime 但根據名稱排序
否則:根據
-C
listentries by columns
按列輸出,縱向排序
--color[=WHEN]
colorizethe output. WHEN defaults to ‘always’ or can be ‘never’ or ‘auto’. More infobelow
控制是否使用色彩分辨文件。WHEN可以是“never”、“always”或“auto”其中之一
-d,--directory
listdirectory entries instead of contents, and do not dereference symbolic links
將目錄像文件一樣顯示,而不是顯示其下的文件
-D,--dired
generateoutput designed for Emacs’ dired mode
產生適合Emacs的dired模式使用的結果
-f
donot sort, enable -aU, disable -ls --color
對輸出的文件不進行排序,-aU選項生效,-ls和顏色選項失效
-F,--classify
appendindicator (one of */=>@|) to entries
如果文件是目錄,在文件名後面放置一個 /(斜杠),如果文件可執行,則放置一個 *(星號),如果文件為套接字,則放置一個 =(等號),如果為 FIFO,則放置一個 |(管道)符號,如果是符號鏈接,則放置一個 @
--file-type
likewise,except do not append ‘*’
同樣的,除了不添加“*”
--format=WORD
across-x, commas -m, horizontal -x, long -l, single-column -1, verbose -l, vertical-C
-m - x,逗號,水平- x - l,單列,詳細- 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
groupdirectories before files. augment with a --sort option, but any use of--sort=none (-U) disables grouping
將輸出結果在保留原有順序的前提下(-s)只根據第欄的第一個字母到第一欄的第一個字母之間的內容——也就是該文件的類型——排序
-G,--no-group
ina long listing, don’t print group names
不列出任何有關組的信息
-h,--human-readable
with-l, print sizes in human readable format (e.g., 1K 234M 2G)
以容易理解的格式列出文件大小 (例如 1K 234M 2G)
—si
likewise,but use powers of 1000 not 1024
類似 -h,但文件大小取 1000 的次方而不是 1024
-H,--dereference-command-line
followsymbolic links listed on the command line
使用命令列中的符號鏈接指示的真正目的地
--dereference-command-line-symlink-to-dir
followeach command line symbolic link that points to a directory
遵循每個命令行符號鏈接指向一個目錄
--hide=PATTERN
donot list implied entries matching shell PATTERN (overridden by -a or -A)
不隱含條目列表匹配的shell模式(由——或者——覆蓋)
--indicator-style=WORD
appendindicator with style WORD to entry names: none (default), slash (-p), file-type (--file-type), classify (-F)
指定在每個項目名稱後加上指示符號<方式>:none (默認),classify (-F),file-type (-p)
-i,--inode
printthe index number of each file
印出每個文件的 inode 號
-I,--ignore=PATTERN
donot list implied entries matching shell PATTERN
不印出任何符合 shell 萬用字符<樣式>的項目
-k
like--block-size=1K
即 –block-size=1K,以 k 字節的形式表示文件的大小
-l
usea long listing format
使用長格式列出信息。即除了文件名之外,還將文件的權限、所有者、文件大小等信息詳細列出來
-L,--dereference
whenshowing file information for a symbolic link, show information for the file thelink references rather than for the link itself
當顯示符號鏈接的文件信息時,顯示符號鏈接所指示的對象而並非符號鏈接本身的信息
-m
fillwidth with a comma separated list of entries
使用流輸出格式,所有項目以逗號分隔,並填滿整行行寬
-n,--numeric-uid-gid
like-l, but list numeric user and group IDs
除顯示用戶和組 ID 而不是用戶和組名稱以外,它顯示和 -l 標誌同樣的信息
-N,--literal
printraw 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
此項為一個先進先出(FIFO)特殊文件
-q,--hide-control-chars
print? instead of non graphic characters
將文件名中的非打印字符顯示成 ?(問號)
--show-control-chars
shownon graphic characters as-is (default unless program is ‘ls’ and output is a terminal)
直接顯示無法打印的字符 (這是默認方式,除非調用的程序名稱是“ls”而且是在終端機畫面輸出結果)
-Q,--quote-name
encloseentry names in double quotes
把輸出的文件名用雙引號括起來
--quoting-style=WORD
usequoting style WORD for entry names: literal, locale, shell, shell-always, c,escape
使用指定的 quoting 顯示項目的名稱:literal、locale、shell、shell-always、c、escape
-r,--reverse
reverseorder while sorting
依相反次序排列
-R,--recursive
listsubdirectories recursively
同時列出所有子目錄層
-s,--size
printthe allocated size of each file, in blocks
以塊大小為單位列出所有文件的大小
-S
sortby file size
根據文件大小排序
--sort=WORD
sortby WORD instead of name: none -U, extension -X, size -S, time -t, version -v
以下是可選用的 WORD 和它們代表的相應選項:
extension -X status -c
none -U time -t
size -S atime -u
time -t access -u
version -v use -u
--time=WORD
with -l, show time as WORD instead of modification time:atime -u, access -u, use -u, ctime -c, or status -c; use specified time assort key if --sort=time
和 -l 同時使用時顯示WORD 所代表的時間而非修改時間:atime、access、use、ctime 或 status;加上 --sort=time 選項時會以指定時間作為排序關鍵字
--time-style=STYLE
with-l, show times using style STYLE: full-iso, long-iso, iso, locale, +FORMAT. FORMAT is interpreted like ‘date’; if FORMAT is FORMAT1<newline>FORMAT2, FORMAT1 appliesto 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、iso、locale、posix-iso、+FORMAT。FORMAT即是“date”所用的時間格式;如果 FORMAT是FORMAT1FORMAT2,FORMAT1 適用於較舊的文件而 FORMAT2 適用於較新的文件;如果 STYLE以“posix-”開頭,則 STYLE 僅在 POSIX 語系之外生效
-t
sortby modification time
以文件修改時間排序
-T,--tabsize=COLS
assumetab stops at each COLS instead of 8
自行指定 tab 的,而非8 個字符
-u
with -lt: sort by, and show, access time
with-l: show access time and sort by name
otherwise:sort by access time
配合-lt:顯示訪問時間而且依訪問時間排序
配合-l:顯示訪問時間但根據名稱排序
否則:根據訪問時間排序
-U
donot sort; list entries in directory order
不進行排序;依文件系統原有的次序列出項目
-v
naturalsort of (version) numbers within text
根據版本進行排序
-w,--width=COLS
assumescreen width instead of current value
自行指定屏幕寬度而不使用目前的數值
-x
listentries by lines instead of by columns
逐行列出項目而不是逐欄列出
-X
sortalphabetically by entry extension
根據擴展名排序
-1
listone file per line
每行只列出一個文件
--lcontext
Displaysecurity context. Enable -l. Lines will probably be too wide for mostdisplays.
-Z,--context
Display security context so it fits on most displays. Displays onlymode, user, group, security context and file name.
--scontext
Displayonly security context and file name.
--help
displaythis help and exit
顯示此幫助信息並離開
--version
outputversion information and exit
顯示版本信息並離開
本文出自 “寂寞行走” 博客,謝絕轉載!
Linux每日一命令--Day 1 ls