Linux經常使用命令

1:  shutdown

[root@cairui ~]# shutdown --help
Usage: shutdown [OPTION]... TIME [MESSAGE]  #使用
Bring the system down.

Options:
  -r                          reboot after shutdown            #重啓,也能夠直接使用 reboot 命令
  -h                          halt or power off after shutdown      #shutdown -h(halt) 直接關機(關閉電源)
  -H                          halt after shutdown (implies -h)      #shutdown -h now[+10]  如今關機(+10標識10分鐘以後關機

-P power off after shutdown (implies -h)  #電源關閉在關機以後 -c cancel a running shutdown          #取消關機 -k only send warnings, don't shutdown     -q, --quiet reduce output to errors only -v, --verbose increase output to include informational messages --help display this help and exit --version output version information and exit TIME may have different formats, the most common is simply the word 'now' which will bring the system down immediately. Other valid formats are +m, where m is the number of minutes to wait until shutting down and hh:mm which specifies the time on the 24hr clock. Logged in users are warned by a message sent to their terminal, you may include an optional MESSAGE included with this. Messages can be sent without actually bringing the system down by using the -k option. If TIME is given, the command will remain in the foreground until the shutdown occurs. It can be cancelled by Control-C, or by another user using the -c option. The system is brought down into maintenance (single-user) mode by default, you can change this with either the -r or -h option which specify a reboot or system halt respectively. The -h option can be further modified with -H or -P to specify whether to halt the system, or to power it off afterwards. The default is left up to the shutdown scripts. Report bugs at <https://launchpad.net/upstart/+bugs>

 

2:  ls

[root@cairui ~]# ls --help
Usage: ls [OPTION]... [FILE]...
List information about the FILEs (the current directory by default).  #列出關於文件的信息
Sort entries alphabetically if none of -cftuvSUX nor --sort.  #排序

