2019-04-21 11:50:48 +08:00

23 lines
1.5 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="touch">touch</h1>
<p>创建新的空文件</p>
<h2 id="补充说明">补充说明</h2>
<p><strong>touch命令</strong> 有两个功能:一是用于把已存在文件的时间标签更新为系统当前的时间(默认方式),它们的数据将原封不动地保留下来;二是用来创建新的空文件。</p>
<h3 id="语法">语法</h3>
<pre><code class="language-bash">touch(选项)(参数)</code></pre>
<h3 id="选项">选项</h3>
<pre><code class="language-bash">-a或--time=atime或--time=access或--time=use 只更改存取时间;
-c或--no-create 不建立任何文件;
-d&lt;时间日期&gt; 使用指定的日期时间,而非现在的时间;
-f此参数将忽略不予处理仅负责解决BSD版本touch指令的兼容性问题
-m或--time=mtime或--time=modify 只更该变动时间;
-r&lt;参考文件或目录&gt; 把指定文件或目录的日期时间,统统设成和参考文件或目录的日期时间相同;
-t&lt;日期时间&gt; 使用指定的日期时间,而非现在的时间;
--help在线帮助
--version显示版本信息。</code></pre>
<h3 id="参数">参数</h3>
<p>文件:指定要设置时间属性的文件列表。</p>
<h3 id="实例">实例</h3>
<pre><code class="language-bash">touch ex2</code></pre>
<p>在当前目录下建立一个空文件ex2然后利用<code>ls -l</code>命令可以发现文件ex2的大小为0表示它是空文件。</p>
<!-- Linux命令行搜索引擎https://jaywcjlove.github.io/linux-command/ -->