[root@szm Desktop]# mkdir --help

Usage: mkdir [OPTION]... DIRECTORY...
Create the DIRECTORY(ies), if they do not already exist.
 
Mandatory arguments to long options are mandatory for short options too.
  -m, --mode=MODE   set file mode (as in chmod), not a=rwx - umask
  -p, --parents     no error if existing, make parent directories as needed
  -v, --verbose     print a message for each created directory
  -Z, --context=CTX  set the SELinux security context of each created
                      directory to CTX
      --help     display this help and exit
      --version  output version information and exit
 
Report mkdir bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'mkdir invocation'
[root@szm ~]# rmdir --help
Usage: rmdir [OPTION]... DIRECTORY...
Remove the DIRECTORY(ies), if they are empty.
 
      --ignore-fail-on-non-empty
                  ignore each failure that is solely because a directory
                    is non-empty
  -p, --parents   remove DIRECTORY and its ancestors; e.g., `rmdir -p a/b/c' is
                    similar to `rmdir a/b/c a/b a'
  -v, --verbose   output a diagnostic for every directory processed
      --help     display this help and exit
      --version  output version information and exit
 
Report rmdir bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'rmdir invocation'
[root@szm ~]# cp --help
Usage: cp [OPTION]... [-T] SOURCE DEST
  or:  cp [OPTION]... SOURCE... DIRECTORY
  or:  cp [OPTION]... -t DIRECTORY SOURCE...
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
 
Mandatory arguments to long options are mandatory for short options too.
  -a, --archive                same as -dR --preserve=all
      --backup[=CONTROL]       make a backup of each existing destination file
  -b                           like --backup but does not accept an argument
      --copy-contents          copy contents of special files when recursive
  -d                           same as --no-dereference --preserve=links----复制链接文件内容,链接消失,但有内容
  -f, --force                  if an existing destination file cannot be
                                 opened, remove it and try again (redundant if
                                 the -n option is used)
  -i, --interactive            prompt before overwrite (overrides a previous -n
                                  option)
  -H                           follow command-line symbolic links in SOURCE
  -l, --link                   link files instead of copying
  -L, --dereference            always follow symbolic links in SOURCE
  -n, --no-clobber             do not overwrite an existing file (overrides
                                 a previous -i option)
  -P, --no-dereference         never follow symbolic links in SOURCE--保留源文件权限
  -p                           same as --preserve=mode,ownership,timestamps
      --preserve[=ATTR_LIST]   preserve the specified attributes (default:
                                 mode,ownership,timestamps), if possible
                                 additional attributes: context, links, xattr,
                                 all
  -c                           same as --preserve=context
      --no-preserve=ATTR_LIST  don't preserve the specified attributes
      --parents                use full source file name under DIRECTORY
  -R, -r, --recursive          copy directories recursively
      --reflink[=WHEN]         control clone/CoW copies. See below.
      --remove-destination     remove each existing destination file before
                                 attempting to open it (contrast with --force)
      --sparse=WHEN            control creation of sparse files. See below.
      --strip-trailing-slashes  remove any trailing slashes from each SOURCE
                                 argument
  -s, --symbolic-link          make symbolic links instead of copying
  -S, --suffix=SUFFIX          override the usual backup suffix
  -t, --target-directory=DIRECTORY  copy all SOURCE arguments into DIRECTORY
  -T, --no-target-directory    treat DEST as a normal file
  -u, --update                 copy only when the SOURCE file is newer
                                 than the destination file or when the
                                 destination file is missing
  -v, --verbose                explain what is being done
  -x, --one-file-system        stay on this file system
  -Z, --context=CONTEXT        set security context of copy to CONTEXT
      --help     display this help and exit
      --version  output version information and exit
 
By default, sparse SOURCE files are detected by a crude heuristic and the
corresponding DEST file is made sparse as well.  That is the behavior
selected by --sparse=auto.  Specify --sparse=always to create a sparse DEST
file whenever the SOURCE file contains a long enough sequence of zero bytes.
Use --sparse=never to inhibit creation of sparse files.
 
When --reflink[=always] is specified, perform a lightweight copy, where the
data blocks are copied only when modified.  If this is not possible the copy
fails, or if --reflink=auto is specified, fall back to a standard copy.
 
The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
The version control method may be selected via the --backup option or through
the VERSION_CONTROL environment variable.  Here are the values:
 
  none, off       never make backups (even if --backup is given)
  numbered, t     make numbered backups
  existing, nil   numbered if numbered backups exist, simple otherwise
  simple, never   always make simple backups
 
As a special case, cp makes a backup of SOURCE when the force and backup
options are given and SOURCE and DEST are the same name for an existing,
regular file.
 
Report cp bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'cp invocation'
[root@szm ~]# mv --help
Usage: mv [OPTION]... [-T] SOURCE DEST
  or:  mv [OPTION]... SOURCE... DIRECTORY
  or:  mv [OPTION]... -t DIRECTORY SOURCE...
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
 
Mandatory arguments to long options are mandatory for short options too.
      --backup[=CONTROL]       make a backup of each existing destination file
  -b                           like --backup but does not accept an argument
  -f, --force                  do not prompt before overwriting
  -i, --interactive            prompt before overwrite
  -n, --no-clobber             do not overwrite an existing file
