You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
568tools/tools/rusty-book/cmd/awesome.html

348 lines
33 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!DOCTYPE HTML>
<html lang="zh-CN" class="sidebar-visible no-js light">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>命令行 - Rusty Book(锈书)</title>
<!-- Custom HTML head -->
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff" />
<link rel="icon" href="../favicon.svg">
<link rel="shortcut icon" href="../favicon.png">
<link rel="stylesheet" href="../css/variables.css">
<link rel="stylesheet" href="../css/general.css">
<link rel="stylesheet" href="../css/chrome.css">
<link rel="stylesheet" href="../css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="../FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="../fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="../highlight.css">
<link rel="stylesheet" href="../tomorrow-night.css">
<link rel="stylesheet" href="../ayu-highlight.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="../theme/style1.css">
</head>
<body>
<!-- Provide site root to javascript -->
<script type="text/javascript">
var path_to_root = "../";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script type="text/javascript">
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script type="text/javascript">
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('no-js')
html.classList.remove('light')
html.classList.add(theme);
html.classList.add('js');
</script>
<!-- Hide / unhide sidebar before it is displayed -->
<script type="text/javascript">
var html = document.querySelector('html');
var sidebar = 'hidden';
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
}
html.classList.remove('sidebar-visible');
html.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded affix "><a href="../about.html">Rusty Book</a></li><li class="chapter-item expanded affix "><li class="part-title">Awesome</li><li class="spacer"></li><li class="chapter-item expanded "><a href="../daily-dev.html">日常开发常用库</a></li><li class="chapter-item expanded "><a href="../superstar.html">Rust 明星项目</a></li><li class="chapter-item expanded "><a href="../empowering-js.html">使用 Rust 增强 JS</a></li><li class="chapter-item expanded "><a href="../games.html">Rust开发的游戏</a></li><li class="chapter-item expanded "><a href="../gamedev.html">游戏引擎</a></li><li class="chapter-item expanded affix "><li class="part-title">Awesome + Cookbook</li><li class="spacer"></li><li class="chapter-item expanded "><a href="../algos/awesome.html">实用算法</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../algos/randomness.html">生成随机值</a></li><li class="chapter-item expanded "><a href="../algos/sorting.html">Vec 排序</a></li><li class="chapter-item expanded "><div>压缩算法</div><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../algos/compression/tar.html">使用.tar包</a></li></ol></li><li class="chapter-item expanded "><div>密码学</div><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../algos/cryptography/hashing.html">哈希</a></li><li class="chapter-item "><a href="../algos/cryptography/encryption.html">加密</a></li></ol></li><li class="chapter-item expanded "><div>数学计算</div><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item "><a href="../algos/math/linear-algebra.html">线性代数</a></li><li class="chapter-item "><a href="../algos/math/trigonometry.html">三角函数</a></li><li class="chapter-item "><a href="../algos/math/complex.html">复数</a></li><li class="chapter-item "><a href="../algos/math/statistics.html">统计学</a></li><li class="chapter-item "><a href="../algos/math/misc.html">杂项</a></li></ol></li></ol></li><li class="chapter-item expanded "><a href="../datastructures/awesome.html">数据结构</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../datastructures/bitfield.html">位字段</a></li></ol></li><li class="chapter-item expanded "><a href="../cmd/awesome.html" class="active">命令行</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../cmd/parsing.html">参数解析</a></li><li class="chapter-item expanded "><a href="../cmd/ansi.html">终端输出格式化</a></li></ol></li><li class="chapter-item expanded "><a href="../os/awesome.html">操作系统</a><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../os/processor.html">处理器</a></li><li class="chapter-item expanded "><a href="../os/command.html">调用系统命令</a></li></ol></li><li class="chapter-item expanded "><div>并发</div><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../cocurrency/threads.html">线程</a></li><li class="chapter-item expanded "><a href="../cocurrency/parallel.html">使用rayon并行处理数据</a></li></ol></li><li class="chapter-item expanded "><div>数据库</div><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../database/sqlite.html">SQLite</a></li><li class="chapter-item expanded "><a href="../database/postgres.html">Postgres</a></li></ol></li><li class="chapter-item expanded "><div>日期和时间</div><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../datetime/duration.html">时间计算和转换</a></li><li class="chapter-item expanded "><a href="../datetime/parsing.html">解析和显示</a></li></ol></li><li class="chapter-item expanded "><div>开发者工具</div><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../devtools/log.html">日志</a></li><li class="chapter-item expanded "><a href="../devtools/config-log.html">配置日志</a></li><li class="chapter-item expanded "><a href="../devtools/version.html">版本号</a></li><li class="chapter-item expanded "><a href="../devtools/build-tools.html">构建时工具</a></li></ol></li><li class="chapter-item expanded "><div>编解码</div><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../encoding/strings.html">字符编码</a></li><li class="chapter-item expanded "><a href="../encoding/csv.html">CSV</a></li><li class="chapter-item expanded "><a href="../encoding/structured.html">结构化数据</a></li></ol></li><li class="chapter-item expanded "><div>错误处理</div></li><li class="chapter-item expanded "><div>文件操作</div><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../files/read-write.html">文件读写</a></li><li class="chapter-item expanded "><a href="../files/dir.html">目录访问</a></li></ol></li><li class="chapter-item expanded "><div>内存管理</div><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../memory/global-vars.html">全局变量</a></li></ol></li><li class="chapter-item expanded "><div>网络协议</div><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../protocols/tcpip.html">TCP/IP</a></li></ol></li><li class="chapter-item expanded "><div>文本处理</div><a class="toggle"><div></div></a></li><li><ol class="section"><li class="chapter-item expanded "><a href="../text/regex.html">正则表达式</a></li><li class="chapter-item expanded "><a href="../text/string.html">字符串解析</a></li></ol></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle"></div>
</nav>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky bordered">
<div class="left-buttons">
<button id="sidebar-toggle" class="icon-button" type="button" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</button>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light (default)</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Rusty Book(锈书)</h1>
<div class="right-buttons">
<a href="../print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/studyrs/rusty-book" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
<a href="https://github.com/studyrs/rusty-book/edit/main/src/cmd/awesome.md" title="Suggest an edit" aria-label="Suggest an edit">
<i id="git-edit-button" class="fa fa-edit"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script type="text/javascript">
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<!-- Page table of contents -->
<div class="sidetoc"><nav class="pagetoc"></nav></div>
<main>
<h2 id="命令行工具"><a class="header" href="#命令行工具">命令行工具</a></h2>
<p>对于每一个程序员而言,命令行工具都非常关键。你对他越熟悉,在使用计算机、处理工作流程等越是高效。</p>
<p>下面我们收集了一些优秀的Rust所写的命令行工具它们相比目前已有的其它语言的实现可以提供更加现代化的代码实现、更加高效的性能以及更好的可用性。</p>
<h3 id="索引目录"><a class="header" href="#索引目录">索引目录</a></h3>
<table><thead><tr><th>新工具</th><th>替代的目标或功能描述</th></tr></thead><tbody>
<tr><td><a href="#bat">bat</a></td><td>cat</td></tr>
<tr><td><a href="#exa">exa</a></td><td>ls</td></tr>
<tr><td><a href="#lsd">lsd</a></td><td>ls</td></tr>
<tr><td><a href="#fd">fd</a></td><td>find</td></tr>
<tr><td><a href="#procs">procs</a></td><td>ps</td></tr>
<tr><td><a href="#sd">sd</a></td><td>sed</td></tr>
<tr><td><a href="#dust">dust</a></td><td>du</td></tr>
<tr><td><a href="#starship">starship</a></td><td>现代化的命令行提示</td></tr>
<tr><td><a href="#ripgrep">ripgrep</a></td><td>grep</td></tr>
<tr><td><a href="#tokei">tokei</a></td><td>代码统计工具</td></tr>
<tr><td><a href="#hyperfine">hyperfine</a></td><td>命令行benchmark工具</td></tr>
<tr><td><a href="#bottom">bottom</a></td><td>top</td></tr>
<tr><td><a href="#tealdear">teeldear</a></td><td>tldr</td></tr>
<tr><td><a href="#grex">grex</a></td><td>根据文本示例生成正则</td></tr>
<tr><td><a href="#bandwhich">bandwitch</a></td><td>显示进程、连接网络使用情况</td></tr>
<tr><td><a href="#zoxide">zoxide</a></td><td>cd</td></tr>
<tr><td><a href="#delta">delta</a></td><td>git可视化</td></tr>
<tr><td><a href="#nushell">nushell</a></td><td>全新的现代化shell</td></tr>
<tr><td><a href="#mcfly">mcfly</a></td><td>替代<code>ctrl + R</code>命令搜索</td></tr>
<tr><td><a href="#fselect">fselect</a></td><td>使用SQL语法查找文件</td></tr>
<tr><td><a href="#pueue">pueue</a></td><td>命令行任务管理工具</td></tr>
<tr><td><a href="#watchexec">watchexec</a></td><td>监视目录文件变动并执行命令</td></tr>
<tr><td><a href="#dura">dura</a></td><td>更加安全的使用git</td></tr>
<tr><td><a href="#alacritty">alacritty</a></td><td>强大的基于OpenGL的终端</td></tr>
<tr><td><a href="#broot">broot</a></td><td>可视化访问目录树</td></tr>
</tbody></table>
<h3 id="bat"><a class="header" href="#bat">bat</a></h3>
<p><a href="https://github.com/sharkdp/bat">bat</a><code>克隆了**cat**的功能并提供了语法高亮和Git集成它支持</code>Windows<code></code>MacOS<code></code>Linux`。同时,它默认提供了多种文件后缀的语法高亮。</p>
<img alt="bat screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/bat.png?raw=true" class="center" />
<h3 id="exa"><a class="header" href="#exa">exa</a></h3>
<p><a href="https://github.com/ogham/exa">exa</a><code>ls</code>命令的现代化实现,后者是目前<code>Unix/Linux</code>系统的默认命令,用于列出当前目录中的内容。</p>
<img alt="exa screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/exa.jpg?raw=true" class="center" />
<h3 id="lsd"><a class="header" href="#lsd">lsd</a></h3>
<p><a href="https://github.com/Peltoche/lsd">lsd</a> 也是 <code>ls</code> 的新实现同时增加了很多特性例如颜色标注、icons、树形查看、更多的格式化选项等。</p>
<img alt="lsd screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/lsd.png?raw=true" class="center" />
<h3 id="fd"><a class="header" href="#fd">fd</a></h3>
<p><a href="https://github.com/sharkdp/fd">fd</a> 是一个更快、对用户更友好的<strong>find</strong>实现,后者是 <code>Unix/Linux</code> 内置的文件目录搜索工具。之所以说它用户友好,一方面是 <code>API</code> 非常清晰明了,其次是它对最常用的场景提供了有意义的默认值:例如,想要通过名称搜索文件:</p>
<ul>
<li><code>fd</code>: <code>fd PATTERN</code></li>
<li><code>find</code>: <code>find -iname 'PATTERN'</code></li>
</ul>
<p>同时 <code>fd</code> 性能非常非常高,还提供了非常多的搜索选项,例如允许用户通过 <code>.gitignore</code> 文件忽略隐藏的目录、文件等。</p>
<img alt="fd screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/fd.svg?raw=true" class="center" />
<h3 id="procs"><a class="header" href="#procs">procs</a></h3>
<p><a href="https://github.com/dalance/procs">procs</a><strong>ps</strong> 的默认实现,后者是 <code>Unix/Linux</code> 的内置命令,用于获取进程( <code>process</code> )的信息。<code>proc</code> 提供了更便利、可读性更好的格式化输出。</p>
<img alt="procs screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/procs.jpg?raw=true" class="center" />
<h3 id="sd"><a class="header" href="#sd">sd</a></h3>
<p><a href="https://github.com/chmln/sd">sd</a><strong>sed</strong> 命令的现代化实现,后者是 <code>Unix/Linux</code> 中内置的工具,用于分析和转换文本。</p>
<p><code>sd</code> 拥有更简单的使用方式,而且支持方便的正则表达式语法,<code>sd</code> 拥有闪电般的性能,比 <code>sed</code><strong>2x-11x</strong> 倍。</p>
<p>以下是其中一个性能测试结果:</p>
<p><em>对1.5G大小的 JSON 文本进行简单替换</em></p>
<p><code>hyperfine -w 3 'sed -E &quot;s/\&quot;/\'/g&quot; *.json &gt;/dev/null' 'sd &quot;\&quot;&quot; &quot;\'&quot; *.json &gt;/dev/null' --export-markdown out.md</code></p>
<table><thead><tr><th style="text-align: left">Command</th><th style="text-align: right">Mean [s]</th><th style="text-align: right">Min…Max [s]</th></tr></thead><tbody>
<tr><td style="text-align: left"><code>sed -E &quot;s/\&quot;/'/g&quot; *.json &gt;/dev/null</code></td><td style="text-align: right">2.338 ± 0.008</td><td style="text-align: right">2.332…2.358</td></tr>
<tr><td style="text-align: left"><code>sed &quot;s/\&quot;/'/g&quot; *.json &gt;/dev/null</code></td><td style="text-align: right">2.365 ± 0.009</td><td style="text-align: right">2.351…2.378</td></tr>
<tr><td style="text-align: left"><code>sd &quot;\&quot;&quot; &quot;'&quot; *.json &gt;/dev/null</code></td><td style="text-align: right"><strong>0.997 ± 0.006</strong></td><td style="text-align: right">0.987…1.007</td></tr>
</tbody></table>
<p>结果: ~2.35 times faster</p>
<h3 id="dust"><a class="header" href="#dust">dust</a></h3>
<p><a href="https://github.com/bootandy/dust">dust</a> 是一个更符合使用习惯的<strong>du</strong>,后者是 <code>Unix/Linux</code> 内置的命令行工具,用于显示硬盘使用情况的统计。</p>
<img alt="dust screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/dust.png?raw=true" class="center" />
<h3 id="starship"><a class="header" href="#starship">starship</a></h3>
<p><a href="https://github.com/starship/starship">starship</a> 是一个命令行提示,支持任何 <code>shell</code> ,包括 <code>zsh</code> ,简单易用、非常快且拥有极高的可配置性, 同时支持智能提示。</p>
<img alt="starship screenshot" width="100%" src="https://raw.githubusercontent.com/starship/starship/master/media/demo.gif" class="center" />
<h3 id="ripgrep"><a class="header" href="#ripgrep"><a href="https://github.com/BurntSushi/ripgrep">ripgrep</a></a></h3>
<p><a href="https://github.com/BurntSushi/ripgrep">ripgrep</a> 是一个性能极高的现代化 <code>grep</code> 实现,后者是 <code>Unix/Linux</code> 下的内置文件搜索工具。该项目是 Rust 的明星项目,一个是因为性能极其的高,另一个就是源代码质量很高,值得学习, 同时 <code>Vscode</code> 使用它作为内置的搜索引擎。</p>
<p>从功能来说,除了全面支持 <code>grep</code> 的功能外,<code>repgre</code> 支持使用正则递归搜索指定的文件目录,默认使用 <code>.gitignore</code> 对指定的文件进行忽略。</p>
<img alt="ripgrep screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/ripgrep.png?raw=true" class="center" />
<h3 id="tokei"><a class="header" href="#tokei">tokei</a></h3>
<p><a href="https://github.com/XAMPPRocky/tokei">tokei</a> 可以分门别类的统计目录内的代码行数,速度非常快!</p>
<img alt="tokei screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/tokei.png?raw=true" class="center" />
<h3 id="hyperfine"><a class="header" href="#hyperfine">hyperfine</a></h3>
<p><a href="https://github.com/sharkdp/hyperfine">hyperfine</a> 是命令行benchmark工具它支持在多次运行中提供静态的分析同时支持任何的 <code>shell</code> 命令,准确的 <code>benchmark</code> 进度和当前预估等等高级特性。</p>
<img alt="hyperfine screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/hyperfine.gif?raw=true" class="center" />
<h3 id="bottom"><a class="header" href="#bottom">bottom</a></h3>
<p><a href="https://github.com/ClementTsang/bottom">bottom</a> 是一个现代化实现的 <code>top</code>,可以跨平台、图形化的显示进程/系统的当前信息。</p>
<img alt="bottom screenshot" width="100%" src="https://github.com/ClementTsang/bottom/raw/master/assets/demo.gif" class="center" />
<h3 id="tealdear"><a class="header" href="#tealdear">tealdear</a></h3>
<p><a href="https://github.com/dbrgn/tealdeer">tealdear</a> 是一个更快实现的<strong>tldr</strong>, 一个用于显示 <code>man pages</code> 的命令行程序,简单易用、基于例子和社区驱动是主要特性。</p>
<img alt="teeldear screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/teeldear.gif?raw=true" class="center" />
<h3 id="bandwhich"><a class="header" href="#bandwhich">bandwhich</a></h3>
<p><a href="https://github.com/imsnif/bandwhich">bandwhich</a> 是一个客户端实用工具,用于显示当前进程、连接、远程 IP( hostname ) 的网络信息。</p>
<img alt="bandwhich screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/bandwhich.gif?raw=true" class="center" />
<h3 id="grex"><a class="header" href="#grex">grex</a></h3>
<p><a href="https://github.com/pemistahl/grex">grex</a> 既是一个命令行工具又是一个库,可以根据用户提供的文本示例生成对应的正则表达式,非常强大。</p>
<img alt="grex screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/grex.gif?raw=true" class="center" />
<h3 id="zoxide"><a class="header" href="#zoxide">zoxide</a></h3>
<p><a href="https://github.com/ajeetdsouza/zoxide">zoxide</a> 是一个智能化的 <code>cd</code> 命令,它甚至会记忆你常用的目录。</p>
<img alt="zoxide screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/zoxide.webp?raw=true" class="center" />
<h3 id="delta"><a class="header" href="#delta">delta</a></h3>
<p><a href="https://github.com/dandavison/delta">delta</a> 是一个 <code>git</code> 分页展示工具,支持语法高亮、代码比对、输出 <code>grep</code> 等。</p>
<img alt="delta screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/delta.png?raw=true" class="center" />
<h3 id="nushell"><a class="header" href="#nushell">nushell</a></h3>
<p><a href="https://github.com/nushell/nushell">nushell</a> 是一个全新的 <code>shell</code> ,使用 <code>Rust</code> 实现。它的目标是创建一个现代化的 <code>shell</code> :虽然依然基于 <code>Unix</code> 的哲学,但是更适合现在的时代。例如,你可以使用 <code>SQL</code> 语法来选择你想要的内容!</p>
<img alt="delta screenshot" width="100%" src="https://github.com/nushell/nushell/raw/main/images/nushell-autocomplete5.gif" class="center" />
<h3 id="mcfly"><a class="header" href="#mcfly">mcfly</a></h3>
<p><a href="https://github.com/cantino/mcfly">mcfly</a> 会替换默认的 <code>ctrl-R</code>,用于在终端中搜索历史命令, 它提供了智能提示功能,并且会根据当前目录中最近执行过的上下文命令进行提示。<code>mcfly</code> 甚至使用了一个小型的神经网络用于智能提示!</p>
<img alt="mcfly screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/mcfly.png?raw=true" class="center" />
<h3 id="fselect"><a class="header" href="#fselect">fselect</a></h3>
<p><a href="https://github.com/jhspetersson/fselect">fselect</a> 允许使用 SQL 语法来查找系统中的文件。它支持复杂查询、聚合查询、.gitignore 忽略文件、通过宽度高度搜索图片、通过 hash 搜索文件、文件属性查询等等,相当强大!</p>
<pre><code class="language-shell"># 复杂查询
fselect &quot;name from /tmp where (name = *.tmp and size = 0) or (name = *.cfg and size &gt; 1000000)&quot;
# 聚合函数
fselect &quot;MIN(size), MAX(size), AVG(size), SUM(size), COUNT(*) from /home/user/Downloads&quot;
# 格式化函数
fselect &quot;LOWER(name), UPPER(name), LENGTH(name), YEAR(modified) from /home/user/Downloads&quot;
</code></pre>
<h3 id="pueue"><a class="header" href="#pueue">pueue</a></h3>
<p><a href="https://github.com/nukesor/pueue">pueue</a> 是一个命令行任务管理工具,它可以管理你的长时间运行的命令,支持顺序或并行执行。简单来说,它可以管理一个命令队列。</p>
<img alt="pueue screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/pueue.gif?raw=true" class="center" />
<h3 id="watchexec"><a class="header" href="#watchexec">watchexec</a></h3>
<p><a href="https://github.com/watchexec/watchexec">watchexec</a> 可以监视指定的目录、文件的改动,并执行你预设的命令,支持多种配置项和操作系统。</p>
<pre><code class="language-shell"># 监视当前目录/子目录中的所有js、css、html文件一旦发生改变运行`npm run build`命令
$ watchexec -e js,css,html npm run build
# 当前目录/子目录下任何python文件发生改变时重启`python server.py`
$ watchexec -r -e py -- python server.py
</code></pre>
<h3 id="dura"><a class="header" href="#dura">dura</a></h3>
<p><a href="https://github.com/tkellogg/dura">dura</a> 运行在后台,监视你的 <code>git</code> 目录,提交你未提交的更改但是并不会影响 <code>HEAD</code>、当前的分支和 <code>git</code> 索引(staged文件)。</p>
<p>如果你曾经遇到过**&quot;完蛋, 我这几天的工作内容丢了&quot;**的情况,那么就可以尝试下 <code>dura</code><code>checkout dura brach</code>,然后代码就可以顺利恢复了:)</p>
<p><strong>恢复代码</strong></p>
<ol>
<li>你可以使用 <code>dura</code> 分支来恢复</li>
</ol>
<pre><code class="language-console">$ echo &quot;dura/$(git rev-parse HEAD)&quot;
</code></pre>
<ol>
<li>也可以手动恢复</li>
</ol>
<pre><code class="language-console"># Or, if you don't trust dura yet, `git stash`
$ git reset HEAD --hard
# get the changes into your working directory
$ git checkout $THE_HASH
# last few commands reset HEAD back to master but with changes uncommitted
$ git checkout -b temp-branch
$ git reset master
$ git checkout master
$ git branch -D temp-branch
</code></pre>
<h2 id="alacritty"><a class="header" href="#alacritty">alacritty</a></h2>
<p><a href="https://github.com/alacritty/alacritty">alacritty</a> 是一个跨平台、基于OpenGL的终端性能极高的同时还支持丰富的自定义和可扩展性可以说是非常优秀的现代化终端。</p>
<p>目前已经是 <code>beta</code> 阶段,可以作为日常工具来使用。</p>
<img alt="alacritty screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/superstar/alacritty.png?raw=true" class="center" />
<h2 id="broot"><a class="header" href="#broot">broot</a></h2>
<p><a href="https://github.com/Canop/broot"><code>broot</code></a> 允许你可视化的去访问一个目录结构。</p>
<img alt="broot screenshot" width="100%" src="https://github.com/studyrs/cookbook-images/blob/main/command-line/broot.png?raw=true" class="center" />
<div id="giscus-container"></div>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="../datastructures/bitfield.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next" href="../cmd/parsing.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="../datastructures/bitfield.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next" href="../cmd/parsing.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script type="text/javascript">
window.playground_copyable = true;
</script>
<script src="../ace.js" type="text/javascript" charset="utf-8"></script>
<script src="../editor.js" type="text/javascript" charset="utf-8"></script>
<script src="../mode-rust.js" type="text/javascript" charset="utf-8"></script>
<script src="../theme-dawn.js" type="text/javascript" charset="utf-8"></script>
<script src="../theme-tomorrow_night.js" type="text/javascript" charset="utf-8"></script>
<script src="../elasticlunr.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../mark.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../searcher.js" type="text/javascript" charset="utf-8"></script>
<script src="../clipboard.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../highlight.js" type="text/javascript" charset="utf-8"></script>
<script src="../book.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" charset="utf-8">
var pagePath = "cmd/awesome.md"
</script>
<!-- Custom JS scripts -->
<script type="text/javascript" src="../assets/custom1.js"></script>
<script type="text/javascript" src="../assets/bigPicture.js"></script>
</body>
</html>