Mandatory arguments to long options are mandatory for short options too.
  -a, --all                  do not ignore entries starting with .  #列出全部信息
  -A, --almost-all           do not list implied . and ..  #不列出 .and..
      --author               with -l, print the author of each file  #配合-l,打印出其餘的文件
  -b, --escape               print octal escapes for nongraphic characters
      --block-size=SIZE      use SIZE-byte blocks.  See SIZE format below
  -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
  -C                         list entries by columns
      --color[=WHEN]         colorize the output.  WHEN defaults to `always'
                               or can be `never' or `auto'.  More info below
  -d, --directory list directory entries instead of contents,  #列出目錄入口處,而不是內容並且不符號連接
                               and do not dereference symbolic links
  -D, --dired                generate output designed for Emacs' dired mode
  -f                         do not sort, enable -aU, disable -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
      --full-time            like -l --time-style=full-iso
  -g                         like -l, but do not list owner
      --group-directories-first
                             group directories before files.
                               augment with a --sort option, but any
                               use of --sort=none (-U) disables grouping
  -G, --no-group             in a long listing, don't print group names
  -h, --human-readable       with -l, print sizes in human readable format
                               (e.g., 1K 234M 2G)    #列出的信息以人們易讀的形式
      --si                   likewise, but use powers of 1000 not 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)
      --indicator-style=WORD  append indicator with style WORD to entry names:
                               none (default), slash (-p),
                               file-type (--file-type), classify (-F)
  -i, --inode                print the index number of each file
  -I, --ignore=PATTERN       do not list implied entries matching shell PATTERN
  -k                         like --block-size=1K
  -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
  -N, --literal              print raw entry names (don't treat e.g. control
                               characters specially)
  -o                         like -l, but do not list group information
  -p, --indicator-style=slash
                             append / indicator to directories
  -q, --hide-control-chars   print ? instead of non graphic characters
      --show-control-chars   show non graphic characters as-is (default
                             unless program is `ls' and output is a terminal)
  -Q, --quote-name           enclose entry names in double quotes
      --quoting-style=WORD   use quoting style WORD for entry names:
                               literal, locale, shell, shell-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
      --sort=WORD            sort by WORD instead of name: none -U,
                             extension -X, size -S, time -t, version -v
      --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 as sort key
                             if --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 applies to
                             non-recent files and FORMAT2 to recent files;
                             if STYLE is prefixed with `posix-', STYLE
                             takes effect only outside the POSIX locale
  -t                         sort by modification time    #按照修改時間排序
  -T, --tabsize=COLS         assume tab stops at each COLS instead of 8
  -u                         with -lt: sort by, and show, access time
                               with -l: show access time and sort by name
                               otherwise: sort by access time
  -U                         do not sort; list entries in directory order
  -v                         natural sort of (version) numbers within text
  -w, --width=COLS           assume screen width instead of current value
  -x                         list entries by lines instead of by columns
  -X                         sort alphabetically by entry extension
  -1                         list one file per line

SELinux options:

  --lcontext                 Display security context.   Enable -l. Lines
                             will probably be too wide for most displays.
  -Z, --context              Display security context so it fits on most
                             displays.  Displays only mode, user, group,
                             security context and file name.
  --scontext                 Display only security context and file name.
      --help     display this help and exit
      --version  output version information and exit

SIZE may be (or may be an integer optionally followed by) one of following:
KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.

Using color to distinguish file types is disabled both by default and
with --color=never.  With --color=auto, ls emits color codes only when
standard output is connected to a terminal.  The LS_COLORS environment
variable can change the settings.  Use the dircolors command to set it.

Exit status:
 0  if OK,
 1  if minor problems (e.g., cannot access subdirectory),
 2  if serious trouble (e.g., cannot access command-line argument).

Report ls 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 'ls invocation'

 

3:  pwd

pwd - print name of current/working directory  #打印當前或者工做目錄的路徑

 

4:  touch

[root@cairui etc]# touch --help
Usage: touch [OPTION]... FILE...  #用法
Update the access and modification times of each FILE to the current time.  #更新訪問和修改時間到最新時間

A FILE argument that does not exist is created empty, unless -c or -h
is supplied.

A FILE argument string of - is handled specially and causes touch to
change the times of the file associated with standard output.

Mandatory arguments to long options are mandatory for short options too.
  -a                     change only the access time  #僅修改訪問時間
  -c, --no-create        do not create any files  #不建立任何文件
  -d, --date=STRING      parse STRING and use it instead of current time 
  -f                     (ignored)
  -h, --no-dereference   affect each symbolic link instead of any referenced
                         file (useful only on systems that can change the
                         timestamps of a symlink)
  -m                     change only the modification time
  -r, --reference=FILE   use this file's times instead of current time  #使用這個文件的時間而不是如今的時間,指定和某個文件時間相同
  -t STAMP               use [[CC]YY]MMDDhhmm[.ss] instead of current time  #指定時間
  --time=WORD            change the specified time:
                           WORD is access, atime, or use: equivalent to -a
                           WORD is modify or mtime: equivalent to -m
      --help     display this help and exit
      --version  output version information and exit

Note that the -d and -t options accept different time-date formats.

Report touch 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 'touch invocation'

 

5:  mkdir

[root@cairui tmp]# 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  #設置文件mode,相似於chmod
  -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
      When COREUTILS_CHILD_DEFAULT_ACLS environment variable is set, -p/--parents
      option respects default umask and ACLs, as it does in Red Hat Enterprise Linux 7 by default
            --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'

 

6:  rm,rmdir(刪除空目錄)

[root@cairui tmp]# 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'

 

7:  who

[root@localhost ~]# who --help
用法:who [選項]... [ 文件 | 參數1 參數2 ]
顯示當前已登陸的用戶信息。

  -a, --all        等於-b -d --login -p -r -t -T -u 選項的組合
  -b, --boot        上次系統啓動時間
  -d, --dead        顯示已死的進程
  -H, --heading    輸出頭部的標題列
  -l,--login        顯示系統登陸進程
      --lookup        嘗試經過 DNS 查驗主機名
  -m            只面對和標準輸入有直接交互的主機和用戶
  -p, --process    顯示由 init 進程衍生的活動進程
  -q, --count        列出全部已登陸用戶的登陸名與用戶數量
  -r, --runlevel    顯示當前的運行級別
  -s, --short        只顯示名稱、線路和時間(默認)
  -T, -w, --mesg    用+,- 或 ? 標註用戶消息狀態
  -u, --users        列出已登陸的用戶
      --message    等於-T
      --writable    等於-T
      --help        顯示此幫助信息並退出
      --version        顯示版本信息並退出

若是文件未被指定,則使用/var/run/utmp。/var/log/wtmp 是通用的相關文件。
若是給定了參數1 和參數2,-m 會假定:"am i""mom likes"
爲參數。

請向bug-coreutils@gnu.org 報告who 的錯誤
GNU coreutils 項目主頁:<http://www.gnu.org/software/coreutils/>
GNU 軟件通常性幫助:<http://www.gnu.org/gethelp/>
請向<http://translationproject.org/team/zh_CN.html> 報告who 的翻譯錯誤
要獲取完整文檔,請運行:info coreutils 'who invocation'

 

8:  w

[root@localhost ~]# w --help
w£ºÎÞЧѡÏî -- -
usage: w -hlsufV [user]
    -h    skip header
    -l    long listing (default)
    -s    short listing
    -u    ignore uid of processes
    -f    toggle FROM field (default on)
    -i    display IP address instead of hostname (if possible)
    -V    display version

 

9:  cp

[root@localhost ~]# cp --help
用法:cp [選項]... [-T] 源文件 目標文件
 或:cp [選項]... 源文件... 目錄
 或:cp [選項]... -t 目錄 源文件...
將源文件複製至目標文件,或將多個源文件複製至目標目錄。

長選項必須使用的參數對於短選項時也是必需使用的。
  -a, --archive            等於-dR --preserve=all
      --backup[=CONTROL        爲每一個已存在的目標文件建立備份
  -b                相似--backup 但不接受參數
      --copy-contents        在遞歸處理是複製特殊文件內容
  -d                等於--no-dereference --preserve=links
  -f, --force            若是目標文件沒法打開則將其移除並重試(當 -n 選項
                    存在時則不需再選此項)
  -i, --interactive        覆蓋前詢問(使前面的 -n 選項失效)
  -H                跟隨源文件中的命令行符號連接
  -l, --link            連接文件而不復制
  -L, --dereference        老是跟隨符號連接
  -n, --no-clobber        不要覆蓋已存在的文件(使前面的 -i 選項失效)
  -P, --no-dereference        不跟隨源文件中的符號連接
  -p                等於--preserve=模式,全部權,時間戳
      --preserve[=屬性列表    保持指定的屬性(默認:模式,全部權,時間戳),若是
                    可能保持附加屬性:環境、連接、xattr 等
  -c                           same as --preserve=context
      --sno-preserve=屬性列表    不保留指定的文件屬性
      --parents            複製前在目標目錄建立來源文件路徑中的全部目錄
  -R, -r, --recursive        遞歸複製目錄及其子目錄內的全部內容
      --reflink[=WHEN]        控制克隆/CoW 副本。請查看下面的內如。
      --remove-destination    嘗試打開目標文件前先刪除已存在的目的地
                    文件 (相對於 --force 選項)
      --sparse=WHEN        控制建立稀疏文件的方式
      --strip-trailing-slashes    刪除參數中全部源文件/目錄末端的斜槓
  -s, --symbolic-link        只建立符號連接而不復制文件
  -S, --suffix=後綴        自行指定備份文件的後綴
  -t,  --target-directory=目錄    將全部參數指定的源文件/目錄
                                           複製至目標目錄
  -T, --no-target-directory    將目標目錄視做普通文件
  -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        顯示此幫助信息並退出
      --version        顯示版本信息並退出

默認狀況下,源文件的稀疏性僅僅經過簡單的方法判斷,對應的目標文件目標文件也
被爲稀疏。這是由於默認狀況下使用了--sparse=auto 參數。若是明確使用
--sparse=always 參數則不論源文件是否包含足夠長的0 序列也將目標文件創文
建爲稀疏件。
使用--sparse=never 參數禁止建立稀疏文件。

當指定了--reflink[=always] 參數時執行輕量化的複製,即只在數據塊被修改的
狀況下才複製。若是複製失敗或者同時指定了--reflink=auto,則返回標準複製模式。

備份文件的後綴爲"~",除非以--suffix 選項或是SIMPLE_BACKUP_SUFFIX
環境變量指定。版本控制的方式可經過--backup 選項或VERSION_CONTROL 環境
變量來選擇。如下是可用的變量值:

  none, off       不進行備份(即便使用了--backup 選項)
  numbered, t     備份文件加上數字進行排序
  existing, nil   如有數字的備份文件已經存在則使用數字,不然使用普通方式備份
  simple, never   永遠使用普通方式備份

有一個特別狀況:若是同時指定--force 和--backup 選項,而源文件和目標文件
是同一個已存在的通常文件的話,cp 會將源文件備份。

請向bug-coreutils@gnu.org 報告cp 的錯誤
GNU coreutils 項目主頁:<http://www.gnu.org/software/coreutils/>
GNU 軟件通常性幫助:<http://www.gnu.org/gethelp/>
請向<http://translationproject.org/team/zh_CN.html> 報告cp 的翻譯錯誤
要獲取完整文檔,請運行:info coreutils 'cp invocation'

 

10:  mv

[root@localhost ~]# mv --help
用法:mv [選項]... [-T] 源文件 目標文件
 或:mv [選項]... 源文件... 目錄
 或:mv [選項]... -t 目錄 源文件...
將源文件重命名爲目標文件,或將源文件移動至指定目錄。

長選項必須使用的參數對於短選項時也是必需使用的。
      --backup[=CONTROL]       爲每一個已存在的目標文件建立備份
  -b                           相似--backup 但不接受參數  #覆蓋前備份
  -f, --force 覆蓋前不詢問 -i, --interactive            覆蓋前詢問
  -n, --no-clobber             不覆蓋已存在文件
若是您指定了-i、-f、-n 中的多個,僅最後一個生效。
      --strip-trailing-slashes    去掉每一個源文件參數尾部的斜線
  -S, --suffix=SUFFIX        替換經常使用的備份文件後綴
  -t, --target-directory=DIRECTORY    將全部參數指定的源文件或目錄  #將目錄下全部內容移動到指定目錄
                    移動至 指定目錄
  -T, --no-target-directory    將目標文件視做普通文件處理
  -u, --update            只在源文件文件比目標文件新,或目標文件
                不存在時才進行移動
  -v, --verbose        詳細顯示進行的步驟
      --help        顯示此幫助信息並退出
      --version        顯示版本信息並退出

備份文件的後綴爲"~",除非以--suffix 選項或是SIMPLE_BACKUP_SUFFIX
環境變量指定。版本控制的方式可經過--backup 選項或VERSION_CONTROL 環境
變量來選擇。如下是可用的變量值:

  none, off       不進行備份(即便使用了--backup 選項)
  numbered, t     備份文件加上數字進行排序
  existing, nil   如有數字的備份文件已經存在則使用數字,不然使用普通方式備份
  simple, never   永遠使用普通方式備份

請向bug-coreutils@gnu.org 報告mv 的錯誤
GNU coreutils 項目主頁:<http://www.gnu.org/software/coreutils/>
GNU 軟件通常性幫助:<http://www.gnu.org/gethelp/>
請向<http://translationproject.org/team/zh_CN.html> 報告mv 的翻譯錯誤
要獲取完整文檔,請運行:info coreutils 'mv invocation'

 

11:  ifconfig

[cairui@localhost ~]$ ifconfig --help
Usage:
  ifconfig [-a] [-v] [-s] <interface> [[<AF>] <address>]
  [add <address>[/<prefixlen>]]
  [del <address>[/<prefixlen>]]
  [[-]broadcast [<address>]]  [[-]pointopoint [<address>]]
  [netmask <address>]  [dstaddr <address>]  [tunnel <address>]
  [outfill <NN>] [keepalive <NN>]
  [hw <HW> <address>]  [metric <NN>]  [mtu <NN>]
  [[-]trailers]  [[-]arp]  [[-]allmulti]
  [multicast]  [[-]promisc]
  [mem_start <NN>]  [io_addr <NN>]  [irq <NN>]  [media <type>]
  [txqueuelen <NN>]
  [[-]dynamic]
  [up|down] ...

  <HW>=Hardware Type.
  List of possible hardware types:
    loop (Local Loopback) slip (Serial Line IP) cslip (VJ Serial Line IP) 
    slip6 (6-bit Serial Line IP) cslip6 (VJ 6-bit Serial Line IP) adaptive (Adaptive Serial Line IP) 
    strip (Metricom Starmode IP) ash (Ash) ether (Ethernet) 
    tr (16/4 Mbps Token Ring) tr (16/4 Mbps Token Ring (New)) ax25 (AMPR AX.25) 
    netrom (AMPR NET/ROM) rose (AMPR ROSE) tunnel (IPIP Tunnel) 
    ppp (Point-to-Point Protocol) hdlc ((Cisco)-HDLC) lapb (LAPB) 
    arcnet (ARCnet) dlci (Frame Relay DLCI) frad (Frame Relay Access Device) 
    sit (IPv6-in-IPv4) fddi (Fiber Distributed Data Interface) hippi (HIPPI) 
    irda (IrLAP) ec (Econet) x25 (generic X.25) 
    infiniband (InfiniBand) 
  <AF>=Address family. Default: inet
  List of possible address families:
    unix (UNIX Domain) inet (DARPA Internet) inet6 (IPv6) 
    ax25 (AMPR AX.25) netrom (AMPR NET/ROM) rose (AMPR ROSE) 
    ipx (Novell IPX) ddp (Appletalk DDP) ec (Econet) 
    ash (Ash) x25 (CCITT X.25) 

 

12:  tar

[root@localhost ~]# tar --help
用法: tar [選項...] [FILE]...
 GNU ‘tar將許多文件一塊兒保存至一個單獨的磁帶或磁盤歸檔,並能從歸檔中單獨還原所需文件。

示例
  tar -cf archive.tar foo bar  # 從文件 foo 和 bar 建立歸檔文件
archive.tartar -tvf archive.tar         # 詳細列舉歸檔文件 archive.tar
中的全部文件。
  tar -xf archive.tar          # 展開歸檔文件 archive.tar
中的全部文件。

 主操做模式:

  -A, --catenate, --concatenate   追加 tar 文件至歸檔
  -c, --create               建立一個新歸檔
  -d, --diff, --compare      找出歸檔和文件系統的差別
      --delete               從歸檔(非磁帶!)中刪除
  -r, --append               追加文件至歸檔結尾
  -t, --list                 列出歸檔內容
      --test-label           測試歸檔卷標並退出
  -u, --update               僅追加比歸檔中副本更新的文件
  -x, --extract, --get 從歸檔中解出文件  #解壓縮

 操做修飾符:

      --check-device         當建立增量歸檔時檢查設備號(默認)
  -g, --listed-incremental=FILE   處理新式的 GNU 格式的增量備份
  -G, --incremental          處理老式的 GNU 格式的增量備份
      --ignore-failed-read
                             當趕上不可讀文件時不要以非零值退出
      --level=NUMBER         所建立的增量列表歸檔的輸出級別
  -n, --seek                 歸檔可檢索
      --no-check-device      當建立增量歸檔時不要檢查設備號
      --no-seek              歸檔不可檢索
      --occurrence[=NUMBER]  僅處理歸檔中每一個文件的第 NUMBER
                             個事件;僅當與如下子命令 --delete,
                             --diff, --extract 或是 --list
                             中的一個聯合使用時,此選項纔有效。並且無論文件列表是以命令行形式給出或是經過
                             -T 選項指定的;NUMBER 值默認爲 1
      --sparse-version=MAJOR[.MINOR]
                             設置所用的離散格式版本(隱含
                             --sparse)
  -S, --sparse               高效處理離散文件

 重寫控制:

  -k, --keep-old-files       don't replace existing files when extracting,
                             treat them as errors
      --keep-newer-files
                             不要替換比歸檔中副本更新的已存在的文件
      --no-overwrite-dir     保留已存在目錄的元數據
      --overwrite            解壓時重寫存在的文件
      --overwrite-dir
                             解壓時重寫已存在目錄的元數據(默認)
                            
      --recursive-unlink     解壓目錄以前先清除目錄層次
      --remove-files         在添加文件至歸檔後刪除它們
      --skip-old-files       don't replace existing files when extracting,
                             silently skip over them
  -U, --unlink-first         在解壓要重寫的文件以前先刪除它們
  -W, --verify               在寫入之後嘗試校驗歸檔

 選擇輸出流:

      --ignore-command-error 忽略子進程的退出代碼
      --no-ignore-command-error
                             將子進程的非零退出代碼認爲發生錯誤
  -O, --to-stdout            解壓文件至標準輸出
      --to-command=COMMAND
                             將解壓的文件經過管道傳送至另外一個程序

 操做文件屬性:

      --acls                 Save the ACLs to the archive
      --atime-preserve[=METHOD]
                             在輸出的文件上保留訪問時間,要麼經過在讀取(默認
                             METHOD=‘replace’)後還原時間,要不就不要在第一次(METHOD=‘system’)設置時間
      --delay-directory-restore
                             直到解壓結束才設置修改時間和所解目錄的權限
      --group=名稱         強制將 NAME
                             做爲所添加的文件的組全部者
      --mode=CHANGES         強制將所添加的文件(符號)更改成權限
                             CHANGES
      --mtime=DATE-OR-FILE   從 DATE-OR-FILE 中爲添加的文件設置 mtime
                            
  -m, --touch                不要解壓文件的修改時間
      --no-acls              Don't extract the ACLs from the archive
      --no-delay-directory-restore
                             取消 --delay-directory-restore 選項的效果
      --no-same-owner
                             將文件解壓爲您全部(普通用戶默認此項)
      --no-same-permissions
                             從歸檔中解壓權限時使用用戶的掩碼位(默認爲普通用戶服務)
      --no-selinux           Don't extract the SELinux context from the
                             archive
      --no-xattrs            Don't extract the user/root xattrs from the
                             archive
      --numeric-owner        老是以數字表明用戶/組的名稱
      --owner=名稱         強制將 NAME
                             做爲所添加的文件的全部者
  -p, --preserve-permissions, --same-permissions
                             解壓文件權限信息(默認只爲超級用戶服務)
      --preserve             與 -p 和 -s 同樣
      --same-owner
                             嘗試解壓時保持全部者關係一致(超級用戶默認此項)
  -s, --preserve-order, --same-order
                             爲解壓至匹配歸檔排序名稱
      --selinux              Save the SELinux context to the archive
      --xattrs               Save the user/root xattrs to the archive

 設備選擇和切換:

  -f, --file=ARCHIVE         使用歸檔文件或 ARCHIVE 設備
      --force-local
                             即便歸檔文件存在副本仍是把它認爲是本地歸檔
  -F, --info-script=名稱, --new-volume-script=名稱
                             在每卷磁帶最後運行腳本(隱含 -M)
  -L, --tape-length=NUMBER   寫入 NUMBER × 1024 字節後更換磁帶
  -M, --multi-volume         建立/列出/解壓多卷歸檔文件
      --rmt-command=COMMAND  使用指定的 rmt COMMAND 代替 rmt
      --rsh-command=COMMAND  使用遠程 COMMAND 代替 rsh
      --volno-file=FILE      使用/更新 FILE 中的卷數

 設備分塊:

  -b, --blocking-factor=BLOCKS   每一個記錄 BLOCKS x 512 字節
  -B, --read-full-records    讀取時從新分塊(只對 4.2BSD 管道有效)
  -i, --ignore-zeros         忽略歸檔中的零字節塊(即文件結尾)
      --record-size=NUMBER   每一個記錄的字節數 NUMBER,乘以 512

 選擇歸檔格式:

  -H, --format=FORMAT        建立指定格式的歸檔

 FORMAT 是如下格式中的一種:

    gnu                      GNU tar 1.13.x 格式
    oldgnu                   GNU 格式 as per tar <= 1.12
    pax                      POSIX 1003.1-2001 (pax) 格式
    posix                    等同於 pax
    ustar                    POSIX 1003.1-1988 (ustar) 格式
    v7                       old V7 tar 格式

      --old-archive, --portability
                             等同於 --format=v7
      --pax-option=關鍵字[[:]=值][,關鍵字[[:]=值]]...
                             控制 pax 關鍵字
      --posix                等同於 --format=posix
  -V, --label=TEXT           建立帶有卷名 TEXT
                             的歸檔;在列出/解壓時,使用 TEXT
                             做爲卷名的模式串

 壓縮選項:

  -a, --auto-compress        使用歸檔後綴名來決定壓縮程序
  -I, --use-compress-program=PROG
                             經過 PROG 過濾(必須是能接受 -d
                             選項的程序)
  -j, --bzip2                經過 bzip2 過濾歸檔
  -J, --xz                   經過 xz 過濾歸檔
      --lzip                 經過 lzip 過濾歸檔
      --lzma                 經過 lzma 過濾歸檔
      --lzop
      --no-auto-compress     不使用歸檔後綴名來決定壓縮程序
  -z, --gzip, --gunzip, --ungzip   經過 gzip 過濾歸檔
  -Z, --compress, --uncompress   經過 compress 過濾歸檔

 本地文件選擇:

      --add-file=FILE        添加指定的 FILE 至歸檔(若是名字以 -
                             開始會頗有用的)
      --backup[=CONTROL]     在刪除前備份,選擇 CONTROL 版本
  -C, --directory=DIR        改變至目錄 DIR
      --exclude=PATTERN      排除以 PATTERN 指定的文件
      --exclude-backups      排除備份和鎖文件
      --exclude-caches       除標識文件自己外,排除包含
                             CACHEDIR.TAG 的目錄中的內容
      --exclude-caches-all   排除包含 CACHEDIR.TAG 的目錄
      --exclude-caches-under 排除包含 CACHEDIR.TAG 的目錄中全部內容
                            
      --exclude-tag=FILE     除 FILE 自身外,排除包含 FILE
                             的目錄中的內容
      --exclude-tag-all=FILE 排除包含 FILE 的目錄
      --exclude-tag-under=FILE   排除包含 FILE 的目錄中的全部內容
      --exclude-vcs          排除版本控制系統目錄
  -h, --dereference
                             跟蹤符號連接;將它們所指向的文件歸檔並輸出
      --hard-dereference
                             跟蹤硬連接;將它們所指向的文件歸檔並輸出
  -K, --starting-file=MEMBER-NAME
                             從歸檔中的 MEMBER-NAME 成員處開始
      --newer-mtime=DATE     當只有數據改變時比較數據和時間
      --no-null              禁用上一次的效果 --null 選項
      --no-recursion         避免目錄中的自動降級
      --no-unquote           不以 -T 讀取的文件名做爲引用結束
      --null                 -T 讀取以空終止的名字,-C 禁用
  -N, --newer=DATE-OR-FILE, --after-date=DATE-OR-FILE
                             只保存比 DATE-OR-FILE 更新的文件
      --one-file-system      建立歸檔時保存在本地文件系統中
  -P, --absolute-names       不要從文件名中清除引導符‘/--recursion            目錄遞歸(默認)
      --suffix=STRING        在刪除前備份,除非被環境變量
                             SIMPLE_BACKUP_SUFFIX
                             覆蓋,不然覆蓋經常使用後綴(‘’)
  -T, --files-from=FILE      從 FILE
                             中獲取文件名來解壓或建立文件
      --unquote              以 -T
                             讀取的文件名做爲引用結束(默認)
  -X, --exclude-from=FILE    排除 FILE 中列出的模式串

 文件名變換:

      --strip-components=NUMBER   解壓時從文件名中清除 NUMBER
                             個引導部分
      --transform=EXPRESSION, --xform=EXPRESSION
                             使用 sed 代替 EXPRESSION
                             來進行文件名變換

 文件名匹配選項(同時影響排除和包括模式串):

      --anchored             模式串匹配文件名頭部
      --ignore-case          忽略大小寫
      --no-anchored          模式串匹配任意‘/’後字符(默認對
                             exclusion 有效)
      --no-ignore-case       匹配大小寫(默認)
      --no-wildcards         逐字匹配字符串
      --no-wildcards-match-slash   通配符不匹配‘/--wildcards            use wildcards (default)
      --wildcards-match-slash
                             通配符匹配‘/’(默認對排除操做有效)

 提示性輸出:

      --checkpoint[=NUMBER]  每隔 NUMBER
                             個記錄顯示進度信息(默認爲 10 個)
      --checkpoint-action=ACTION   在每一個檢查點上執行 ACTION
      --index-file=FILE      將詳細輸出發送至 FILE
  -l, --check-links
                             只要不是全部連接都被輸出就打印信息
      --no-quote-chars=STRING   禁用來自 STRING 的字符引用
      --quote-chars=STRING   來自 STRING 的額外的引用字符
      --quoting-style=STYLE  設置名稱引用風格;有效的 STYLE
                             值請參閱如下說明
  -R, --block-number         每一個信息都顯示歸檔內的塊數
      --show-defaults        顯示 tar 默認選項
      --show-omitted-dirs
                             列表或解壓時,列出每一個不匹配查找標準的目錄
      --show-transformed-names, --show-stored-names
                             顯示變換後的文件名或歸檔名
      --totals[=SIGNAL]      處理歸檔後打印出總字節數;當此
                             SIGNAL 被觸發時帶參數 -
                             打印總字節數;容許的信號爲:
                             SIGHUP,SIGQUIT,SIGINT,SIGUSR1 和
                             SIGUSR2;同時也接受不帶 SIG
                             前綴的信號名稱
      --utc                  以 UTC 格式打印文件修改信息
  -v, --verbose              詳細地列出處理的文件
      --warning=KEYWORD      警告控制:
  -w, --interactive, --confirmation
                             每次操做都要求確認

 兼容性選項:

  -o                         建立歸檔時,至關於
                             --old-archive;展開歸檔時,至關於
                             --no-same-owner

 其它選項:

  -?, --help                 顯示此幫助列表
      --restrict             禁用某些潛在的有危險的選項
      --usage                顯示簡短的用法說明
      --version              打印程序版本

長選項和相應短選項具備相同的強制參數或可選參數。

除非以 --suffix 或 SIMPLE_BACKUP_SUFFIX
設置備份後綴,不然備份後綴就是「~」。
能夠用 --backup 或 VERSION_CONTROL 設置版本控制,可能的值爲:

  none, off       從不作備份
  t, numbered     進行編號備份
  nil, existing
若是編號備份存在則進行編號備份,不然進行簡單備份
  never, simple   老是使用簡單備份

--quoting-style 選項的有效參數爲:

  literal
  shell
  shell-always
  c
  c-maybe
  escape
  locale
  clocale

此 tar 默認爲:
--format=gnu -f- -b20 --quoting-style=escape --rmt-command=/sbin/rmt
--rsh-command=/usr/bin/rsh

將錯誤報告發送到 <bug-tar@gnu.org>。

 

13:  date

[root@localhost ~]# date --help
用法:date [選項]... [+格式]
 或:date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
以給定的格式顯示當前時間,或是設置系統日期。

  -d,--date=字符串        顯示指定字符串所描述的時間,而非當前時間
  -f,--file=日期文件        相似--date,從日期文件中按行讀入時間描述
  -r, --reference=文件        顯示文件指定文件的最後修改時間
  -R, --rfc-2822        以RFC 2822格式輸出日期和時間
                例如:2006年8月7日,星期一 12:34:56 -0600
      --rfc-3339=TIMESPEC    以RFC 3339 格式輸出日期和時間。
                TIMESPEC=`date',`seconds',或 `ns' 
                表示日期和時間的顯示精度。
                日期和時間單元由單個的空格分開:
                2006-08-07 12:34:56-06:00
  -s, --set=字符串             設置指定字符串來分開時間
  -u, --utc, --universal    輸出或者設置協調的通用時間
      --help        顯示此幫助信息並退出
      --version        顯示版本信息並退出

給定的格式FORMAT 控制着輸出,解釋序列以下:

  %%    一個文字的 %
  %a    當前locale 的星期名縮寫(例如: 日,表明星期日)
  %A    當前locale 的星期名全稱 (如:星期日)
  %b    當前locale 的月名縮寫 (如:一,表明一月)
  %B    當前locale 的月名全稱 (如:一月)
  %c    當前locale 的日期和時間 (如:2005年3月3日 星期四 23:05:25)
  %C    世紀;好比 %Y,一般爲省略當前年份的後兩位數字(例如:20)
  %d    按月計的日期(例如:01)
  %D    按月計的日期;等於%m/%d/%y
  %e    按月計的日期,添加空格,等於%_d
  %F    完整日期格式,等價於 %Y-%m-%d
  %g    ISO-8601 格式年份的最後兩位 (參見%G)
  %G    ISO-8601 格式年份 (參見%V),通常只和 %V 結合使用
  %h    等於%b
  %H    小時(00-23)
  %I    小時(00-12)
  %j    按年計的日期(001-366)
  %k    時(0-23)
  %l    時(1-12)
  %m    月份(01-12)
  %M    分(00-59)
  %n    換行
  %N    納秒(000000000-999999999)
  %p    當前locale 下的"上午"或者"下午",未知時輸出爲空
  %P    與%p 相似,可是輸出小寫字母
  %r    當前locale 下的 12 小時時鐘時間 (如:11:11:04 下午)
  %R    24 小時時間的時和分,等價於 %H:%M
  %s    自UTC 時間 1970-01-01 00:00:00 以來所通過的秒數
  %S    秒(00-60)
  %t    輸出製表符 Tab
  %T    時間,等於%H:%M:%S
  %u    星期,1 表明星期一
  %U    一年中的第幾周,以週日爲每星期第一天(00-53)
  %V    ISO-8601 格式規範下的一年中第幾周,以週一爲每星期第一天(01-53)
  %w    一星期中的第幾日(0-6),0 表明週一
  %W    一年中的第幾周,以週一爲每星期第一天(00-53)
  %x    當前locale 下的日期描述 (如:12/31/99)
  %X    當前locale 下的時間描述 (如:23:13:48)
  %y    年份最後兩位數位 (00-99)
  %Y    年份
  %z +hhmm        數字時區(例如,-0400)
  %:z +hh:mm        數字時區(例如,-04:00)
  %::z +hh:mm:ss    數字時區(例如,-04:00:00)
  %:::z            數字時區帶有必要的精度 (例如,-04,+05:30)
  %Z            按字母表排序的時區縮寫 (例如,EDT)

默認狀況下,日期的數字區域以0 填充。
如下可選標記能夠跟在"%"後:

  - (連字符)不填充該域
  _ (下劃線)以空格填充
  0 (數字0)以0 填充
  ^ 若是可能,使用大寫字母
  # 若是可能,使用相反的大小寫

在任何標記以後還容許一個可選的域寬度指定,它是一個十進制數字。
做爲一個可選的修飾聲明,它能夠是E,在可能的狀況下使用本地環境關聯的
表示方式;或者是O,在可能的狀況下使用本地環境關聯的數字符號。

請向bug-coreutils@gnu.org 報告date 的錯誤
GNU coreutils 項目主頁:<http://www.gnu.org/software/coreutils/>
GNU 軟件通常性幫助:<http://www.gnu.org/gethelp/>
請向<http://translationproject.org/team/zh_CN.html> 報告date 的翻譯錯誤
要獲取完整文檔,請運行:info coreutils 'date invocation'

 

14:  cat

[root@localhost ~]# cat --help
用法:cat [選項]... [文件]...
將[文件]或標準輸入組合輸出到標準輸出。

  -A, --show-all           等於-vET
  -b, --number-nonblank    對非空輸出行編號
  -e                       等於-vE
  -E, --show-ends          在每行結束處顯示"$"
  -n, --number             對輸出的全部行編號
  -s, --squeeze-blank      不輸出多行空行
  -t                       與-vT 等價
  -T, --show-tabs          將跳格字符顯示爲^I
  -u                       (被忽略)
  -v, --show-nonprinting   使用^ 和M- 引用,除了LFD和 TAB 以外
      --help        顯示此幫助信息並退出
      --version        顯示版本信息並退出

若是沒有指定文件,或者文件爲"-",則從標準輸入讀取。

示例:
  cat f - g  先輸出f 的內容,而後輸出標準輸入的內容,最後輸出g 的內容。
  cat        將標準輸入的內容複製到標準輸出。

請向bug-coreutils@gnu.org 報告cat 的錯誤
GNU coreutils 項目主頁:<http://www.gnu.org/software/coreutils/>
GNU 軟件通常性幫助:<http://www.gnu.org/gethelp/>
請向<http://translationproject.org/team/zh_CN.html> 報告cat 的翻譯錯誤
要獲取完整文檔,請運行:info coreutils 'cat invocation'

將文件內容直接寫入另外一個文件(能夠不存在)此功能 與 echo 相似
html

文件合併功能
node

 

15.  chmod

[root@cairui ~]# chmod --help
Usage: chmod [OPTION]... MODE[,MODE]... FILE...
  or:  chmod [OPTION]... OCTAL-MODE FILE...
  or:  chmod [OPTION]... --reference=RFILE FILE...
Change the mode of each FILE to MODE.

  -c, --changes           like verbose but report only when a change is made
      --no-preserve-root  do not treat `/' specially (the default)
      --preserve-root     fail to operate recursively on `/'
  -f, --silent, --quiet   suppress most error messages
  -v, --verbose           output a diagnostic for every file processed
      --reference=RFILE   use RFILE's mode instead of MODE values
  -R, --recursive         change files and directories recursively   #遞歸修改文件及目錄  --help     display this help and exit
      --version  output version information and exit

Each MODE is of the form `[ugoa]*([-+=]([rwxXst]*|[ugo]))+'.

Report chmod 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 'chmod invocation'

 

1六、  chown

[root@cairui tmp]# chown --help
Usage: chown [OPTION]... [OWNER][:[GROUP]] FILE...
  or:  chown [OPTION]... --reference=RFILE FILE...
Change the owner and/or group of each FILE to OWNER and/or GROUP.  #改變s或所屬者者所屬組
With --reference, change the owner and group of each FILE to those of RFILE.

  -c, --changes          like verbose but report only when a change is made
      --dereference      affect the referent of each symbolic link (this is
                         the default), rather than the symbolic link itself
  -h, --no-dereference   affect each symbolic link instead of any referenced
                         file (useful only on systems that can change the
                         ownership of a symlink)
      --from=CURRENT_OWNER:CURRENT_GROUP
                         change the owner and/or group of each file only if
                         its current owner and/or group match those specified
                         here.  Either may be omitted, in which case a match
                         is not required for the omitted attribute.
      --no-preserve-root  do not treat `/' specially (the default)
      --preserve-root    fail to operate recursively on `/'
  -f, --silent, --quiet  suppress most error messages
      --reference=RFILE  use RFILE's owner and group rather than
                         specifying OWNER:GROUP values
  -R, --recursive        operate on files and directories recursively  #遞歸改變文件和目錄 -v, --verbose          output a diagnostic for every file processed

The following options modify how a hierarchy is traversed when the -R
option is also specified.  If more than one is specified, only the final
one takes effect.

  -H                     if a command line argument is a symbolic link
                         to a directory, traverse it
  -L                     traverse every symbolic link to a directory
                         encountered
  -P                     do not traverse any symbolic links (default)

      --help     display this help and exit
      --version  output version information and exit

Owner is unchanged if missing.  Group is unchanged if missing, but changed
to login group if implied by a `:' following a symbolic OWNER.
OWNER and GROUP may be numeric as well as symbolic.

Examples:
  chown root /u        Change the owner of /u to "root".
  chown root:staff /u  Likewise, but also change its group to "staff".  #所屬者:所屬組
  chown -hR root /u    Change the owner of /u and subfiles to "root".

Report chown 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 'chown invocation'

 

1七、  umask(修改默認權限)

umask [-p] [-S] [mode]
              The  user  file-creation  mask  is  set  to mode.  If mode
              begins with a digit, it is interpreted as an octal number;
              otherwise  it is interpreted as a symbolic mode mask simi-
              lar to that accepted by chmod(1).  If mode is omitted, the
              current  value  of  the  mask  is  printed.  The -S option
              causes the mask  to  be  printed  in  symbolic  form;  the
              default  output  is  an octal number.  If the -p option is
              supplied, and mode is omitted, the output  is  in  a  form
              that  may  be  reused as input.  The return status is 0 if
              the mode was successfully changed or if no  mode  argument
              was supplied, and false otherwise.

默認狀況下,目錄權限是755,文件權限是644linux

 

1八、  chattr

chattr +i(-i)  文件名  鎖定文件(取消鎖定)不可刪除與清空git

chattr +a(-a)  文件名  添加內容(只可添加內容)正則表達式

lsattr  文件名  查看文件特殊屬性shell

 

1九、  grep

[root@cairui ~]# grep --help
Usage: grep [OPTION]... PATTERN [FILE]...
Search for PATTERN in each FILE or standard input.  #搜索正則匹配在每一個文件中或標準輸出中。
PATTERN is, by default, a basic regular expression (BRE).
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 expression (BRE)
  -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             display version information and exit
      --help                display this help text and exit

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 file name for each match
  -h, --no-filename         suppress the file name prefix on output
      --label=LABEL         use LABEL as the standard input file name prefix
  -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, --recursive           like --directories=recurse
  -R, --dereference-recursive
                            likewise, but follow all symlinks
      --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
      --group-separator=SEP use SEP as a group separator
      --no-group-separator  use empty string as a group separator
      --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/Windows)
  -u, --unix-byte-offsets   report offsets as if CRs were not there
                            (MSDOS/Windows)

'egrep' means 'grep -E'.  'fgrep' means 'grep -F'.  #important
Direct invocation as either 'egrep' or 'fgrep' is deprecated.
When FILE is -, read standard input.  With no FILE, read . if a command-line
-r is given, - otherwise.  If fewer than two FILEs are given, assume -h.
Exit status is 0 if any line is selected, 1 otherwise;
if any error occurs and -q is 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/>

 

20、  sed

[root@cairui ~]# sed --help
Usage: sed [OPTION]... {script-only-if-no-other-script} [input-file]...

  -n, --quiet, --silent
                 suppress automatic printing of pattern space  #取消默認輸出 -e script, --expression=script
                 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.

 

2一、  awk

[root@cairui ~]# awk --help
Usage: awk [POSIX or GNU style options] -f progfile [--] file ...
Usage: awk [POSIX or GNU style options] [--] 'program' file ...
POSIX options:        GNU long options:
    -f progfile        --file=progfile
    -F fs            --field-separator=fs
    -v var=val        --assign=var=val
    -m[fr] val
    -O            --optimize
    -W compat        --compat
    -W copyleft        --copyleft
    -W copyright        --copyright
    -W dump-variables[=file]    --dump-variables[=file]
    -W exec=file        --exec=file
    -W gen-po        --gen-po
    -W help            --help
    -W lint[=fatal]        --lint[=fatal]
    -W lint-old        --lint-old
    -W non-decimal-data    --non-decimal-data
    -W profile[=file]    --profile[=file]
    -W posix        --posix
    -W re-interval        --re-interval
    -W source=program-text    --source=program-text
    -W traditional        --traditional
    -W usage        --usage
    -W use-lc-numeric    --use-lc-numeric
    -W version        --version

To report bugs, see node `Bugs' in `gawk.info', which is
section `Reporting Problems and Bugs' in the printed version.

gawk is a pattern scanning and processing language.
By default it reads standard input and writes standard output.

Examples:
    gawk '{ sum += $1 }; END { print sum }' file
    gawk -F: '{ print $1 }' /etc/passwd
相關文章
相關標籤/搜索