If you specify more than one of -i, -f, -n, only the final one takes effect.
      --strip-trailing-slashes  remove any trailing slashes from each SOURCE
                                 argument
  -S, --suffix=SUFFIX          override the usual backup suffix
  -t, --target-directory=DIRECTORY  move all SOURCE arguments into DIRECTORY
  -T, --no-target-directory    treat DEST as a normal file
  -u, --update                 move only when the SOURCE file is newer
                                 than the destination file or when the
                                 destination file is missing
  -v, --verbose                explain what is being done
      --help     display this help and exit
      --version  output version information and exit
 
The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
The version control method may be selected via the --backup option or through
the VERSION_CONTROL environment variable.  Here are the values:
 
  none, off       never make backups (even if --backup is given)
  numbered, t     make numbered backups
  existing, nil   numbered if numbered backups exist, simple otherwise
  simple, never   always make simple backups
 
Report mv bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'mv invocation'
 
[root@szm ~]# rm --help
Usage: rm [OPTION]... FILE...
Remove (unlink) the FILE(s).
 
  -f, --force           ignore nonexistent files, never prompt
  -i                    prompt before every removal
  -I                    prompt once before removing more than three files, or
                          when removing recursively.  Less intrusive than -i,
                          while still giving protection against most mistakes
      --interactive[=WHEN]  prompt according to WHEN: never, once (-I), or
                          always (-i).  Without WHEN, prompt always
      --one-file-system  when removing a hierarchy recursively, skip any
                          directory that is on a file system different from
                          that of the corresponding command line argument
      --no-preserve-root  do not treat `/' specially
      --preserve-root   do not remove `/' (default)
  -r, -R, --recursive   remove directories and their contents recursively
  -v, --verbose         explain what is being done
      --help     display this help and exit
      --version  output version information and exit
 
By default, rm does not remove directories.  Use the --recursive (-r or -R)
option to remove each listed directory, too, along with all of its contents.
 
To remove a file whose name starts with a `-', for example `-foo',
use one of these commands:
  rm -- -foo
 
  rm ./-foo
 
Note that if you use rm to remove a file, it is usually possible to recover
the contents of that file.  If you want more assurance that the contents are
truly unrecoverable, consider using shred.
 
Report rm bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'rm invocation'
注意:
1)管理员删除文件时要确认
2)普通用户删除文件时不用确认
[root@szm ~]# head --help
Usage: head [OPTION]... [FILE]...
Print the first 10 lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the file name.
With no FILE, or when FILE is -, read standard input.
 
Mandatory arguments to long options are mandatory for short options too.
  -c, --bytes=[-]K         print the first K bytes of each file;
                             with the leading `-', print all but the last
                             K bytes of each file------------字符
  -n, --lines=[-]K         print the first K lines instead of the first 10;
                             with the leading `-', print all but the last
                             K lines of each file-------------行
  -q, --quiet, --silent    never print headers giving file names
  -v, --verbose            always print headers giving file names
      --help     display this help and exit
      --version  output version information and exit
 
K may have a multiplier suffix:
b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024,
GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y.
 
Report head bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'head invocation'
 
[root@szm ~]# tail --help
Usage: tail [OPTION]... [FILE]...
Print the last 10 lines of each FILE to standard output.
With more than one FILE, precede each with a header giving the file name.
With no FILE, or when FILE is -, read standard input.
 
Mandatory arguments to long options are mandatory for short options too.
  -c, --bytes=K            output the last K bytes; alternatively, use -c +K
                           to output bytes starting with the Kth of each file
  -f, --follow[={name|descriptor}]
                           output appended data as the file grows;
                           -f, --follow, and --follow=descriptor are
                           equivalent--------------实时的变化
  -F                       same as --follow=name --retry
  -n, --lines=K            output the last K lines, instead of the last 10;
                           or use -n +K to output lines starting with the Kth
      --max-unchanged-stats=N
                           with --follow=name, reopen a FILE which has not
                           changed size after N (default 5) iterations
                           to see if it has been unlinked or renamed
                           (this is the usual case of rotated log files).
                           With inotify, this option is rarely useful.
      --pid=PID            with -f, terminate after process ID, PID dies
  -q, --quiet, --silent    never output headers giving file names
      --retry              keep trying to open a file even when it is or
                             becomes inaccessible; useful when following by
                             name, i.e., with --follow=name
  -s, --sleep-interval=N   with -f, sleep for approximately N seconds
                             (default 1.0) between iterations.
                           With inotify and --pid=P, check process P at
                           least once every N seconds.
  -v, --verbose            always output headers giving file names
      --help     display this help and exit
      --version  output version information and exit
 
