Skip to content

Commit

Permalink
Deployed 91293b1 with MkDocs version: 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
poplar-at-twilight committed Nov 23, 2024
1 parent fbc51da commit a26a036
Show file tree
Hide file tree
Showing 15 changed files with 94 additions and 91 deletions.
8 changes: 4 additions & 4 deletions essay/linux/0-misc-of-unit/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2079,19 +2079,19 @@ <h2 id="_3">常见使用场景</h2>
</ul>
<h2 id="_4">部分命令</h2>
<p>使用 <code>ls</code> 命令列出文件大小时,可以使用 <code>--block-size=</code> 的 flag 指定显示的大小,如:</p>
<div class="highlight"><pre><span></span><code>poplar@c004-h1:~/Downloads/ISO&gt;<span class="w"> </span>ll<span class="w"> </span>openSUSE-Tumbleweed-DVD-x86_64-Snapshot20241001-Media.iso
<div class="highlight"><pre><span></span><code>poplar@Greysia:~/Downloads/ISO&gt;<span class="w"> </span>ll<span class="w"> </span>openSUSE-Tumbleweed-DVD-x86_64-Snapshot20241001-Media.iso
-rw-r--r--<span class="w"> </span><span class="m">1</span><span class="w"> </span>root<span class="w"> </span>root<span class="w"> </span><span class="m">4594860032</span><span class="w"> </span>10月<span class="w"> </span>3日<span class="w"> </span><span class="m">09</span>:24<span class="w"> </span>openSUSE-Tumbleweed-DVD-x86_64-Snapshot20241001-Media.iso
poplar@c004-h1:~/Downloads/ISO&gt;<span class="w"> </span>ll<span class="w"> </span>openSUSE-Tumbleweed-DVD-x86_64-Snapshot20241001-Media.iso<span class="w"> </span>--block-size<span class="o">=</span>MiB
poplar@Greysia:~/Downloads/ISO&gt;<span class="w"> </span>ll<span class="w"> </span>openSUSE-Tumbleweed-DVD-x86_64-Snapshot20241001-Media.iso<span class="w"> </span>--block-size<span class="o">=</span>MiB
-rw-r--r--<span class="w"> </span><span class="m">1</span><span class="w"> </span>root<span class="w"> </span>root<span class="w"> </span>4382MiB<span class="w"> </span>10月<span class="w"> </span>3日<span class="w"> </span><span class="m">09</span>:24<span class="w"> </span>openSUSE-Tumbleweed-DVD-x86_64-Snapshot20241001-Media.iso
</code></pre></div>
<p>详见 <code>man ls</code></p>
<p>又如 <code>free -m</code> 的含义就是以 mebibyte 显示当前的内存信息:</p>
<div class="highlight"><pre><span></span><code>poplar@c004-h1:~&gt;<span class="w"> </span>sudo<span class="w"> </span>free<span class="w"> </span>-m
<div class="highlight"><pre><span></span><code>poplar@Greysia:~&gt;<span class="w"> </span>sudo<span class="w"> </span>free<span class="w"> </span>-m
<span class="o">[</span>sudo<span class="o">]</span><span class="w"> </span>root<span class="w"> </span>的密码:
<span class="w"> </span>total<span class="w"> </span>used<span class="w"> </span>free<span class="w"> </span>shared<span class="w"> </span>buff/cache<span class="w"> </span>available
内存:<span class="w"> </span><span class="m">15201</span><span class="w"> </span><span class="m">6875</span><span class="w"> </span><span class="m">2356</span><span class="w"> </span><span class="m">335</span><span class="w"> </span><span class="m">6634</span><span class="w"> </span><span class="m">8325</span>
交换:<span class="w"> </span><span class="m">8191</span><span class="w"> </span><span class="m">1757</span><span class="w"> </span><span class="m">6434</span>
poplar@c004-h1:~&gt;<span class="w"> </span>sudo<span class="w"> </span>free<span class="w"> </span>--mega
poplar@Greysia:~&gt;<span class="w"> </span>sudo<span class="w"> </span>free<span class="w"> </span>--mega
<span class="w"> </span>total<span class="w"> </span>used<span class="w"> </span>free<span class="w"> </span>shared<span class="w"> </span>buff/cache<span class="w"> </span>available
内存:<span class="w"> </span><span class="m">15939</span><span class="w"> </span><span class="m">7203</span><span class="w"> </span><span class="m">2476</span><span class="w"> </span><span class="m">351</span><span class="w"> </span><span class="m">6956</span><span class="w"> </span><span class="m">8736</span>
交换:<span class="w"> </span><span class="m">8589</span><span class="w"> </span><span class="m">1842</span><span class="w"> </span><span class="m">6747</span>
Expand Down
14 changes: 7 additions & 7 deletions essay/linux/1-fs-and-permission/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2057,7 +2057,7 @@ <h1 id="_1">文件系统、文件所有权及文件权限</h1>
<p>所有东西都是文件,包括文件夹也是文件的一种。</p>
<h2 id="_2">文件系统</h2>
<p>Linux 的文件系统树如下:</p>
<div class="highlight"><pre><span></span><code>poplar@c004-h1:~&gt;<span class="w"> </span>tree<span class="w"> </span>/<span class="w"> </span>-L<span class="w"> </span><span class="m">1</span>
<div class="highlight"><pre><span></span><code>poplar@Greysia:~&gt;<span class="w"> </span>tree<span class="w"> </span>/<span class="w"> </span>-L<span class="w"> </span><span class="m">1</span>
/
├──<span class="w"> </span>bin<span class="w"> </span>-&gt;<span class="w"> </span>usr/bin
├──<span class="w"> </span>boot
Expand Down Expand Up @@ -2121,7 +2121,7 @@ <h2 id="_3">文件所有权与文件权限</h2>
</ul>
<h3 id="chmod">chmod</h3>
<p>一个典型的文件及文件夹应当具有如下的权限设置:</p>
<div class="highlight"><pre><span></span><code>poplar@c004-h1:~/1&gt; l
<div class="highlight"><pre><span></span><code>poplar@Greysia:~/1&gt; l
总计 0
drwxr-xr-x 1 poplar poplar 12 9月24日 13:22 ./
drwx--x---+ 1 poplar poplar 556 9月24日 13:22 ../
Expand All @@ -2132,28 +2132,28 @@ <h3 id="chmod">chmod</h3>
<p><code>-rw-r--r--</code> 共有十个字符,第一位字符表示文件的性质(文件/文件夹/符号链接),然后是三个字符一组,依次表示文件所有者、文件所有者所在组的其他用户和其他用户对这个文件的权限。</p>
<p><code>chmod</code> 命令可以使用数字或字母组合更改文件权限。</p>
<p>使用数字组合时,参考上文,对应的权限组合对应的数值,例如:</p>
<div class="highlight"><pre><span></span><code>poplar@c004-h1:~/1&gt; chmod 777 2.txt; ll
<div class="highlight"><pre><span></span><code>poplar@Greysia:~/1&gt; chmod 777 2.txt; ll
总计 0
drwxr-xr-x 1 poplar poplar 0 9月24日 13:22 2
-rwxrwxrwx 1 poplar poplar 0 9月24日 13:22 2.txt
</code></pre></div>
<p>使用字母组合时,使用 <code>字母 + 加减符号 + 权限</code> 的形式。</p>
<p>针对所有用户时,使用 <code>a</code>(all),或者省略字母。添加权限使用加号,删除权限使用减号。</p>
<p>两边的字母可以多个(同时指定多个对象),例如:</p>
<div class="highlight"><pre><span></span><code>poplar@c004-h1:~/1&gt; chmod go-wx 2.txt; ll
<div class="highlight"><pre><span></span><code>poplar@Greysia:~/1&gt; chmod go-wx 2.txt; ll
总计 0
drwxr-xr-x 1 poplar poplar 0 9月24日 13:22 2
-rwxr--r-- 1 poplar poplar 0 9月24日 13:22 2.txt
</code></pre></div>
<p>使用 <code>-R</code> 标志或者 <code>*</code> 可以将操作递归地(recursively)应用到该文件夹的所有文件(包括子文件和子文件夹)。</p>
<h4 id="_4">文件夹的可执行权限</h4>
<p>文件夹应当默认具有可执行权限(<code>drwxr-xr-x</code>)。文件目录具有的可执行权限允许用户访问目录内的项目,即使用户无法列出目录内容<sup id="fnref:ref-sur"><a class="footnote-ref" href="#fn:ref-sur">2</a></sup></p>
<div class="highlight"><pre><span></span><code>poplar@c004-h1:~/1&gt; ll
<div class="highlight"><pre><span></span><code>poplar@Greysia:~/1&gt; ll
总计 0
drwxr-xr-x 1 poplar poplar 0 9月24日 13:22 2
-rw-r--r-- 1 poplar poplar 0 9月24日 13:22 2.txt
poplar@c004-h1:~/1&gt; mv 2.txt 2
poplar@c004-h1:~/1&gt; chmod -x *; l 2
poplar@Greysia:~/1&gt; mv 2.txt 2
poplar@Greysia:~/1&gt; chmod -x *; l 2
ls: 无法访问 &#39;2/.&#39;: 权限不够
ls: 无法访问 &#39;2/..&#39;: 权限不够
ls: 无法访问 &#39;2/2.txt&#39;: 权限不够
Expand Down
Loading

0 comments on commit a26a036

Please sign in to comment.