Skip to content

Commit

Permalink
Deployed ded0528 with MkDocs version: 1.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Nov 16, 2024
1 parent 60f1450 commit b0bb669
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
58 changes: 40 additions & 18 deletions programming/24fall/lec2/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1184,12 +1184,22 @@ <h3 id="bash"><span>Bash<span class="heti-spacing"> </span></span>命令语法<a
<p>让我们来看一看 <code>ls</code><code>cat</code> 命令🐱。</p>
<div class="grid">
<div class="admonition note">
<div class="highlight"><pre><span></span><code>touch<span class="w"> </span><span class="o">[</span>OPTION<span class="o">]</span>...<span class="w"> </span>FILE...
</code></pre></div>
<p><code>touch</code> 命令用于创建空文件。它的名称来源于触摸(touch)文件的时间戳。</p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.3.1</span></p>
<p>在当前目录 <code>~/</code> 下创建一个空文件 <code>2.3.1</code></p>
<p><strong>接下来的每个动手做,请同学们完成后 <code>touch</code> 对应的文件,以便我们同步进度😉。</strong></p>
</div>
<div class="admonition note">
<div class="highlight"><pre><span></span><code>ls<span class="w"> </span><span class="o">[</span>OPTION<span class="o">]</span>...<span class="w"> </span><span class="o">[</span>FILE<span class="o">]</span>...
</code></pre></div>
<p><code>ls</code> 命令用于列出目录中的文件和子目录。它的名称来源于 <strong>l</strong>i<strong>s</strong>t(列出<heti-adjacent class="heti-adjacent-half"></heti-adjacent></p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.3.2</span></p>
<p>使用 <code>ls</code> 命令看一看当前目录下有哪些文件和目录吧。</p>
</div>
<div class="admonition note">
Expand All @@ -1198,7 +1208,7 @@ <h3 id="bash"><span>Bash<span class="heti-spacing"> </span></span>命令语法<a
<p><code>cat</code> 命令用于查看文件内容。它的名称来源于<span><span class="heti-spacing"> </span>con</span><strong>cat</strong>enate(连接<heti-adjacent class="heti-adjacent-half"></heti-adjacent></p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做:尝试 <code>cat</code> 的几种用法</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.3.3</span>:尝试 <code>cat</code> 的几种用法</p>
<ul>
<li>不带参数</li>
<li>带一个参数</li>
Expand Down Expand Up @@ -1246,7 +1256,7 @@ <h3 id="linux"><span>Linux<span class="heti-spacing"> </span></span>文件路径
<p><code>pwd</code> 命令用于显示当前工作目录的路径。它的名称来源于 <strong>p</strong>rint <strong>w</strong>orking <strong>d</strong>irectory(打印工作目录<heti-adjacent class="heti-adjacent-half"></heti-adjacent></p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.4.1</span></p>
<p>看一看你现在在哪个目录。</p>
</div>
<div class="admonition note">
Expand All @@ -1255,7 +1265,8 @@ <h3 id="linux"><span>Linux<span class="heti-spacing"> </span></span>文件路径
<p><code>cd</code> 命令用于切换工作目录。它的名称来源于 <strong>c</strong>hange <strong>d</strong>irectory(改变目录<heti-adjacent class="heti-adjacent-half"></heti-adjacent></p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做:尝试 <code>cd</code> 的几种用法</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.4.2</span></p>
<p>尝试 <code>cd</code> 的几种用法</p>
<ul>
<li>不带参数</li>
<li>带一个参数</li>
Expand All @@ -1267,7 +1278,7 @@ <h3 id="linux"><span>Linux<span class="heti-spacing"> </span></span>文件路径
<p><code>mkdir</code> 命令用于创建目录。它的名称来源于 <strong>m</strong>a<strong>k</strong>e <strong>dir</strong>ectory(创建目录<heti-adjacent class="heti-adjacent-half"></heti-adjacent></p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.4.3</span></p>
<p>尝试创建一个目录 <code>hello</code></p>
</div>
<div class="admonition note">
Expand All @@ -1276,7 +1287,7 @@ <h3 id="linux"><span>Linux<span class="heti-spacing"> </span></span>文件路径
<p><code>touch</code> 命令用于创建空文件。它的名称来源于触摸(touch)文件的时间戳。</p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.4.4</span></p>
<p>尝试在 <code>hello</code> 目录下创建一个空文件 <code>world</code></p>
</div>
<div class="admonition note">
Expand All @@ -1285,7 +1296,7 @@ <h3 id="linux"><span>Linux<span class="heti-spacing"> </span></span>文件路径
<p><code>rm</code> 命令用于删除文件或目录。它的名称来源于 <strong>r</strong>e<strong>m</strong>ove(删除<heti-adjacent class="heti-adjacent-half"></heti-adjacent></p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.4.5</span></p>
<p>尝试删除 <code>world</code> 文件。</p>
</div>
<div class="admonition note">
Expand All @@ -1294,7 +1305,7 @@ <h3 id="linux"><span>Linux<span class="heti-spacing"> </span></span>文件路径
<p><code>rmdir</code> 命令用于删除空目录。它的名称来源于 <strong>r</strong>e<strong>m</strong>ove <strong>dir</strong>ectory(删除目录<heti-adjacent class="heti-adjacent-half"></heti-adjacent></p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.4.6</span></p>
<p>尝试删除 <code>hello</code> 目录。</p>
</div>
<div class="admonition note">
Expand All @@ -1303,8 +1314,8 @@ <h3 id="linux"><span>Linux<span class="heti-spacing"> </span></span>文件路径
<p><code>cp</code> 命令用于复制文件或目录。它的名称来源于 <strong>c</strong>o<strong>p</strong>y(复制<heti-adjacent class="heti-adjacent-half"></heti-adjacent></p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p>尝试复制 <code>/public/lec2/hello.c</code> 文件到家目录。</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.4.7</span></p>
<p>尝试复制 <code>/share/hello.c</code> 文件到家目录。</p>
</div>
</div>
<h3 id="_5">环境变量<a class="headerlink" href="#_5" title="Permanent link"><span><span class="heti-spacing"> </span></span></a></h3>
Expand All @@ -1331,7 +1342,7 @@ <h3 id="_5">环境变量<a class="headerlink" href="#_5" title="Permanent link">
<p><code>echo</code> 命令用于打印字符串。它的名称来源于回声(echo<heti-adjacent class="heti-adjacent-half"></heti-adjacent></p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.5.1</span></p>
<ul>
<li>打印字符串 <code>helloworld</code></li>
<li>通过替换打印环境变量 <code>HOME</code><code>PATH</code> 的值。</li>
Expand All @@ -1343,7 +1354,7 @@ <h3 id="_5">环境变量<a class="headerlink" href="#_5" title="Permanent link">
<p><code>type</code> 命令用于显示命令的类型。它会告诉你命令是内建命令、别名、还是外部命令。</p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.5.2</span></p>
<p>尝试查看 <code>ls</code><code>echo</code> 命令的类型。</p>
</div>
</div>
Expand All @@ -1353,14 +1364,14 @@ <h3 id="_6">获取帮助<a class="headerlink" href="#_6" title="Permanent link">
<li>
<p>几乎所有命令都支持 <code>--help</code><code>-h</code> 选项,用于显示命令的帮助信息。</p>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.6.1</span></p>
<p>尝试查看 <code>ls</code><code>echo</code> 命令的帮助信息。</p>
</div>
</li>
<li>
<p><code>man</code> 命令用于显示命令的手册页(<strong>Man</strong>ual Page<heti-adjacent class="heti-adjacent-half"></heti-adjacent>。如果命令具有手册页,那么这几乎就是最权威最详细的帮助信息了。</p>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.6.2</span></p>
<p>尝试查看 <code>ls</code><code>echo</code> 命令的手册页。</p>
</div>
</li>
Expand All @@ -1373,18 +1384,18 @@ <h3 id="_6">获取帮助<a class="headerlink" href="#_6" title="Permanent link">
<p><code>curl</code> 命令用于传输数据。它的名称来源于 <strong>c</strong>lient for <strong>URL</strong><span>URL<span class="heti-spacing"> </span></span>客户端<heti-adjacent class="heti-adjacent-half"></heti-adjacent></p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.6.3</span></p>
<p>试一试 <code>curl baidu.com</code></p>
</div>
<div class="admonition note">
<p><a href="https://cht.sh/"><code>cht.sh</code></a><strong>Ch</strong>ea<strong>t</strong> <strong>Sh</strong><span>eet<span class="heti-spacing"> </span></span>的简写)是一个在线的命令行帮助工具,由社区维护,提供了大量命令的简洁帮助信息。</p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.6.4</span></p>
<p>试一试 <code>curl cht.sh</code></p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.6.5</span></p>
<p>尝试使用 <code>cht.sh</code> 查看 <code>ls</code><code>echo</code> 命令的帮助信息。</p>
</div>
</div>
Expand All @@ -1405,7 +1416,7 @@ <h3 id="gcc-c">使用 <code>gcc</code> 编译<span class="heti-skip"><span class
<p><code>gcc</code> 命令用于编译<span class="heti-skip"><span class="heti-spacing"> </span>C<span class="heti-spacing"> </span></span>程序。它的名称来源于<span><span class="heti-spacing"> </span>GNU Compiler Collection</span><span>GNU<span class="heti-spacing"> </span></span>编译器套件<heti-adjacent class="heti-adjacent-half"></heti-adjacent></p>
</div>
<div class="admonition question">
<p class="admonition-title">动手做</p>
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>2.7.1</span></p>
<p><code>-o outfile</code> 选项用于指定输出文件名。</p>
<p>刚才我们已经把 <code>hello.c</code> 文件复制到家目录了,尝试使用下面的命令编译 <code>~/hello.c</code> 程序:</p>
<div class="highlight"><pre><span></span><code>gcc<span class="w"> </span>-o<span class="w"> </span>hello<span class="w"> </span>~/hello.c
Expand Down Expand Up @@ -1448,6 +1459,8 @@ <h3 id="dev-c-vscode">尽快放弃<span><span class="heti-spacing"> </span>Dev-C
<p>如果這樣還不能說服你,嗯,事實上這四點已經完全充分構成理由,如果你完全不關心,那麼你的程式設計學習大概也不是很認真,所以或許繼續用<span class="heti-skip"><span class="heti-spacing"> </span>Dev-C++<span class="heti-spacing"> </span></span>也沒差吧。</p>
</blockquote>
<h3 id="vscode">使用<span class="heti-skip"><span class="heti-spacing"> </span>VSCode<span class="heti-spacing"> </span></span>连接到远程服务器<a class="headerlink" href="#vscode" title="Permanent link"><span><span class="heti-spacing"> </span></span></a></h3>
<div class="admonition question">
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>3.2.1</span></p>
<ul>
<li>安装插件:<ul>
<li>Remote - SSH</li>
Expand All @@ -1465,6 +1478,7 @@ <h3 id="vscode">使用<span class="heti-skip"><span class="heti-spacing"> </span
<li>修改程序。</li>
<li>打开命令行终端,再次编译运行<span class="heti-skip"><span class="heti-spacing"> </span>C<span class="heti-spacing"> </span></span>程序。</li>
</ul>
</div>
<h3 id="_7">自动补全、代码格式化<a class="headerlink" href="#_7" title="Permanent link"><span><span class="heti-spacing"> </span></span></a></h3>
<p><span>VSCode<span class="heti-spacing"> </span></span>本身是一个简单的文本编辑器,但是通过插件可以实现强大的功能:</p>
<ul>
Expand Down Expand Up @@ -1514,12 +1528,16 @@ <h3 id="makefile">简单<span><span class="heti-spacing"> </span>Makefile</span>
<span class="w"> </span><span class="nb">command</span>
</code></pre></div>
<p>对于上面的 <code>hello.c</code>,可以创建一个简单的 <code>Makefile</code></p>
<div class="admonition question">
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>3.5.1</span></p>
<p>创建一个 <code>Makefile</code> 文件,内容如下:</p>
<div class="highlight"><pre><span></span><code><span class="nf">hello</span><span class="o">:</span><span class="w"> </span><span class="n">hello</span>.<span class="n">c</span>
<span class="w"> </span>gcc<span class="w"> </span>-o<span class="w"> </span>hello<span class="w"> </span>hello.c
</code></pre></div>
<p>然后在终端中执行 <code>make</code> 命令:</p>
<div class="highlight"><pre><span></span><code>make
</code></pre></div>
</div>
<p>使用<span class="heti-skip"><span class="heti-spacing"> </span>Makefile<span class="heti-spacing"> </span></span>的好处:</p>
<ul>
<li>不用重复输入冗长的编译命令。</li>
Expand Down Expand Up @@ -1615,6 +1633,10 @@ <h3 id="vscode-gdb">使用<span class="heti-skip"><span class="heti-spacing"> </
<li>需要更改 <code>launch.json</code> 中的 <code>args</code><code>["&lt;", "/dev/zero"]</code></li>
<li>可以在左侧调试栏中看到断点、变量等信息。</li>
</ul>
<div class="admonition question">
<p class="admonition-title">动手做<span><span class="heti-spacing"> </span>3.6.1</span></p>
<p>尝试调试 <code>gets</code> 程序。</p>
</div>
<h2 id="_9">结语<a class="headerlink" href="#_9" title="Permanent link"><span><span class="heti-spacing"> </span></span></a></h2>
<p>通过今天的课程,你应该具备了不输于大佬们的自学资源:</p>
<ul>
Expand Down
2 changes: 1 addition & 1 deletion search/search_index.json

Large diffs are not rendered by default.

0 comments on commit b0bb669

Please sign in to comment.