uTools-Manuals/docs/linux/install.html
2019-04-21 11:50:48 +08:00

43 lines
3.2 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<h1 id="install">install</h1>
<p>安装或升级软件或备份数据</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>install命令</strong> 的作用是安装或升级软件或备份数据它的使用权限是所有用户。install命令和cp命令类似都可以将文件/目录拷贝到指定的地点。但是install允许你控制目标文件的属性。install通常用于程序的makefile使用它来将程序拷贝到目标安装目录。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">install [OPTION]... [-T] SOURCE DEST
install [OPTION]... SOURCE... DIRECTORY
install [OPTION]... -t DIRECTORY SOURCE...
install [OPTION]... -d DIRECTORY...</code></pre>
<p>在前两种格式中,会将<来源>复制至<目的地>或将多个<来源>文件复制至已存在的<目录>,同时设定权限模式及所有者/所属组。在第三种格式中,会创建所有指定的目录及它们的主目录。长选项必须用的参数在使用短选项时也是必须的。</p>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">--backup[=CONTROL]:为每个已存在的目的地文件进行备份。
-b类似 --backup但不接受任何参数。
-c(此选项不作处理)。
-d--directory所有参数都作为目录处理而且会创建指定目录的所有主目录。
-D创建&lt;目的地&gt;前的所有主目录,然后将&lt;来源&gt;复制至 &lt;目的地&gt;;在第一种使用格式中有用。
-g--group=组:自行设定所属组,而不是进程目前的所属组。
-m--mode=模式:自行设定权限模式 (像chmod)而不是rwxr-xr-x。
-o--owner=所有者:自行设定所有者 (只适用于超级用户)。
-p--preserve-timestamps&lt;来源&gt;文件的访问/修改时间作为相应的目的地文件的时间属性。
-s--strip用strip命令删除symbol table只适用于第一及第二种使用格式。
-S--suffix=后缀:自行指定备份文件的&lt;后缀&gt;
-v--verbose处理每个文件/目录时印出名称。
--help显示此帮助信息并离开。
--version显示版本信息并离开。</code></pre>
<h3 id="实例">实例</h3>
<pre><code class="language-bash">install -d [option] DIRECTORY [DIRECTORY...]</code></pre>
<p>支持多个,类似<code>mkdir -p</code>支持递归。例如:<code>install -d a/b/c e/f</code>结果和<code>mkdir -p a/b/c e/f</code>一样。</p>
<pre><code class="language-bash">install [option] SOURCE DEST</code></pre>
<p><strong>复制SOURCE文件测试不能是目录到DEST file文件</strong></p>
<pre><code class="language-bash">install a/e c
结果类似:
cp a/e c #注意c必须是文件。</code></pre>
<p><strong>有用选项<code>-D</code></strong></p>
<pre><code class="language-bash">install -D x a/b/c
效果类似:
mkdir -p a/b &amp;&amp; cp x a/b/c</code></pre>
<pre><code class="language-bash">install [option] SOURCE [SOURCE...] DIRECTORY</code></pre>
<p><strong>复制多个SOURCE文件到目的目录</strong></p>
<pre><code class="language-bash">install a/* d</code></pre>
<p>其中d是目录。</p>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->