终端工具

  1. 跨平台终端命令的 benchmark tool:hyperfine
    作者在 repo 上还加入了 py 可视化分析的脚本代码
  2. csv 文件命令行统计工具:xsv
    作者还写了 rust-csv crate,可以让 Rust 调用操作 csv 的函数
  3. 关于系统命令行替代品的工具:https://sts10.github.io/2019/04/08/terminal-redox-alacritty.html
  • eva 替代 ls 命令的彩色终端命令,同时做到 ls+tree ```bash $ exa -L=3 -T -l # 显示 3 级目录和文件树和详细信息 drwxrwxr-x - ubuntu 19 Apr 10:05 . .rw-rw-r— 172 ubuntu 18 Apr 00:36 ├── Cargo.lock .rw-rw-r— 426 ubuntu 18 Apr 00:35 ├── Cargo.toml drwxrwxr-x - ubuntu 18 Apr 20:02 ├── src drwxrwxr-x - ubuntu 18 Apr 09:16 │ ├── bin .rw-rw-r— 2.6k ubuntu 18 Apr 09:16 │ │ ├── workout_flawed_closure_demo.rs .rw-rw-r— 2.4k ubuntu 18 Apr 09:16 │ │ └── workout_generics_closure.rs .rw-rw-r— 806 ubuntu 18 Apr 20:02 │ └── main.rs .rw-rw-r— 82 ubuntu 16 Apr 00:30 └── Xargo.toml

$ exa -L=3 -D -T -l # 显示 3 级目录树和详细信息 drwxrwxr-x - ubuntu 19 Apr 10:05 . drwxrwxr-x - ubuntu 18 Apr 20:02 └── src drwxrwxr-x - ubuntu 18 Apr 09:16 └── bin

  1. ![image.png](https://cdn.nlark.com/yuque/0/2021/png/2697283/1618798417343-bd9f020b-6de7-46f5-b360-ebcf5134696e.png#clientId=u091506b0-98be-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=135&id=u796c697e&name=image.png&originHeight=270&originWidth=704&originalType=binary&ratio=1&rotation=0&showTitle=false&size=37757&status=done&style=none&taskId=ua21272fe-3f21-4908-b1fe-c0433620618&title=&width=352)
  2. - dust 统计目录和文件的大小,用颜色提示每个目录中占用硬盘空间最大的目录/文件,以树形结构和图形化展示,du+tree
  3. ![image.png](https://cdn.nlark.com/yuque/0/2021/png/2697283/1618798791608-215b7094-eaff-4950-80d9-b39d3b39d219.png#clientId=u091506b0-98be-4&crop=0&crop=0&crop=1&crop=1&from=paste&height=233&id=u7abca805&name=image.png&originHeight=465&originWidth=937&originalType=binary&ratio=1&rotation=0&showTitle=false&size=59270&status=done&style=none&taskId=u17352f02-d127-4f4f-9ee8-afa0d76949a&title=&width=468.5)
  4. ```bash
  5. # 我的习惯设置
  6. alias dust="dust -b -r -i -n 18"
  7. alias exa="exa -T -L=3 -l --no-user"
  1. 终端空间:zellij

切分当前终端成多个网格,并且有 tabs,支持 wasm 拓展插件。适用于 linux / macos
Rust:小工具合集 - 图1

  1. 流量监控:bandwhich

Rust:小工具合集 - 图2

  1. 代码/文本拼写检查工具:https://github.com/crate-ci/typos
  2. The minimal, blazing-fast, and infinitely customizable prompt for any shell! https://github.com/starship/starship
  3. nushell:A new type of shell. https://www.nushell.sh/