If the first character of K (the number of bytes or lines) is a `+',
print beginning with the Kth item from the start of each file, otherwise,
print the last K items in the file.  K may have a multiplier suffix:
b 512, kB 1000, K 1024, MB 1000*1000, M 1024*1024,
GB 1000*1000*1000, G 1024*1024*1024, and so on for T, P, E, Z, Y.
 
With --follow (-f), tail defaults to following the file descriptor, which
means that even if a tail'ed file is renamed, tail will continue to track
its end.  This default behavior is not desirable when you really want to
track the actual name of the file, not the file descriptor (e.g., log
rotation).  Use --follow=name in that case.  That causes tail to track the
named file in a way that accommodates renaming, removal and creation.
 
Report tail bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'tail invocation'
 
重置终端命令:reset
 
[root@szm ~]# cat --help
Usage: cat [OPTION]... [FILE]...
Concatenate FILE(s), or standard input, to standard output.
 
  -A, --show-all           equivalent to -vET--------包括起始、结束、换行符
  -b, --number-nonblank    number nonempty output lines----不显示空行
  -e                       equivalent to -vE
  -E, --show-ends          display $ at end of each line----显示换行符
  -n, --number             number all output lines--------前面加行号
  -s, --squeeze-blank      suppress repeated empty output lines----连续多个空行变一行
  -t                       equivalent to -vT
  -T, --show-tabs          display TAB characters as ^I
  -u                       (ignored)
  -v, --show-nonprinting   use ^ and M- notation, except for LFD and TAB
      --help     display this help and exit
      --version  output version information and exit
 
With no FILE, or when FILE is -, read standard input.
 
Examples:
  cat f - g  Output f's contents, then standard input, then g's contents.
  cat        Copy standard input to standard output.
 
Report cat bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'cat invocation'
[root@szm ~]# tac /etc/passwd ----------------------与cat相反。作用相同
[root@szm ~]# more --help
more: unknown option "-h"
usage: more [ -dflpcsu] [+linenum | +/pattern] name1 name2 ...
[root@szm ~]# less /etc/passwd
向上向下:n/N
v:编辑器中打开
q
 ======================================文件内容提取===================================
 [root@szm ~]# grep --help
Usage: grep [OPTION]... PATTERN [FILE]...
Search for PATTERN in each FILE or standard input.
PATTERN is, by default, a basic regular BRE).< /div>
Example: grep -i 'hello world' menu.h main.c
 
Regexp selection and interpretation: --------------正则参数
  -E, --extended-regexp     PATTERN is an extended regular expression (ERE)
  -F, --fixed-strings       PATTERN is a set of newline-separated fixed strings
  -G, --basic-regexp        PATTERN is a basic regular BRE)< /div>
  -P, --perl-regexp         PATTERN is a Perl regular expression
  -e, --regexp=PATTERN      use PATTERN for matching------常规正则表达式
  -f, --file=FILE           obtain PATTERN from FILE
  -i, --ignore-case         ignore case distinctions
  -w, --word-regexp         force PATTERN to match only whole words
  -x, --line-regexp         force PATTERN to match only whole lines
  -z, --null-data           a data line ends in 0 byte, not newline
 
Miscellaneous:
  -s, --no-messages         suppress error messages
  -v, --invert-match        select non-matching lines
  -V, --version             print version information and exit
      --help                display this help and exit
      --mmap                ignored for backwards compatibility
 
Output control:
  -m, --max-count=NUM       stop after NUM matches
  -b, --byte-offset         print the byte offset with output lines
  -n, --line-number         print line number with output lines
      --line-buffered       flush output on every line
  -H, --with-filename       print the filename for each match
  -h, --no-filename         suppress the prefixing filename on output
      --label=LABEL         print LABEL as filename for standard input
  -o, --only-matching       show only the part of a line matching PATTERN
  -q, --quiet, --silent     suppress all normal output
      --binary-files=TYPE   assume that binary files are TYPE;
                            TYPE is `binary', `text', or `without-match'
  -a, --text                equivalent to --binary-files=text
  -I                        equivalent to --binary-files=without-match
  -d, --directories=ACTION  how to handle directories;
                            ACTION is `read', `recurse', or `skip'
  -D, --devices=ACTION      how to handle devices, FIFOs and sockets;
                            ACTION is `read' or `skip'
  -R, -r, --recursive       equivalent to --directories=recurse
      --include=FILE_PATTERN  search only files that match FILE_PATTERN
      --exclude=FILE_PATTERN  skip files and directories matching FILE_PATTERN
      --exclude-from=FILE   skip files matching any file pattern from FILE
      --exclude-dir=PATTERN  directories that match PATTERN will be skipped.
  -L, --files-without-match  print only names of FILEs containing no match
  -l, --files-with-matches  print only names of FILEs containing matches
  -c, --count               print only a count of matching lines per FILE
  -T, --initial-tab         make tabs line up (if needed)
  -Z, --null                print 0 byte after FILE name
 
Context control:
  -B, --before-context=NUM  print NUM lines of leading context
  -A, --after-context=NUM   print NUM lines of trailing context
  -C, --context=NUM         print NUM lines of output context
  -NUM                      same as --context=NUM
      --color[=WHEN],
      --colour[=WHEN]       use markers to highlight the matching strings;
                            WHEN is `always', `never', or `auto'
  -U, --binary              do not strip CR characters at EOL (MSDOS)
  -u, --unix-byte-offsets   report offsets as if CRs were not there (MSDOS)
 
`egrep' means `grep -E'.  `fgrep' means `grep -F'.
Direct invocation as either `egrep' or `fgrep' is deprecated.
With no FILE, or when FILE is -, read standard input.  If less than two FILEs
are given, assume -h.  Exit status is 0 if any line was selected, 1 otherwise;
if any error occurs and -q was not given, the exit status is 2.
 
Report bugs to: bug-grep@gnu.org
GNU Grep home page: <http://www.gnu.org/software/grep/>
General help using GNU software: <http://www.gnu.org/gethelp/>
[root@szm ~]# grep -n root /etc/passwd
1:root:x:0:0:root:/root:/bin/bash
11:operator:x:11:0:operator:/root:/sbin/nologin
 
 [root@szm ~]# cut --help
Usage: cut OPTION... [FILE]...
Print selected parts of lines from each FILE to standard output.
 
