SYNOPSIS
sort[OPTION]... [FILE]...
sort[OPTION]... --files0-from=F
DESCRIPTION
Write sorted concatenation of all FILE(s) to standard output.
With no FILE, or when FILE is -, read standard input.
Mandatory arguments to long options are mandatory for short options too. Ordering options:
# *** == 排列时,忽略开始的空白 == ***
-b, --ignore-leading-blanks
ignore leading blanks
# 只考虑空白,数字和字母的排序
-d, --dictionary-order
consider only blanks and alphanumeric characters
# 忽略大小写,但一般情况大写在前面如aBb
-f, --ignore-case
fold lower case to upper case characters
# 使数字按大小排序,而不是拆分成字符来排序
-g, --general-numeric-sort
compare according to general numerical value
# 排序时,忽略不可打印字符
-i, --ignore-nonprinting
consider only printable characters
# 按月份大小排序
-M, --month-sort
compare (unknown)<'JAN'<... <'DEC'# 按照可读数值大写排序,识别K G等
-h, --human-numeric-sort
compare human readable numbers (e.g., 2K 1G)# 按字符串比较大小的方式来排序
-n, --numeric-sort
compare according to string numerical value
# 按随机生产的散列表来排序
-R, --random-sort
shuffle, but group identical keys. See shuf(1)
--random-source=FILE
get random bytes from FILE
# 反向排序
-r, --reverse
reverse the result of comparisons
--sort=WORD
sort according to WORD: general-numeric -g, human-numeric -h, month -M, numeric -n, random -R, version -V
-V, --version-sort
natural sort of (version) numbers within text
Other options:
--batch-size=NMERGE
merge at most NMERGE inputs at once;formore use temp files
# 不排序,报告第一个无序行
-c, --check, --check=diagnose-first
check for sorted input;do not sort# 不排序,也不报告
-C, --check=quiet, --check=silent
like -c, but do not report first bad line
--compress-program=PROG
compress temporaries with PROG; decompress them with PROG -d
--debug
annotate the part of the line used to sort, and warn about questionable usage to stderr
--files0-from=F
read input from the files specified by NUL-terminated names infile F; If F is - thenread names from standard input
-k, --key=KEYDEF
sort via a key; KEYDEF gives location and type
-m, --merge
merge already sorted files;do not sort
-o, --output=FILE
write result to FILE instead of standard output
-s, --stable
stabilize sort by disabling last-resort comparison
-S, --buffer-size=SIZE
use SIZE for main memory buffer
-t, --field-separator=SEP
use SEP instead of non-blank to blank transition
-T, --temporary-directory=DIR
use DIR for temporaries, not $TMPDIR or /tmp; multiple options specify multiple directories
Other options:
--batch-size=NMERGE
merge at most NMERGE inputs at once;formore use temp files
-c, --check, --check=diagnose-first
check for sorted input;do not sort
-C, --check=quiet, --check=silent
like -c, but do not report first bad line
--compress-program=PROG
compress temporaries with PROG; decompress them with PROG -d
--debug
annotate the part of the line used to sort, and warn about questionable usage to stderr
--files0-from=F
read input from the files specified by NUL-terminated names infile F; If F is - thenread names from standard input
-k, --key=KEYDEF
sort via a key; KEYDEF gives location and type
-m, --merge
merge already sorted files;do not sort
-o, --output=FILE
write result to FILE instead of standard output
-s, --stable
stabilize sort by disabling last-resort comparison
-S, --buffer-size=SIZE
use SIZE for main memory buffer
-t, --field-separator=SEP
use SEP instead of non-blank to blank transition
-T, --temporary-directory=DIR
use DIR for temporaries, not $TMPDIR or /tmp; multiple options specify multiple directories