终端与数据分析结合,也能集成到 jupyter notebook,还能直接在终端中做统计分析,比 pandas 快。
一些命令:

  1. # 显示某软件的大小
  2. $ let p = (which cargo | get path) | ls $p
  3. ───┬───────────────────────────────┬──────┬─────────┬─────────────
  4. # │ name │ type │ size │ modified
  5. ───┼───────────────────────────────┼──────┼─────────┼─────────────
  6. 0 /home/ubuntu/.cargo/bin/cargo File 15.7 MB 1 month ago
  7. ───┴───────────────────────────────┴──────┴─────────┴─────────────
  8. # 显示 Rust 项目中 examples 文件下二进制的大小
  9. # `regex` 不支持负向断言,所以使用 `-v` flag
  10. $ ls target/debug/examples/ | match name \w+[(\.d)|-] -v
  11. ───┬──────────────────────────────────┬──────┬────────┬────────────
  12. # │ name │ type │ size │ modified
  13. ───┼──────────────────────────────────┼──────┼────────┼────────────
  14. 0 target/debug/examples/many File 5.5 MB 1 hour ago
  15. 1 target/debug/examples/multiline File 5.2 MB 1 hour ago
  16. 2 target/debug/examples/simple File 5.2 MB 1 hour ago
  17. 3 target/debug/examples/stresstest File 5.2 MB 1 hour ago
  18. ───┴──────────────────────────────────┴──────┴────────┴────────────
  19. # 而 `ls` 命令显示很多我们不关心的文件
  20. $ ls target/debug/examples/
  21. ────┬─────────────────────────────────────────────────────┬──────┬────────┬────────────
  22. # │ name │ type │ size │ modified
  23. ────┼─────────────────────────────────────────────────────┼──────┼────────┼────────────
  24. 0 target/debug/examples/many File 5.5 MB 1 hour ago
  25. 1 target/debug/examples/many-17061242fb2ef7ad File 5.5 MB 1 hour ago
  26. 2 target/debug/examples/many-17061242fb2ef7ad.d File 328 B 1 hour ago
  27. 3 target/debug/examples/many.d File 545 B 1 hour ago
  28. 4 target/debug/examples/multiline File 5.2 MB 1 hour ago
  29. 5 target/debug/examples/multiline-a229b6f39cc5df5c File 5.2 MB 1 hour ago
  30. 6 target/debug/examples/multiline-a229b6f39cc5df5c.d File 322 B 1 hour ago
  31. 7 target/debug/examples/multiline.d File 500 B 1 hour ago
  32. 8 target/debug/examples/simple File 5.2 MB 1 hour ago
  33. 9 target/debug/examples/simple-820128b43359a183 File 5.2 MB 1 hour ago
  34. 10 target/debug/examples/simple-820128b43359a183.d File 307 B 1 hour ago
  35. 11 target/debug/examples/simple.d File 494 B 1 hour ago
  36. 12 target/debug/examples/stresstest File 5.2 MB 1 hour ago
  37. 13 target/debug/examples/stresstest-ec0f53ccd530fa58 File 5.2 MB 1 hour ago
  38. 14 target/debug/examples/stresstest-ec0f53ccd530fa58.d File 339 B 1 hour ago
  39. 15 target/debug/examples/stresstest.d File 506 B 1 hour ago
  40. ────┴─────────────────────────────────────────────────────┴──────┴────────┴────────────
  1. 内存分析:https://github.com/koute/bytehound
  2. 纯 Rust 写的新 shell:https://github.com/adam-mcdaniel/dune
  3. find 命令的替代品:https://github.com/sharkdp/fd
  4. Hurl:https://github.com/Orange-OpenSource/hurl
  5. A new way to see and navigate directory trees:https://github.com/Canop/broot
    Rust:小工具合集 - 图3
  6. The terminal that supercharges your developer workflow:https://www.warp.dev/
    Warp is a blazingly fast, Rust-based terminal that makes you and your team more productive at coding and DevOps.
  7. https://pauljuliusmartinez.github.io/:jless — a command-line JSON viewer
    Rust:小工具合集 - 图4
  8. A cat(1) clone with syntax highlighting and Git integration:https://github.com/sharkdp/bat
  9. Like jq, but for HTML. Uses CSS selectors to extract bits of content from HTML files:https://github.com/mgdm/htmlq
  10. 获取系统信息的命令行工具汇总:see rustcc | see reddit
  11. alternative to sysctl(8) with a terminal user interface:https://github.com/orhun/systeroid
  12. Duf is a simple file server. Support static serve, search, upload, delete:https://github.com/sigoden/duf
  13. A tiny, self-contained, configurable paste bin and URL shortener written in Rust:https://github.com/szabodanika/microbin
  14. (TUI)Run multiple commands in parallel:https://github.com/pvolok/mprocs
  15. (TUI)A powerful log analyzer application for the terminal written in Rust:https://github.com/MrCasCode/log-analyzer-pro
  16. PowerShell version of asciinema based on Windows Pseudo Console(ConPTY):https://github.com/Watfaq/PowerSession-rs
  17. (f)low (s)tate (r)eading e(x)change – flow state reading in the terminal:https://github.com/coloradocolby/fsrx
  18. A modern replacement for ps written in Rust:https://github.com/dalance/procs
  19. A command line tool to download release assets from GitHub:https://github.com/devmatteini/dra

    录屏

  20. Linux/MacOs 终端/窗口录制 GIF(命令行工具): https://github.com/sassman/t-rec-rs

  21. Linux 录制 GIF (带交互界面): https://github.com/phw/peek

    TUI

  22. tui-rs:https://github.com/fdehau/tui-rs

    Git

  23. https://github.com/o2sh/onefetch:A command-line Git information tool written in Rust Rust:小工具合集 - 图5

  24. https://github.com/Byron/gitoxide:An idiomatic, lean, fast & safe pure Rust implementation of Git
  25. https://github.com/tkellogg/dura:a background process that watches your Git repositories and commits your uncommitted changes without impacting HEAD, the current branch, or the Git index (staged files)

    CI

  26. grcov 代码覆盖率:Measuring the coverage of a rust program in Github Actions

  27. GH CI 提高编译速度:https://www.reillywood.com/blog/rust-faster-ci/