Mandatory arguments to long options are mandatory for short options too.
  -b, --bytes=LIST        select only these bytes
  -c, --characters=LIST   select only these characters
  -d, --delimiter=DELIM   use DELIM instead of TAB for field delimiter---分隔符
  -f, --fields=LIST       select only these fields;  also print any line
                            that contains no delimiter character, unless
                            the -s option is specified
  -n                      with -b: don't split multibyte characters
      --complement        complement the set of selected bytes, characters
                            or fields
  -s, --only-delimited    do not print lines not containing delimiters
      --output-delimiter=STRING  use STRING as the output delimiter
                            the default is to use the input delimiter
      --help     display this help and exit
      --version  output version information and exit
 
Use one, and only one of -b, -c or -f.  Each LIST is made up of one
range, or many ranges separated by commas.  Selected input is written
in the same order that it is read, and is written exactly once.
Each range is one of:
 
  N     N'th byte, character or field, counted from 1
  N-    from N'th byte, character or field, to end of line
  N-M   from N'th to M'th (included) byte, character or field
  -M    from first to M'th (included) byte, character or field
 
With no FILE, or when FILE is -, read standard input.
 
Report cut bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'cut invocation'
 
 [root@szm ~]# cut -d: -f3 /etc/passwd
 
 [root@szm ~]# cut -c4-10 /etc/passwd ----------------- 每行读取4-10个字符之间的数据

 [root@szm ~]# wc --help

Usage: wc [OPTION]... [FILE]...

  or:  wc [OPTION]... --files0-from=F

Print newline, word, and byte counts for each FILE, and a total line if

more than one FILE is specified.  With no FILE, or when FILE is -,

read standard input.

  -c, --bytes            print the byte counts

  -m, --chars            print the character counts

  -l, --lines            print the newline counts

      --files0-from=F    read input from the files specified by

                           NUL-terminated names in file F;

                           If F is - then read names from standard input

  -L, --max-line-length  print the length of the longest line

  -w, --words            print the word counts

      --help     display this help and exit

      --version  output version information and exit

 

Report wc bugs to bug-coreutils@gnu.org

GNU coreutils home page: <http://www.gnu.org/software/coreutils/>

General help using GNU software: <http://www.gnu.org/gethelp/>

For complete documentation, run: info coreutils 'wc invocation'

