feat: add vim.md regex.md cheatsheet. 9ff36a3ac3

This commit is contained in:
jaywcjlove
2022-10-01 19:24:21 +00:00
parent 2d29a6c38d
commit 811895f4c5
26 changed files with 13793 additions and 9877 deletions

View File

@ -47,138 +47,140 @@
</span></code></pre>
<hr>
<ul>
<li><a href="https://gist.github.com/gr1ev0us/3a9b9d9dbdd38f6379288eb2686fc538">Find 备忘清单</a> <em>(gist.github.com)</em></li>
<li><a href="https://gist.github.com/gr1ev0us/3a9b9d9dbdd38f6379288eb2686fc538">Find 备忘清单</a> <em>(gist.github.com)</em></li>
</ul>
</div></div></div><div class="wrap col-span-2"><div class="wrap-header h3wrap"><h3 id="参数示例"><a aria-hidden="true" tabindex="-1" href="#参数示例"><span class="icon icon-link"></span></a>参数示例</h3><div class="wrap-body"><!--rehype:wrap-class=col-span-2-->
<table class="show-header">
<thead>
<tr>
<th>参数</th>
<th>示例</th>
<th>描述</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>-type</code></td>
<td>find . -type d</td>
<td>仅查找目录</td>
</tr>
<tr>
<td><code>-name</code></td>
<td>find . -type f -name "*.txt"</td>
<td>按名称查找文件</td>
</tr>
<tr>
<td><code>-iname</code></td>
<td>find . -type f -iname "hello"</td>
<td>按名称查找文件(不区分大小写)</td>
</tr>
<tr>
<td><code>-size</code></td>
<td>find . -size +1G</td>
<td>查找大于 1G 的文件</td>
</tr>
<tr>
<td><code>-user</code></td>
<td>find . -type d -user jack</td>
<td>查找杰克的文件</td>
</tr>
<tr>
<td><code>-regex</code></td>
<td>find /var -regex '.*/tmp/.*[0-9]*.file'</td>
<td>将正则表达式与查找一起使用</td>
</tr>
<tr>
<td><code>-maxdepth</code></td>
<td>find . -maxdepth 1 -name "a.txt"</td>
<td>在当前目录和子目录中</td>
</tr>
<tr>
<td><code>-mindepth</code></td>
<td>find / -mindepth 3 -maxdepth 5 -name pass</td>
<td>在子目录级别 2 和 4 之间</td>
</tr>
</tbody>
</table><!--rehype:className=show-header-->
</div></div></div><div class="wrap col-span-2"><div class="wrap-header h3wrap"><h3 id="参数示例"><a aria-hidden="true" tabindex="-1" href="#参数示例"><span class="icon icon-link"></span></a>参数示例</h3><div class="wrap-body">
<!--rehype:wrap-class=col-span-2-->
<table class="show-header"><thead><tr><th>参数</th><th>示例</th><th>描述</th></tr></thead><tbody><tr><td><code>-type</code></td><td>find . -type d</td><td>仅查找目录</td></tr><tr><td><code>-name</code></td><td>find . -type f -name "*.txt"</td><td>按名称查找文件</td></tr><tr><td><code>-iname</code></td><td>find . -type f -iname "hello"</td><td>按名称查找文件(不区分大小写)</td></tr><tr><td><code>-size</code></td><td>find . -size +1G</td><td>查找大于 1G 的文件</td></tr><tr><td><code>-user</code></td><td>find . -type d -user jack</td><td>查找杰克的文件</td></tr><tr><td><code>-regex</code></td><td>find /var -regex '.*/tmp/.*[0-9]*.file'</td><td>将正则表达式与查找一起使用</td></tr><tr><td><code>-maxdepth</code></td><td>find . -maxdepth 1 -name "a.txt"</td><td>在当前目录和子目录中</td></tr><tr><td><code>-mindepth</code></td><td>find / -mindepth 3 -maxdepth 5 -name pass</td><td>在子目录级别 2 和 4 之间</td></tr></tbody></table>
<!--rehype:className=show-header-->
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="类型"><a aria-hidden="true" tabindex="-1" href="#类型"><span class="icon icon-link"></span></a>类型</h3><div class="wrap-body">
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>-type d</code></td>
<td>目录</td>
</tr>
<tr>
<td><code>-type f</code></td>
<td>文件</td>
</tr>
<tr>
<td><code>-type l</code></td>
<td>符号链接</td>
</tr>
<tr>
<td><code>-type b</code></td>
<td>缓冲块</td>
</tr>
<tr>
<td><code>-type c</code></td>
<td>无缓冲字符</td>
</tr>
<tr>
<td><code>-type p</code></td>
<td>命名管道</td>
</tr>
<tr>
<td><code>-type s</code></td>
<td>插座</td>
</tr>
</tbody>
</table>
<table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><code>-type d</code></td><td>目录</td></tr><tr><td><code>-type f</code></td><td>文件</td></tr><tr><td><code>-type l</code></td><td>符号链接</td></tr><tr><td><code>-type b</code></td><td>缓冲块</td></tr><tr><td><code>-type c</code></td><td>无缓冲字符</td></tr><tr><td><code>-type p</code></td><td>命名管道</td></tr><tr><td><code>-type s</code></td><td>插座</td></tr></tbody></table>
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="大小"><a aria-hidden="true" tabindex="-1" href="#大小"><span class="icon icon-link"></span></a>大小</h3><div class="wrap-body">
<table>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td><code>-size b</code></td>
<td>512 字节块(默认)</td>
</tr>
<tr>
<td><code>-size c</code></td>
<td>字节</td>
</tr>
<tr>
<td><code>-size k</code></td>
<td>千字节</td>
</tr>
<tr>
<td><code>-size M</code></td>
<td>兆字节</td>
</tr>
<tr>
<td><code>-size G</code></td>
<td>千兆字节</td>
</tr>
<tr>
<td><code>-size T</code></td>
<td>太字节_仅限 BSD_</td>
</tr>
<tr>
<td><code>-size P</code></td>
<td>PB <em>(仅 BSD</em></td>
</tr>
</tbody>
</table>
<table><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><code>-size b</code></td><td>512 字节块(默认)</td></tr><tr><td><code>-size c</code></td><td>字节</td></tr><tr><td><code>-size k</code></td><td>千字节</td></tr><tr><td><code>-size M</code></td><td>兆字节</td></tr><tr><td><code>-size G</code></td><td>千兆字节</td></tr><tr><td><code>-size T</code></td><td>太字节_仅限 BSD_</td></tr><tr><td><code>-size P</code></td><td>PB <em>(仅 BSD</em></td></tr></tbody></table>
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="大小--"><a aria-hidden="true" tabindex="-1" href="#大小--"><span class="icon icon-link"></span></a>大小 +/-</h3><div class="wrap-body">
<p>查找所有大于 10MB 的文件</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1">$ <span class="token function">find</span> / <span class="token parameter variable">-size</span> +10M
@ -246,11 +248,13 @@
</span></code></pre>
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="多个文件名"><a aria-hidden="true" tabindex="-1" href="#多个文件名"><span class="icon icon-link"></span></a>多个文件名</h3><div class="wrap-body">
<pre class="wrap-text "><code class="language-shell code-highlight"><span class="code-line line-number" line="1">$ <span class="token function">find</span> <span class="token builtin class-name">.</span> <span class="token parameter variable">-type</span> f <span class="token punctuation">\</span><span class="token punctuation">(</span> <span class="token parameter variable">-name</span> <span class="token string">"*.sh"</span> <span class="token parameter variable">-o</span> <span class="token parameter variable">-name</span> <span class="token string">"*.txt"</span> <span class="token punctuation">\</span><span class="token punctuation">)</span>
</span></code></pre><!--rehype:className=wrap-text -->
</span></code></pre>
<!--rehype:className=wrap-text -->
<p>查找带有 <code>.sh</code><code>.txt</code> 扩展名的文件</p>
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="多个目录"><a aria-hidden="true" tabindex="-1" href="#多个目录"><span class="icon icon-link"></span></a>多个目录</h3><div class="wrap-body">
<pre class="wrap-text "><code class="language-shell code-highlight"><span class="code-line line-number" line="1">$ <span class="token function">find</span> /opt /usr /var <span class="token parameter variable">-name</span> foo.scala <span class="token parameter variable">-type</span> f
</span></code></pre><!--rehype:className=wrap-text -->
</span></code></pre>
<!--rehype:className=wrap-text -->
<p>查找具有多个目录的文件</p>
</div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="空的"><a aria-hidden="true" tabindex="-1" href="#空的"><span class="icon icon-link"></span></a>空的</h3><div class="wrap-body">
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1">$ <span class="token function">find</span> <span class="token builtin class-name">.</span> <span class="token parameter variable">-type</span> d <span class="token parameter variable">-empty</span>
@ -259,94 +263,89 @@
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1">$ <span class="token function">find</span> <span class="token builtin class-name">.</span> <span class="token parameter variable">-type</span> f <span class="token parameter variable">-empty</span> <span class="token parameter variable">-delete</span>
</span></code></pre>
</div></div></div></div></div><div class="wrap"><div class="wrap-header h2wrap"><h2 id="查找日期和时间"><a aria-hidden="true" tabindex="-1" href="#查找日期和时间"><span class="icon icon-link"></span></a>查找日期和时间</h2><div class="wrap-body">
</div></div><div class="h2wrap-body"><div class="wrap col-span-2"><div class="wrap-header h3wrap"><h3 id="方法"><a aria-hidden="true" tabindex="-1" href="#方法"><span class="icon icon-link"></span></a>方法</h3><div class="wrap-body"><!--rehype:wrap-class=col-span-2-->
<table>
<thead>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>atime</code></td>
<td>访问时间(上次文件
<yel>打开</yel>
</td>
</tr>
<tr>
<td><code>mtime</code></td>
<td>修改时间(上次文件
<yel>内容被修改</yel>
</td>
</tr>
<tr>
<td><code>ctime</code></td>
<td>更改时间(上次文件
<yel>inode 已更改</yel>
</td>
</tr>
</tbody>
</table>
</div></div><div class="h2wrap-body"><div class="wrap col-span-2"><div class="wrap-header h3wrap"><h3 id="方法"><a aria-hidden="true" tabindex="-1" href="#方法"><span class="icon icon-link"></span></a>方法</h3><div class="wrap-body">
<!--rehype:wrap-class=col-span-2-->
<table><thead><tr><th>Option</th><th>Description</th></tr></thead><tbody><tr><td><code>atime</code></td><td>访问时间(上次文件<yel>打开</yel></td></tr><tr><td><code>mtime</code></td><td>修改时间(上次文件<yel>内容被修改</yel></td></tr><tr><td><code>ctime</code></td><td>更改时间(上次文件 <yel>inode 已更改</yel></td></tr></tbody></table>
</div></div><div class="h3wrap-body"><div class="wrap"><div class="wrap-header h4wrap"><h4 id="示例"><a aria-hidden="true" tabindex="-1" href="#示例"><span class="icon icon-link"></span></a>示例</h4><div class="wrap-body">
<table>
<thead>
<tr>
<th>Option</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>-mtime +0</code></td>
<td>24 小时前修改</td>
</tr>
<tr>
<td><code>-mtime 0</code></td>
<td>从现在到 1 天前修改</td>
</tr>
<tr>
<td><code>-mtime -1</code></td>
<td>不到 1 天前修改(与 <code>-mtime 0</code> 相同)</td>
</tr>
<tr>
<td><code>-mtime 1</code></td>
<td>24 至 48 小时前修改</td>
</tr>
<tr>
<td><code>-mtime +1</code></td>
<td>超过 48 小时前修改</td>
</tr>
<tr>
<td><code>-mtime +1w</code></td>
<td>上次修改时间超过 1 周前</td>
</tr>
<tr>
<td><code>-atime 0</code></td>
<td>从现在到 24 小时前最后一次访问</td>
</tr>
<tr>
<td><code>-atime +0</code></td>
<td>访问时间超过 24 小时</td>
</tr>
<tr>
<td><code>-atime 1</code></td>
<td>在 24 至 48 小时前访问</td>
</tr>
<tr>
<td><code>-atime +1</code></td>
<td>访问时间超过 48 小时</td>
</tr>
<tr>
<td><code>-atime -1</code></td>
<td>不到 24 小时前访问过(与 <code>-atime 0</code> 相同)</td>
</tr>
<tr>
<td><code>-ctime -6h30m</code></td>
<td>文件状态在过去 6 小时 30 分钟内发生变化</td>
</tr>
</tbody>
</table>
<table><thead><tr><th>Option</th><th>Description</th></tr></thead><tbody><tr><td><code>-mtime +0</code></td><td>24 小时前修改</td></tr><tr><td><code>-mtime 0</code></td><td>从现在到 1 天前修改</td></tr><tr><td><code>-mtime -1</code></td><td>不到 1 天前修改(与 <code>-mtime 0</code> 相同)</td></tr><tr><td><code>-mtime 1</code></td><td>24 至 48 小时前修改</td></tr><tr><td><code>-mtime +1</code></td><td>超过 48 小时前修改</td></tr><tr><td><code>-mtime +1w</code></td><td>上次修改时间超过 1 周前</td></tr><tr><td><code>-atime 0</code></td><td>从现在到 24 小时前最后一次访问</td></tr><tr><td><code>-atime +0</code></td><td>访问时间超过 24 小时</td></tr><tr><td><code>-atime 1</code></td><td>在 24 至 48 小时前访问</td></tr><tr><td><code>-atime +1</code></td><td>访问时间超过 48 小时</td></tr><tr><td><code>-atime -1</code></td><td>不到 24 小时前访问过(与 <code>-atime 0</code> 相同)</td></tr><tr><td><code>-ctime -6h30m</code></td><td>文件状态在过去 6 小时 30 分钟内发生变化</td></tr></tbody></table>
</div></div></div></div></div><div class="wrap"><div class="wrap-header h3wrap"><h3 id="更多示例"><a aria-hidden="true" tabindex="-1" href="#更多示例"><span class="icon icon-link"></span></a>更多示例</h3><div class="wrap-body">
<p>查找最近 50 天修改的文件</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1">$ <span class="token function">find</span> / <span class="token parameter variable">-mtime</span> <span class="token number">50</span>
@ -366,8 +365,10 @@
<p>查找最近 1 小时内访问过的文件</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1">$ <span class="token function">find</span> / <span class="token parameter variable">-amin</span> <span class="token parameter variable">-60</span>
</span></code></pre>
</div></div></div></div></div><div class="wrap"><div class="wrap-header h2wrap"><h2 id="查找并"><a aria-hidden="true" tabindex="-1" href="#查找并"><span class="icon icon-link"></span></a>查找并</h2><div class="wrap-body"><!--rehype:body-class=cols-2-->
</div></div><div class="h2wrap-body cols-2"><div class="wrap row-span-3"><div class="wrap-header h3wrap"><h3 id="查找和删除"><a aria-hidden="true" tabindex="-1" href="#查找和删除"><span class="icon icon-link"></span></a>查找和删除</h3><div class="wrap-body"><!--rehype:wrap-class=row-span-3-->
</div></div></div></div></div><div class="wrap"><div class="wrap-header h2wrap"><h2 id="查找并"><a aria-hidden="true" tabindex="-1" href="#查找并"><span class="icon icon-link"></span></a>查找并</h2><div class="wrap-body">
<!--rehype:body-class=cols-2-->
</div></div><div class="h2wrap-body cols-2"><div class="wrap row-span-3"><div class="wrap-header h3wrap"><h3 id="查找和删除"><a aria-hidden="true" tabindex="-1" href="#查找和删除"><span class="icon icon-link"></span></a>查找和删除</h3><div class="wrap-body">
<!--rehype:wrap-class=row-span-3-->
<p>查找并删除多个文件</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1">$ <span class="token function">find</span> <span class="token builtin class-name">.</span> <span class="token parameter variable">-type</span> f <span class="token parameter variable">-name</span> <span class="token string">"*.mp3"</span> <span class="token parameter variable">-exec</span> <span class="token function">rm</span> <span class="token parameter variable">-f</span> <span class="token punctuation">{</span><span class="token punctuation">}</span> <span class="token punctuation">\</span><span class="token punctuation">;</span>
</span></code></pre>
@ -405,7 +406,8 @@
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1">$ <span class="token function">find</span> <span class="token builtin class-name">.</span> <span class="token parameter variable">-printf</span> <span class="token string">"%T+<span class="token entity" title="\t">\t</span>%p<span class="token entity" title="\n">\n</span>"</span> <span class="token operator">|</span> <span class="token function">sort</span>
</span><span class="code-line line-number" line="2">$ <span class="token function">find</span> <span class="token builtin class-name">.</span> <span class="token parameter variable">-printf</span> <span class="token string">"%T+<span class="token entity" title="\t">\t</span>%p<span class="token entity" title="\n">\n</span>"</span> <span class="token operator">|</span> <span class="token function">sort</span> <span class="token parameter variable">-r</span>
</span></code></pre>
</div></div></div><div class="wrap row-span-2"><div class="wrap-header h3wrap"><h3 id="查找和-chmod"><a aria-hidden="true" tabindex="-1" href="#查找和-chmod"><span class="icon icon-link"></span></a>查找和 chmod</h3><div class="wrap-body"><!--rehype:wrap-class=row-span-2-->
</div></div></div><div class="wrap row-span-2"><div class="wrap-header h3wrap"><h3 id="查找和-chmod"><a aria-hidden="true" tabindex="-1" href="#查找和-chmod"><span class="icon icon-link"></span></a>查找和 chmod</h3><div class="wrap-body">
<!--rehype:wrap-class=row-span-2-->
<p>查找文件并将权限设置为 644。</p>
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1">$ <span class="token function">find</span> / <span class="token parameter variable">-type</span> f <span class="token parameter variable">-perm</span> 0777 <span class="token parameter variable">-print</span> <span class="token parameter variable">-exec</span> <span class="token function">chmod</span> <span class="token number">644</span> <span class="token punctuation">{</span><span class="token punctuation">}</span> <span class="token punctuation">\</span><span class="token punctuation">;</span>
</span></code></pre>
@ -416,6 +418,5 @@
<pre class="language-shell"><code class="language-shell code-highlight"><span class="code-line line-number" line="1">$ <span class="token function">find</span> <span class="token builtin class-name">.</span> <span class="token parameter variable">-type</span> f <span class="token parameter variable">-name</span> <span class="token string">"*.java"</span> <span class="token operator">|</span> <span class="token function">xargs</span> <span class="token function">tar</span> cvf myfile.tar
</span><span class="code-line line-number" line="2">$ <span class="token function">find</span> <span class="token builtin class-name">.</span> <span class="token parameter variable">-type</span> f <span class="token parameter variable">-name</span> <span class="token string">"*.java"</span> <span class="token operator">|</span> <span class="token function">xargs</span> <span class="token function">tar</span> rvf myfile.tar
</span></code></pre>
</div></div></div></div></div></div></div><footer class="footer-wrap"><footer class="max-container">© 2022 Kenny Wang, All rights reserved.</footer></footer></body>
</html>