Modern CLI tools Alexander Reelsen alex@elastic.co | @spinscale

Today’s goal Learn CLI tools you have not heard about. Increase your productivity

Don’t spew on UIs UIs solve different issues ⏯ UIs help to reduce complexity UIs will help newcomers UIs look nicer GOAT: The web!

Why CLI tools then? Scripting Speed Flexibility Automation

Why CLI tools then? 🛠 Process safety Expert mode Issue: Outdated distribution packages Do one thing and do it well!

Modern CLI tools? Many tools still stem from the early UNIX times Rise of the developer UTF8 Colors 🏎 Faster terminals Debugging (ephemeral containers, no local logs, remote)

New languages Rust Go Crystal JVM: GraalVM, Kotlin Native, Scala Native Zig V

New languages Binary as a result, best startup time No C/memory management learning required Faster development

Shell - zsh in combination with oh-my-zsh scripting syntax similar to bash lots of plugins for easier development

Shell - alternatives bash fish nushell

Shell Prompt - GBT

Shell Prompt - GBT

Shell Prompt - Starship

Shell aliases Make sure you alias what you type often! .. ll

wd

Shell history search Ctrl+R triggers history search Extremely powerful Ensure your history gets written after command execution instead of logout

lsd

lsd a better ls colored output relative/absolute timestamps file type icons (nerdfonts) tree view total directory size view

bat

bat cat with wings Syntax highlighting & themes Line highlighting Range snippets (no more cat | head | tail parties) git integration builtin pagination

fd

fd a better find, very similar syntax colors! takes .gitignore into account case-insensitive by default regexes parallel command execution (when used with -x )

ripgrep

ripgrep It’s fast! match patterns across newlines takes .gitignore into account skips dot files and binary files recursive && regexing by default replacement of matched text ripgrep-all to search in binary files

htop

prettyping

hyperfine

JSON coloring

JSON selection

JSON selection

fzf curl -s ‘localhost:9200/_cat/indices?format=json’ \ | jq -C -r \ ‘[ .[] | select ( .index | startswith(“.”) | not) ] | sort_by(.index) | .[].index’ \ | fzf

curl -s ‘localhost:9200/_cat/indices?format=json’ \ | jq -C -r \ ‘[ .[] | select ( .index | startswith(“.”) | not) ] | sort_by(.index) | .[].index’ \ | fzf

bandwhich

ytop

procs

dust

version managers JVM: sdkman nodejs: nvm ruby: rvm Problem: per project requirements

direnv - unclutter your profile .envrc layout node export NODE_VERSIONS=~/.nvm/versions/node export NODE_VERSION_PREFIX=’v’ use node 15.11.0 dotenv

direnv - unclutter your profile .env DB_USERNAME=”sa” DB_PASSWORD=”” DB_URL=”jdbc:h2:mem:foo_in_memory;MODE=PostgreSQL;DB_CLOSE_DELAY=-1;DATABASE_TO_UPPER=false” Run direnv allow after a change

envchain - store secrets securely envchain —set my_app DB_PASSWORD envchain ./gradlew run

Better diffs

colordiff

icdiff

scc - source code analyzer

Honorable mentions GPU based terminal emulators: alacritty & kitty exiftool, remove exif data exiftool -all= my.png tmux - next session will be all about tmux! sd, a faster sed alternative zoxide, a new cd that remembers your most common paths

Honorable mentions rlwrap, a readline wrapper cli, the github cli tool taskwarrior, the CLI todo management tool

Missing Note taking tool, that automatically syncs in the cloud/via git Time tracking? What are your favourite tools? Feel free to ping (twitter, email, linkedin, whatever)

Write CLI tools Command Line Interface Guidelines

Resources direnv envchain fish shell Starship fd bat hyperfine

Resources ripgrep ripgrep-all Grep tools feature comparison Rewritten in Rust: Modern Alternatives of Command-Line Tools Command Line Interface Guidelines A better zsh history

Thanks for listening Q&A Alexander Reelsen alex@elastic.co | @spinscale