[root@szm ~]# diff --help
Usage: diff [OPTION]... FILES
Compare files line by line.
 
  -i  --ignore-case  Ignore case differences in file contents.---大小写
  --ignore-file-name-case  Ignore case when comparing file names.
  --no-ignore-file-name-case  Consider case when comparing file names.
  -E  --ignore-tab-expansion  Ignore changes due to tab expansion.
  -b  --ignore-space-change  Ignore changes in the amount of white space.
  -w  --ignore-all-space  Ignore all white space.
  -B  --ignore-blank-lines  Ignore changes whose lines are all blank.
  -I RE  --ignore-matching-lines=RE  Ignore changes whose lines all match RE.
  --strip-trailing-cr  Strip trailing carriage return on input.
  -a  --text  Treat all files as text.
 
  -c  -C NUM  --context[=NUM]  Output NUM (default 3) lines of copied context.
  -u  -U NUM  --unified[=NUM]  Output NUM (default 3) lines of unified context.
    --label LABEL  Use LABEL instead of file name.
    -p  --show-c-function  Show which C function each change is in.
    -F RE  --show-function-line=RE  Show the most recent line matching RE.
  -q  --brief  Output only whether files differ.
  -e  --ed  Output an ed script.
  --normal  Output a normal diff.
  -n  --rcs  Output an RCS format diff.
  -y  --side-by-side  Output in two columns.
    -W NUM  --width=NUM  Output at most NUM (default 130) print columns.
    --left-column  Output only the left column of common lines.
    --suppress-common-lines  Do not output common lines.
  -D NAME  --ifdef=NAME  Output merged file to show `#ifdef NAME' diffs.
  --GTYPE-group-format=GFMT  Similar, but format GTYPE input groups with GFMT.
  --line-format=LFMT  Similar, but format all input lines with LFMT.
  --LTYPE-line-format=LFMT  Similar, but format LTYPE input lines with LFMT.
    LTYPE is `old', `new', or `unchanged'.  GTYPE is LTYPE or `changed'.
    GFMT may contain:
      %<  lines from FILE1
      %>  lines from FILE2
      %=  lines common to FILE1 and FILE2
      %[-][WIDTH][.[PREC]]{doxX}LETTER  printf-style spec for LETTER
        LETTERs are as follows for new group, lower case for old group:
          F  first line number
          L  last line number
          N  number of lines = L-F+1
          E  F-1
          M  L+1
    LFMT may contain:
      %L  contents of line
      %l  contents of line, excluding any trailing newline
      %[-][WIDTH][.[PREC]]{doxX}n  printf-style spec for input line number
    Either GFMT or LFMT may contain:
      %%  %
      %c'C'  the single character C
      %c'\OOO'  the character with octal code OOO
 
  -l  --paginate  Pass the output through `pr' to paginate it.
  -t  --expand-tabs  Expand tabs to spaces in output.
  -T  --initial-tab  Make tabs line up by prepending a tab.
 
  -r  --recursive  Recursively compare any subdirectories found.-按照文件目录递归创建修补文件
  -N  --new-file  Treat absent files as empty.-----比较目录,将比较结果生成文件
  --unidirectional-new-file  Treat absent first files as empty.
  -s  --report-identical-files  Report when two files are the same.
  -x PAT  --exclude=PAT  Exclude files that match PAT.
  -X FILE  --exclude-from=FILE  Exclude files that match any pattern in FILE.
  -S FILE  --starting-file=FILE  Start with FILE when comparing directories.
  --from-file=FILE1  Compare FILE1 to all operands.  FILE1 can be a directory.
  --to-file=FILE2  Compare all operands to FILE2.  FILE2 can be a directory.
 
  --horizon-lines=NUM  Keep NUM lines of the common prefix and suffix.
  -d  --minimal  Try hard to find a smaller set of changes.
  --speed-large-files  Assume large files and many scattered small changes.
 
  -v  --version  Output version info.
  --help  Output this help.
 
FILES are `FILE1 FILE2' or `DIR1 DIR2' or `DIR FILE...' or `FILE... DIR'.
If --from-file or --to-file is given, there are no restrictions on FILES.
If a FILE is `-', read standard input.
 
Report bugs to <bug-gnu-utils@gnu.org>.
 

a:增加指定文件的内容

c:取代指定文件的内容

d:删除指定文件的内容

i:插入指定文件的内容

s:取代指定文件的内容

 

[root@szm ~]# patch --help

Usage: patch [OPTION]... [ORIGFILE [PATCHFILE]]

 

Input options:

 

  -p NUM  --strip=NUM  Strip NUM leading components from file names.

  -F LINES  --fuzz LINES  Set the fuzz factor to LINES for inexact matching.

  -l  --ignore-whitespace  Ignore white space changes between patch and input.

 

  -c  --context  Interpret the patch as a context difference.

  -e  --ed  Interpret the patch as an ed script.

  -n  --normal  Interpret the patch as a normal difference.

  -u  --unified  Interpret the patch as a unified difference.

 

  -N  --forward  Ignore patches that appear to be reversed or already applied.

  -R  --reverse  Assume patches were created with old and new files swapped.

 

  -i PATCHFILE  --input=PATCHFILE  Read patch from PATCHFILE instead of stdin.

 

Output options:

 

  -o FILE  --output=FILE  Output patched files to FILE.

  -r FILE  --reject-file=FILE  Output rejects to FILE.

 

  -D NAME  --ifdef=NAME  Make merged if-then-else output using NAME.

  -m  --merge  Merge using conflict markers instead of creating reject files.

  -E  --remove-empty-files  Remove output files that are empty after patching.

 

  -Z  --set-utc  Set times of patched files, assuming diff uses UTC (GMT).

  -T  --set-time  Likewise, assuming local time.

 

  --quoting-style=WORD   output file names using quoting style WORD.

    Valid WORDs are: literal, shell, shell-always, c, escape.

    Default is taken from QUOTING_STYLE env variable, or 'shell' if unset.

 

Backup and version control options:

 

  -b  --backup  Back up the original contents of each file.

  --backup-if-mismatch  Back up if the patch does not match exactly.

  --no-backup-if-mismatch  Back up mismatches only if otherwise requested.

 

  -V STYLE  --version-control=STYLE  Use STYLE version control.

STYLE is either 'simple', 'numbered', or 'existing'.

  -B PREFIX  --prefix=PREFIX  Prepend PREFIX to backup file names.

  -Y PREFIX  --basename-prefix=PREFIX  Prepend PREFIX to backup file basenames.

  -z SUFFIX  --suffix=SUFFIX  Append SUFFIX to backup file names.

 

  -g NUM  --get=NUM  Get files from RCS etc. if positive; ask if negative.

 

Miscellaneous options:

 

  -t  --batch  Ask no questions; skip bad-Prereq patches; assume reversed.

  -f  --force  Like -t, but ignore bad-Prereq patches, and assume unreversed.

  -s  --quiet  --silent  Work silently unless an error occurs.

  --verbose  Output extra information about the work being done.

  --dry-run  Do not actually change any files; just print what would happen.

  --posix  Conform to the POSIX standard.

 

  -d DIR  --directory=DIR  Change the working directory to DIR first.

  --reject-format=FORMAT  Create 'context' or 'unified' rejects.

  --binary  Read and write data in binary mode.

 

  -v  --version  Output version info.

  --help  Output this help.

 

Report bugs to <bug-patch@gnu.org>.

 
[root@szm szm]# cat diff1.txt diff2.txt
1
2
3
4
1
2
4
5
[root@szm szm]# diff -u diff1.txt diff2.txt >diff.path
[root@szm szm]# cat diff.path 
--- diff1.txt 2013-03-06 22:02:41.323153260 +0800
+++ diff2.txt 2013-03-06 22:02:57.944808759 +0800
@@ -1,4 +1,4 @@
 1
 2
-3
 4
+5
[root@szm szm]# patch -b diff1.txt diff.path 
patching file diff1.txt
[root@szm szm]# cat diff1.txt diff2.txt 
1
2
4
5
1
2
4
5
 

 

 

[root@szm szm]# sort --help

Usage: sort [OPTION]... [FILE]...

  or:  sort [OPTION]... --files0-from=F

Write sorted concatenation of all FILE(s) to standard output.

 

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

  -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'----月排序

  -h, --human-numeric-sort    compare human readable numbers (e.g., 2K 1G)

  -n, --numeric-sort          compare according to string numerical value----数字排序

  -R, --random-sort           sort by random hash of keys

      --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;

                            for more 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

      --files0-from=F       read input from the files specified by

                            NUL-terminated names in file F;

                            If F is - then read names from standard input

  -k, --key=POS1[,POS2]     start a key at POS1 (origin 1), end it at POS2

                            (default end of line)-----具体字段排序

  -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

  -u, --unique              with -c, check for strict ordering;------结果不重复

                              without -c, output only the first of an equal run

  -z, --zero-terminated     end lines with 0 byte, not newline

      --help     display this help and exit

      --version  output version information and exit

 

POS is F[.C][OPTS], where F is the field number and C the character position

in the field; both are origin 1.  If neither -t nor -b is in effect, characters

in a field are counted from the beginning of the preceding whitespace.  OPTS is

one or more single-letter ordering options, which override global ordering

options for that key.  If no key is given, use the entire line as the key.

 

SIZE may be followed by the following multiplicative suffixes:

% 1% of memory, b 1, K 1024 (default), and so on for M, G, T, P, E, Z, Y.

 

With no FILE, or when FILE is -, read standard input.

 

*** WARNING ***

The locale specified by the environment affects sort order.

Set LC_ALL=C to get the traditional sort order that uses

native byte values.

 

Report sort bugs to bug-coreutils@gnu.org

GNU coreutils home page: <http://www.gnu.org/software/coreutils/>

General help using GNU software: <http://www.gnu.org/gethelp/>

For complete documentation, run: info coreutils 'sort invocation'

[root@szm szm]# yum install aspell-en

 

[root@szm szm]# yum install aspell

 

[root@szm szm]# aspell -c aspellword.txt -----------------单词拼写检查

[root@szm szm]# aspell list < aspellword.txt
appl
 
[root@szm szm]# tr --help ----------------------translation
Usage: tr [OPTION]... SET1 [SET2]
Translate, squeeze, and/or delete characters from standard input,
writing to standard output.
 
  -c, -C, --complement    use the complement of SET1
  -d, --delete            delete characters in SET1, do not translate----删除
  -s, --squeeze-repeats   replace each input sequence of a repeated character
                            that is listed in SET1 with a single occurrence
                            of that character-----转换
  -t, --truncate-set1     first truncate SET1 to length of SET2-----替换
      --help     display this help and exit
      --version  output version information and exit
 
SETs are specified as strings of characters.  Most represent themselves.
Interpreted sequences are:
 
  \NNN            character with octal value NNN (1 to 3 octal digits)
  \\              backslash--------倒斜线
  \a              audible BEL
  \b              backspace--------退格键
  \f              form feed
  \n              new line---------新行
  \r              return-----------执行操作之后返回
  \t              horizontal tab---水平制表位
  \v              vertical tab-----垂直制表位
  CHAR1-CHAR2     all characters from CHAR1 to CHAR2 in ascending order
  [CHAR*]         in SET2, copies of CHAR until length of SET1
  [CHAR*REPEAT]   REPEAT copies of CHAR, REPEAT octal if starting with 0
  [:alnum:]       all letters and digits
  [:alpha:]       all letters
  [:blank:]       all horizontal whitespace
  [:cntrl:]       all control characters
  [:digit:]       all digits
  [:graph:]       all printable characters, not including space
  [:lower:]       all lower case letters
  [:print:]       all printable characters, including space
  [:punct:]       all punctuation characters
  [:space:]       all horizontal or vertical whitespace
  [:upper:]       all upper case letters
  [:xdigit:]      all hexadecimal digits
  [=CHAR=]        all characters which are equivalent to CHAR
 
Translation occurs if -d is not given and both SET1 and SET2 appear.
-t may be used only when translating.  SET2 is extended to length of
SET1 by repeating its last character as necessary.  Excess characters
of SET2 are ignored.  Only [:lower:] and [:upper:] are guaranteed to
expand in ascending order; used in SET2 while translating, they may
only be used in pairs to specify case conversion.  -s uses SET1 if not
translating nor deleting; else squeezing uses SET2 and occurs after
translation or deletion.
 
Report tr bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'tr invocation'
 
 
[root@szm szm]# tr '[a-z]' '[A-Z]' < /etc/passwd | head -n 3
ROOT:X:0:0:ROOT:/ROOT:/BIN/BASH
BIN:X:1:1:BIN:/BIN:/SBIN/NOLOGIN
DAEMON:X:2:2:DAEMON:/SBIN:/SBIN/NOLOGIN
 
[root@szm szm]# head -n 3 /etc/passwd | tr -d ":"
rootx00root/root/bin/bash
binx11bin/bin/sbin/nologin
daemonx22daemon/sbin/sbin/nologin
[root@szm szm]# head -n 3 /etc/passwd | tr -t ":" "-"
root-x-0-0-root-/root-/bin/bash
bin-x-1-1-bin-/bin-/sbin/nologin
daemon-x-2-2-daemon-/sbin-/sbin/nologin
 

 

 

[root@szm szm]# sed --help

Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...

 

  -n, --quiet, --silent

                 suppress automatic printing of pattern space

  -e script, --script< /span>

                 add the script to the commands to be executed

  -f script-file, --file=script-file

                 add the contents of script-file to the commands to be executed

  --follow-symlinks

                 follow symlinks when processing in place; hard links

                 will still be broken.

  -i[SUFFIX], --in-place[=SUFFIX]

                 edit files in place (makes backup if extension supplied).

                 The default operation mode is to break symbolic and hard links.

                 This can be changed with --follow-symlinks and --copy.

  -c, --copy

                 use copy instead of rename when shuffling files in -i mode.

                 While this will avoid breaking links (symbolic or hard), the

                 resulting editing operation is not atomic.  This is rarely

                 the desired mode; --follow-symlinks is usually enough, and

                 it is both faster and more secure.

  -l N, --line-length=N

                 specify the desired line-wrap length for the `l' command

  --posix

                 disable all GNU extensions.

  -r, --regexp-extended

                 use extended regular expressions in the script.

  -s, --separate

                 consider files as separate rather than as a single continuous

                 long stream.

  -u, --unbuffered

                 load minimal amounts of data from the input files and flush

                 the output buffers more often

      --help     display this help and exit

      --version  output version information and exit

 

