Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The CLI Awakens

Marc Aubé
February 28, 2025

The CLI Awakens

Building your CLI toolkit is like crafting your own lightsaber—a deeply personal, powerful, and highly rewarding journey to wield the Force of the terminal. Let me guide you through the art of designing a "Jedi-grade" toolset, from selecting the right components to mastering advanced techniques.

Whether you’re a Padawan or a seasoned Jedi Master, this talk will help you unlock the full power of the CLI. May the terminal be with you!

Marc Aubé

February 28, 2025
Tweet

More Decks by Marc Aubé

Other Decks in Technology

Transcript

  1. "I know people who have not mastered their tools who

    are good programmers, but not a tool master who remained a mediocre programmer." — Yoda (Kent Beck) yoda Ziko, CC BY-SA 4.0 h4ps:/ /crea<vecommons.org/licenses/by-sa/4.0, via Wikimedia Commons
  2. Anatomy of your lightsaber 1. Hilt: Terminal Emulator 2. Kyber

    Crystal: Shell 3. Handgrip: Prompt 4. Focusing Crystal: CLI Programs lightsaber h,ps:/ /pxhere.com/en/photo/1205281
  3. Recommended Emulators • Alacri'y: cross-pla,orm, GPU- accelerated (Rust) • Ki'y:

    cross-pla,orm, feature-rich, GPU-accelerated (C, Python) • Wezterm: cross-pla,orm, GPU- accelerated, mul?plexer (Rust)
  4. Other popular choices • iTerm: macOS, user-friendly, feature- rich (Objec:ve-C,

    Swi>) • Hyper: from the folks at Vercel (Javascript) • Warp: commercial ($), AI-agent, IDE-like (Rust)
  5. 2. Kyber Crystal: Choosing your shell crystal W.carter, CC BY-SA

    4.0 h6ps:/ /crea:vecommons.org/licenses/by-sa/4.0, via Wikimedia Commons
  6. Most popular shells • bash (1989): o*en the default login

    shell on Linux • zsh (1990): default shell on macOS • fish (2005): syntax highlighAng, auto-suggest, tab-compleAon (baFeries included)
  7. Exo$c / Experimental shells • elvish (2013): structured data processing,

    na8ve support for JSON and Yaml • xonsh (2015): Python powered • nushell (2019): works on structured data instead of files and streams of text
  8. 3. Handgrip: Make it comfortable and good looking lightsaber2 KarleHorn,

    CC BY 3.0 h8ps:/ /crea=vecommons.org/licenses/by/3.0, via Wikimedia Commons
  9. 4. Focusing Crystals: The shell programs lense User Fir0002 on

    en.wikipedia, CC BY-SA 3.0 h<p:/ /[email protected]/licenses/by-sa/3.0/, via Wikimedia Commons
  10. Use Cases • Naviga'on (cd) • Search (find, grep) •

    Modifica'on (sed, awk, tr, cut) • Sor'ng (sort) • Comparison (diff) • Presenta'on (less, head, column) • ...
  11. Naviga&on # List the contents of a directory $ ls

    Cargo.toml src # Change directory into a subdirectory $ cd src # Print the current working directory $ pwd ~/Code/confoo/src
  12. Naviga&on (cont) # Return to the previous directory, # using

    the `-` argument $ cd - && pwd ~/Code/confoo # Return to the user's home directory $ cd && pwd ~/
  13. Search # Find all files with the .rs extension $

    find . -name '*.rs' ./src/main.rs # Find all empty directories $ find . -type d -empty ./.git/objects/pack ./.git/objects/info ./.git/refs/heads ./.git/refs/tags
  14. Search (con+nued) # Recursively search for the string "print" $

    grep -r "print" . ./src/main.rs: println!("Hello, world!"); # Find all empty directories, # except those with "refs" in the name $ find . -type d -empty | grep -v "refs" ./.git/objects/pack ./.git/objects/info
  15. "You must unlearn what you have learned." — Yoda yoda2

    photographied by Supremerian1988, Public domain, via Wikimedia Commons
  16. fzf

  17. fzf (cont.) # alias cb=... $ git branch --sort=-committerdate \

    | fzf --header "Checkout branch" \ | xargs git checkout
  18. fzf (cont.) # alias cpr=... $ gh pr list \

    | fzf --header "Checkout PR" \ | awk '\''{print $(NF-2)}'\'' \ | xargs git checkout
  19. fzf (last one, promised ! ) # alias de=... $

    docker exec -it $( \ docker ps --format "{{.Names}}" \ | fzf --prompt="Choose docker container: " \ ) bash
  20. fzf (ok, I lied ! ) # alias kp=... $

    ps -a \ | fzf --prompt="Chosse process to kill: " \ | cut -d " " -f 1 \ | xargs kill -9
  21. ambs/ambr $ ambs 'println' ./src/main.rs: println!("Hello, world!"); $ ambr 'println'

    'print' ./src/main.rs: println!("Hello, world!"); -> print!("Hello, world!"); Replace keyword? [Y]es/[n]o/[a]ll/[q]uit: Y
  22. jq

  23. bat

  24. .dotfiles • chezmoi: manage your dotfiles across mul3ple diverse machines,

    securely • dotbot: a tool that bootstraps your dotfiles
  25. Bonus: Wielding your lightsaber (without chopping your legs off) training

    Steven Miller, CC BY 2.0 h5ps:/ /crea;vecommons.org/licenses/by/2.0, via Wikimedia Commons
  26. In the age of AI, how relevant is it to

    learn and memorize CLI commands? ai Alenoach, Public domain, via Wikimedia Commons
  27. Shu-ha-ri 守破離 • Shu: obey – learning fundamentals, techniques •

    Ha: break away – find excep9ons to the rules • Ri: transcend – there are no more rules
  28. Great tools that didn't make the cut • dasel: like

    jq, but supports JSON, YAML, TOML, XML, CSV • delta: beau=ful diffs in the terminal • fd: a fast and user-friendly alterna=ve to find • h)pie: a nice HTTP / API client for the terminal • hyperfine: a powerful benchmarking tool