If no -e, --expression, -f, or --file option is given, then the first

non-option argument is taken as the sed script to interpret.  All

remaining arguments are names of input files; if no input files are

specified, then the standard input is read.

 

GNU sed home page: <http://www.gnu.org/software/sed/>.

General help using GNU software: <http://www.gnu.org/gethelp/>.

E-mail bug reports to: <bug-gnu-utils@gnu.org>.

Be sure to include the word ``sed'' somewhere in the ``Subject:'' field.

新增:a
替换:c
删除:d
插入:i
输出:p
查找与替换:s
 
[root@szm szm]# cat -n /etc/passwd | sed '3,$d'-----删除
     1 root:x:0:0:root:/root:/bin/bash
     2 bin:x:1:1:bin:/bin:/sbin/nologin
[root@szm szm]# sed '1,3s/root/administrator/gi' /etc/passwd | head------查找替换
administrator:x:0:0:administrator:/administrator:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
uucp:x:10:14:uucp:/var/spool/uucp:/sbin/nologin
[root@szm szm]# sed -n '5,7p' /etc/passwd-------安装模式输出变-i为直接修改原文件
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
[root@szm szm]# sed '1,1c no root account!!!!!!' /etc/passwd | head -n 3
no root account!!!!!!
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
[root@szm szm]# sed -e 's/#.*$//g' -e '/^$/d' /etc/vsftpd/vsftpd.conf  ----删除空行和#
anonymous_enable=YES
local_enable=YES
write_enable=YES
local_umask=022
anon_upload_enable=YES
anon_mkdir_write_enable=YES
dirmessage_enable=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_std_format=YES
listen=YES
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
 
[root@szm szm]# chown szm:szm diff.path -------------------用户和组的修改
 
 管理员umask:022
 普通用户umask:002
 
 
 硬盘主引导分区:446字节  分区表:16*4字节  2字节55AA
 IDE最多63个分区;SCSI最多15个分区
 
 
 系统会为每一个新建的目录分配一个4096大小的块用于存放文件或目录,在这个4096大小的数据快中,最多只能存放256目录或文件,当目录中的文件数量超过256时,系统会自动以整数位放大目录所需要的数据块大小。
 
 
 [root@szm inode]# for i in $(seq 1 253); do touch $i.txt; done
[root@szm inode]# ls -ldi ../inode/
660078 drwxr-xr-x. 2 root root 4096 Mar  7 09:28 ../inode/
[root@szm inode]# ls -a | wc
    255     255    1921
[root@szm inode]# touch aaa.txt
[root@szm inode]# touch bbb.txt
[root@szm inode]# ls -a | wc
    257     257    1937
 [root@szm inode]# ls -dl ../inode/
drwxr-xr-x. 2 root root 12288 Mar  7 09:30 ../inode/ ------------4096的3倍
[root@szm inode]# rm -f *
[root@szm inode]# ls -l | wc
      1       2       8
[root@szm inode]# ls -lid ../inode ---------------放大后不会自动Inode和Block
660078 drwxr-xr-x. 2 root root 12288 Mar  7 09:34 ../inode/
 
  注意:
     ext3文件系统中,开发人员专门划分出一块专用的空间来存放发生变化的源数据(Metadata),目的就是为了防止文件系统发生意外后,检查与修复过程无需对整个文件系统中的所有数据,面只需要检查这块用于存放数据发生变化的记录中的信息,从而大大提高了文件系统的修复速度与安全性。 
 
 

 文件名称是从Inode中分离出来的,在Ext2和Ext3中是这样的

 硬链接文件不能跨文件系统,也不能对目录创建硬连接,硬链接不占用空间

 

 扩展分区ID号一般为5

 [root@szm inode]# fdisk --help

fdisk: invalid option -- '-'

 

Usage:

 fdisk [options] <disk>    change partition table

 fdisk [options] -l <disk> list partition table(s)

 fdisk -s <partition>      give partition size(s) in blocks

 

Options:

 -b <size>                 sector size (512, 1024, 2048 or 4096)

 -c                        switch off DOS-compatible mode

 -h                        print help

 -u <size>                 give sizes in sectors instead of cylinders--扇区代替柱面号

 -v                        print version

 -C <number>               specify the number of cylinders

 -H <number>               specify the number of heads

 -S <number>               specify the number of sectors per track

[root@szm inode]# fdisk /dev/sda
 
WARNING: DOS-compatible mode is deprecated. It's strongly recommended to
         switch off the mode (command 'c') and change display units to
         sectors (command 'u').
 
Command (m for help): m
Command action
   a   toggle a bootable flag ----------------设置引导分区
   b   edit bsd disklabel --------------------设置BSD分区卷标
   c   toggle the dos compatibility flag -----设置DOS兼容分区
   d   delete a partition --------------------删除一个分区
   l   list known partition types ------------查看支持分区类型
   m   print this menu
   n   add a new partition
   o   create a new empty DOS partition table ---创建空的DOS分区表
   p   print the partition table ----------------显示分区信息
   q   quit without saving changes
   s   create a new empty Sun disklabel ---------新建空的SUN卷标
   t   change a partition's system id -----------更改分区类型
   u   change display/entry units ---------------显示硬盘可用空间
   v   verify the partition table ---------------校验分区表
   w   write table to disk and exit -------------保存对分区的修改操作
   x   extra functionality (experts only) -------找开扩展功能
 
Command (m for help): 
[root@szm fdisk]# sfdisk -d /dev/sda > sda.table --------------------分区表的备份
[root@szm fdisk]# cat sda.table 
# partition table of /dev/sda
unit: sectors
 
/dev/sda1 : start=     2048, size=  1024000, Id=83, bootable
/dev/sda2 : start=  1026048, size= 40916992, Id=8e
/dev/sda3 : start=        0, size=        0, Id= 0
/dev/sda4 : start=        0, size=        0, Id= 0
 

 

[root@szm fdisk]# mkfs --help

mkfs.ext2: invalid option -- '-'

Usage: mkfs.ext2 [-c|-l filename] [-b block-size] [-f fragment-size]

[-i bytes-per-inode] [-I inode-size] [-J journal-options]

[-G meta group size] [-N number-of-inodes]

[-m reserved-blocks-percentage]--保留块比率 [-o creator-os]

[-g blocks-per-group] [-L volume-label] [-M last-mounted-directory]

[-O feature[,...]] [-r fs-revision] [-E extended-option[,...]]

[-T fs-type] [-U UUID] [-jnqvFKSV] device [blocks-count]

[root@szm fdisk]# dumpe2fs /dev/sda1 -----用于查看Ext文件系统
dumpe2fs 1.41.12 (17-May-2010)
Filesystem volume name:   <none> ---卷标
Last mounted on:          /boot ----最后挂载点
Filesystem UUID:          17968cbe-9f85-42bf-bad1-a341e83b1632
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent flex_bg sparse_super huge_file uninit_bg dir_nlink extra_isize
----------------文件系统功能
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              128016
Block count:              512000
Reserved block count:     25600-------保留
Free blocks:              425482
Free inodes:              127966
First block:              1
Block size:               1024
Fragment size:            1024
Reserved GDT blocks:      256
Blocks per group:         8192
Fragments per group:      8192
Inodes per group:         2032
Inode blocks per group:   254-----Inode块组大小
Flex block group size:    16
Filesystem created:       Mon Mar 12 07:52:54 2012
Last mount time:          Tue Mar  5 21:58:46 2013
Last write time:          Tue Mar  5 21:58:46 2013
Mount count:              19-----挂载次数
Maximum mount count:      -1-----最大挂载次数
Last checked:             Mon Mar 12 07:52:54 2012
Check interval:           0 (<none>)------文件系统健康检查间隔
Lifetime writes:          137 MB
Reserved blocks uid:      0 (user root)----保留块用户身份
Reserved blocks gid:      0 (group root)---保留块组身份
First inode:              11
Inode size:          128
Journal inode:            8----------------日志Inode数
Default directory hash:   half_md4
Directory Hash Seed:      d2bbb852-9130-486a-978b-ed0694e3089c
Journal backup:           inode blocks-----日志备份Inode块
Journal features:         (none)
Journal size:             8M
Journal length:           8192
Journal sequence:         0x00000090
Journal start:            1
 

 

 

Group 0: (Blocks 1-8192) [ITABLE_ZEROED]

  Checksum 0xd0ce, unused inodes 2003

  Primary superblock at 1, Group descriptors at 2-3--------超级块及组描述信息位置

  Reserved GDT blocks at 4-259

  Block bitmap at 260 (+259), Inode bitmap at 276 (+275)----块与Inode位图位置

  Inode table at 292-545 (+291)-----------------------------Inode索引表位置

  3810 free blocks, 2003 free inodes, 2 directories, 2003 unused inodes

  Free blocks: 4383-8192

  Free inodes: 30-2032

Group 1: (Blocks 8193-16384) [INODE_UNINIT, ITABLE_ZEROED]

  Checksum 0xa17b, unused inodes 2032

  Backup superblock at 8193, Group descriptors at 8194-8195

  Reserved GDT blocks at 8196-8451

  Block bitmap at 261, Inode bitmap at 277

  Inode table at 546-799

  1822 free blocks, 2032 free inodes, 0 directories, 2032 unused inodes

  Free blocks: 10169-10240, 12756-14336, 16216-16384

  Free inodes: 2033-4064

Group 2: (Blocks 16385-24576) [INODE_UNINIT, ITABLE_ZEROED]

  Checksum 0x7a1a, unused inodes 2032

  Block bitmap at 262, Inode bitmap at 278

  Inode table at 800-1053

  615 free blocks, 2032 free inodes, 0 directories, 2032 unused inodes

  Free blocks: 18188-18432, 22159-22528

  Free inodes: 4065-6096

Group 3: (Blocks 24577-32768) [INODE_UNINIT, ITABLE_ZEROED]

  Checksum 0x2284, unused inodes 2032

  Backup superblock at 24577, Group descriptors at 24578-24579

  Reserved GDT blocks at 24580-24835

  Block bitmap at 263, Inode bitmap at 279

  Inode table at 1054-1307

  1789 free blocks, 2032 free inodes, 0 directories, 2032 unused inodes

  Free blocks: 24836-26624

  Free inodes: 6097-8128

……

 

 文件系统一旦创建,很多关键参数就不能再更改了,如Inode节点的数量,Block块的大小,SuperBlock,BlockGroup,Inode Size等都会固定下来。使用Tune2fs可以修改一定的参数。