Regardless of what the app does and whether the thing that does is particularly useful, powerful or important for what you need to do (or even well implemented), what is a command-line interface that you had a particularly good experience both learning and working with?

In other words, I'm thinking about command line interface design patterns that tend to correlate with good user experience.

"Good user experience" being vague, what I mean is, including (but not limited to)

  • discoverability--learning what features are available),
  • usability--those features actually being useful,
  • and expressiveness--being able to do more with less words without losing clarity,

but if there's a CLI that has none of those but you still like it, I'd be happy to hear about it.

Edit: Trying to stress more that this post is not about the functionality behind the tool. Looks like most of first responders missed the nuance: whether app x is better than app y because it does x1 ad x2 differently or better does not matter; I'm purely interested in how the command line interface is designed (short/long flags, sub-commands, verbs, nouns, output behaviors)..

top 69 comments

sorted by: hot top controversial new old
[–] 41 points 7 months ago (5 children)

Not what you asked, but anything that uses a single hyphen for longopts can just fuck off. I'm talking to you Terraform.

  • source
  • hideshow 5 child comments
  • [–] [S] 5 points 7 months ago

    Did not want to respond but this is hilarious.

    To be fair, really old CLI's, like from the time when X.org was the new stuff, this style used to be more common. That was before "GNU style" (using single dash for single-letter bundle-able options and double dash for long options) became prevalent.

    But yeah, if you see -foo then you know the program is old enough that regular colonoscopy is recommended, and the original author is probably retired or "passed away at the ripe age of ..".

  • source
  • parent
  • [+] 25 points 7 months ago* (23 children)
  • [–] 15 points 7 months ago (17 children)

    Personally I dislike pacman as it uses capital-letter flags as subcommands while I'm used to actual subcommands

  • source
  • parent
  • hideshow 17 child comments
  • [–] 2 points 7 months ago (12 children)

    You can use long option names instead too, as each capital letter mode has a long option name, such as -R --remove and -S --sync.

  • source
  • parent
  • hideshow 12 child comments
  • [–] 5 points 7 months ago (11 children)

    My problem is that it's a flag and not like # pacman remove

  • source
  • parent
  • hideshow 11 child comments
  • [–] 1 point 7 months ago (10 children)

    I don't get why that is a problem. It's just an option name with 2 dashes in front. In fact, that is the "correct" way of handling options, as in standard option processing in GNU / Linux. I personally dislike options without dash, but on the other hand it does not bother me enough to be bothered by it. pacman --remove is almost identical to pacman remove, so I don't know why that is a "problem".

  • source
  • parent
  • hideshow 10 child comments
  • [–] 3 points 7 months ago (6 children)

    Because it's not an option but a subcommand.

    as in standard option processing in GNU / Linux

    Guix and standard tooling like perf also use subcommands. I'm used to flags/options modifying the way the same inputs are processed, not completely changing what you give as $1.

  • source
  • parent
  • hideshow 6 child comments
  • [–] 0 points 7 months ago (5 children)

    But its just a matter of 2 dashes. It shouldn't be a problem.

  • source
  • parent
  • hideshow 5 child comments
  • [–] 3 points 7 months ago* (4 children)

    You misunderstand me. It's not about typing it. It's not conforming to prevalent Linux paradigms which creates artificial confusion and learning difficulties. There's a reason it's git pull and not git -L, perf annotate and not perf -A . It's a great semantic difference like <b> vs <h3>. I'm saying this as an Arch user.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 1 point 7 months ago (3 children)

    I don't think it would make ANY difference if the option was named git --pull instead git pull (you don't have to use the single uppercase). That is NOT the same semantic difference between and , because it (the pull example) operates the same as before. The only difference are the two dashes. I don't see how this creates confusion or learning difficulties.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 3 points 7 months ago (2 children)

    The prevalent way (except for ancient tools like tar), and thus the norm, is that options are meant to be optional and subcommands are like old "do one thing" Unix commands (do completely different things, can have completely different set of arguments) but you prepend the name of the software in front of them. You can see the impact of this reflected in documentation for argument parsers: https://docs.python.org/3.14/library/argparse.html#:~:text=Required%20options%20are%20generally%20considered%20bad%20form%20because%20users%20expect%20options%20to%20be%20optional https://gobyexample.com/command-line-subcommands#:~:text=Command%2DLine%20Subcommands-,Go%20by%20Example:%20Command%2DLine%20Subcommands,that%20have%20their%20own%20flags.

  • source
  • parent
  • hideshow 2 child comments
  • [–] 1 point 7 months ago (1 child)

    I know how subcommands work. But that is not the point I am making. Having two dashes in front of it or not like pacman remove or pacman --remove does not change how the command operates. It is literally having two dashes or not and therefore is not an issue.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 3 points 7 months ago

    Hmm, I don't know about Pacman, but for example openSUSE's zypper remove has a --clean-deps flag, which doesn't exist on the other subcommands. So, it wouldn't make sense to have it be zypper --remove --clean-deps...

  • source
  • parent
  • [–] 2 points 7 months ago (2 children)

    Is there a difference between one dash - vs two dashes -- ? I don't get why it makes sense to use two as its just an extra key press?

    Sorry for going a bit off topic here

  • source
  • parent
  • hideshow 2 child comments
  • [–] 3 points 7 months ago (1 child)

    No problem, it's always good idea to ask.

    By convention two dashes -- are used for options with long name, such as --remove, while single dash - is used for single letter options such as -R. There can be some extra rules how options are used and combined, but that is not always true for every application. A common implementation is that options with single dash can be combined to have less to press, while double dash options cannot. Meaning if you have options -a -b -c then you could combine them into one bucket as -abc or -ab -c, all equivalent. But you cannot combine --remove -a -b into --abremove in example. There can be some extra rules and some applications handle options bit differently.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 6 points 7 months ago (3 children)

    Pacman flags not being idempotent (-SS, yy, uu and such existing) is so unbelievably horrible that I can't use arch just because of it.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 1 point 7 months ago (2 children)

    I've never used Arch, can you explain how it behaves?

  • source
  • parent
  • hideshow 2 child comments
  • [–] 5 points 7 months ago (1 child)

    The flag -y refreshes the package list (like apt update). For some reason, you use the flag -yy to force it to clear the whole package list and redownload everything.

    To allow package downgrades when upgrading you use -uu.

    These are very commonly suggested fixes to arch package management problems, for example when you leave your arch install to suit for too long, it will be impossible to update it because of dependency problems. So you google it and people are saying to run "pacman -SSyyuu" or other such commands.

    Those additional options should be their own flags, command line flags should be idempotent (it should flip a switch on, doing it multiple times shouldn't change anything).

  • source
  • parent
  • hideshow 1 child comment
  • [–] 2 points 7 months ago

    This is where a man page comes in but alas, but some (perhaps even most) of them are fucking horrible. The core incantation is either too dumbed-down or (more often) too long-winded.

    Some good ones I can praise are netcat, ghostscript and 7z. Special praise goes to the Library Funtions Manual entries like signal and exit.

    Bad ones ones in my book are vim (too short), ffmpeg (a simple reordering of sections would make it quite a bit better, like moving the less common flags lower down the page) and git starts of strong but ends up being way too detailed and unstructured.

    I could go listing examples for days, so I might as well stop now.

  • source
  • parent
  • [–] 20 points 7 months ago (4 children)

    A well-designed CLI? Maybe sed. A badly designed CLI? Probably also sed.

  • source
  • hideshow 4 child comments
  • [–] 5 points 7 months ago (3 children)

    sed is great. I use it all the time, and I love it, but sometimes, I hate it.

  • source
  • parent
  • hideshow 3 child comments
  • [–] 12 points 7 months ago

    I always thought openSUSE's package manager zypper has quite a few neat ideas:

    • It offers two-letter shorthands for subcommands, so zypper install→ zypper in, update → up, remove → rm.
    • When it lists what packages it will install or remove, it will list them with the first letter highlighted in a different color, kind of like so: fish git texlive
      This makes it really easy to visually scan the package list, and since it's sorted alphabetically, it also makes it easier to find a particular package you might be looking for.
      And while there's separate lists for packages to be added vs. updated vs. removed, they also color those letters in green vs. yellow vs. red, so you can immediately see what's what.
    • When it lists items (other than packages), it prints an ID number, too.
      So, zypper repos gives you a list of your repositories, numberered 1, 2, 3 etc., and then if you want to remove a repo, you can run zypper removerepo 3.
    • When you run a zypper search, it prints the results in a nicely formatted table.

    Documentation: https://doc.opensuse.org/documentation/tumbleweed/zypper/

  • source
  • [–] 8 points 7 months ago

    Honestly, incus.

    I know it's not strictly a utility, but holy cow, Stephane Graber and his team have put the work into that product, such that anything you can do in the ui can be done in the CLI, and more.

    Tab completion entries for all the resource types (storage, instances, image repos, etc), help entries for everything, it brings a tear to the eye.

    I once thought it was cool to have standardised man entries, but even better is context-sensitive --help entries that work well. Almost all the discovery I've made using incus, I've made using the commands themselves.

    It's a real testament to how putting in the documentation work might be tedious, but it is a boon to both users and devs.

  • source
  • [–] 6 points 7 months ago (3 children)
  • [–] 5 points 7 months ago* (1 child)

    I think it depends a lot on what kind of application you’re thinking of. Here are some examples of tools that I particularly remember for having nice CLI interfaces, but they are all slightly different in terms of the number of operations/entities they support.

    Single operation, a lot of different types of data: httpie

    httpie is a CLI HTTP client. It allows to generate fairly complex requests, choose which diagnostic information you want to see, etc.

    Examples:

    $ https httpie.io/hello
    $ http PUT pie.dev/put X-API-Token:123 name=John
    $ http -v pie.dev/get
    

    Several operations, a lot of parameters: Bazel

    Bazel is a build system. There are only a handful of operations you typically perform (build, run, test, query), but they all follow the same pattern.

    Examples:

    $ bazel build //app
    $ bazel --quiet build //app -c opt
    $ bazel --quiet run //app -c opt -- --port=1234
    

    Multiple entites, multiple operations: LVM

    I really liked the interface of Linux Volume Manager tools. They consist of multiple commands that follow the same pattern, and use the same flags for options.

    Examples:

    # vgcreate -n vg_name
    # vgs
    # pvcreate /dev/sda
    # vgextend vg_name /dev/sda
    # lvcreate vg_name -n lv_name -L5G
    # lvresize vg_name/lv_name -L+1G
    # lvs
    
  • source
  • hideshow 1 child comment
  • [–] 4 points 7 months ago

    Ncmpcpp. I've been using it for so long that using other cli music players is almost a no go. Learning a new muscle memory wouldn't be worth it. Album art would be nice but I'm listening to music and staring at the album art for hours. The metadata editor is really nice. It's old reliable.

  • source
  • [–] 4 points 7 months ago

    docker's cli makes a lot of sense to me. Anything that supports "application logical-command --help" gets a big tick.

    But yeah, bash itself is great.

  • source
  • [–] 4 points 7 months ago

    I like the trend of refining existing tools. You take tried-and-true commands and shave off the rough edges and quirks. I use ripgrep instead of grep, fd instead of find, scm_breeze on top of git, dust instead of du, duf instead of df, z over cd, and xh instead of curl

  • source
  • [–] 7 points 7 months ago (1 child)

    i’ve been a big fan of Jujutsu (jj) since adopting it a few weeks ago. things i used to avoid with git like proper rebasing and focused commits become so much easier, in addition to the benefits of conflicts being easier to handle. the learning curve i thought was going to be grueling only took a couple days to get used to, and honestly interop with GitHub and my team’s particular workflow were the hard parts. so not only is it useful, powerful, and becoming more important to my workflow all the time, it’s a joy to use compared to git.

    i guess honorable mention to zoxide, which has basically replaced cd for me since it does everything cd does but also keeps a small db of your most commonly visited directories so you can just do z Downloads or z my_project or whatever from any directory

  • source
  • hideshow 1 child comment
  • [–] 3 points 7 months ago

    Wanted to mention jj too. It follows a fairly standard pattern of ‘ ’, e.g. ‘jj bookmark create’, allows to abbreviate unambiguous commands (e.g. ‘jj b c’), has a lot of QoL features (such as highlighting unique prefixes of change IDs in the output). Really a lot of thought went into CLI design specifically it seems.

  • source
  • parent
  • [–] 3 points 7 months ago*

    My RSS shell script that simply dumps the XML's content nicely formatted on stdout. Seriously, why do all of them have to impose some opinionated TUI on me? Terminals can do bold, dim and underline, that's enough.

    Sorry no, not public. It's faulty and ugly and is missing features (multiple sources for one) and i want to rewrite it in python since at least 2 years.

  • source
  • [–] 3 points 7 months ago (1 child)

    vlc --help outputs text with colors which makes it so much easier to skim

  • source
  • hideshow 1 child comment
  • [–] 3 points 7 months ago (1 child)

    Btop, beautiful and functional.

  • source
  • hideshow 1 child comment
  • [–] 3 points 7 months ago (2 children)

    find and rename/perl-rename/prename (depending on your distro), are two of my favorite cli tools. I generally find both well designed and easy to use. For me, they are indispensable.

  • source
  • hideshow 2 child comments
  • [–] 8 points 7 months ago (1 child)

    I think find UI is so bad every time I use it I think about hacking a script just to make it simpler for my use case. At the same time I am very reluctant to use one of this new versions of standard commands trying to reinvent the wheel.

    Some things I don't link about find:

    1. How the directory needs to be the first argument. I get the reasoning but it is such a pain, specially if you are using it with the same query repeatedly in different paths.

    2. The parenthesis to set order of matches, you are doing it in the shell so you have to escape them which is never fun.

    3. The fact that -name does not match partial names and there is not a version that do so you have to keep doing stuff like -name "*foo*" and of course you have to escape that shit or risk you shell expanding it. Having the GLOB version is nice but there could have a more ergonomic way to do this type, which I assume is a very common use case.

    4. Actually, doing more complex logical matches is always a pain and it would be nice to have a easier way to do some common operations.

    5. The fact that when you do some complex match then the -print is not automatic anymore or the the behaviour is kinda weird. And is a pain to add it in all logical branches or do it in a way that you do not repeat a lot.

    Anyway, sorry for the rant.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 3 points 7 months ago (2 children)

    nmon

    That, along with tmux and htop, are installed on everything I have.

    nmon then ld- give me a system health page that shows me where the bottleneck is.

    It's interesting to see how a system behaves when you're doing something like a backup... it's not always what you think.

  • source
  • hideshow 2 child comments
  • [–] [S] 1 point 7 months ago (1 child)

    Don't want to sound unappreciative, but the apps you refer to (and others in these threads) are not actually CLI's but TUI's.

    • CLI (command line interface) is when all interaction actually happens in the command line, ie. command + arguments. CLI's are much simpler to implement, have little dependencies (pretty much just argument list, two data streams---stdout and stderr--and exit status) and typically one invocation means one independent task. All this makes CLI's ideal as building building blocks of (semi-)automated workflows, but many CLI's are also optimized for direct invocation from interactive shell, eg. by adding features such as output coloring, interactive yes/no steps or command completion (although that part is actually driven by the shell, and is quite independent from the execution of the app.)

    • TUI (text user interface, i think) on the other hand, is more like GUI but replicated within the confines of terminal emulator. The interaction heavily depends on terminal features such as moving cursor, resize notifications, etc. Also when TUI is ran, it's normally used for zero to may tasks: e.g. I could start htop and investigate no process, 1 process or many, before quitting. Unlike CLI's, TUI's pretty much make no sense within automation.

    Don't get me wrong: I love TUI's (htop is one of my favorite and thanks for recommending nmon, i'll have a look)--and often prefer them to GUI's (eg. my text editor is nvim, which is a TUI app!), but in my post I was specifically interested in exploring CLI's. I would actually love a similar post to mine but focusing explicitly on TUI's as opposed to CLI's.

    Sorry for long post -- I hope it can kind of serve as explanation for people who are new to this and stumble upon this thread and aren't quite familiar with the distinction.

  • source
  • parent
  • hideshow 1 child comment
  • [–] 3 points 7 months ago

    Pure cli or also TUI? When it comes to TUI probably yazi is my most used tool right now, use it pretty much every day. For pure cli i would probably give my vote to sed. I use the crap out of it in a bunch of scripts. For example i switch my themes with it by replacing whatever import i had in the config to the desired theme, then reload the programs.

  • source
  • [–] 4 points 7 months ago

    uuuuh just bash with some simple bashrc and inputrc settings

  • source
  • [–] 2 points 7 months ago (1 child)

    No-one mentioned 'jq' yet.

    Maybe there's a reason for that!

  • source
  • hideshow 1 child comment
  • [–] 2 points 7 months ago

    All CLI commands

  • source
  • [–] 2 points 7 months ago
    [–] 2 points 7 months ago

    I find fd to have a really nice API.

  • source
  • [–] 2 points 7 months ago

    Favourite CLI I'd say is Junos. Structured, hierarchical, flexible.

  • source
  • [–] 3 points 7 months ago
    [–] 1 point 7 months ago

    I don't think there is some exceptional good CLI interfaces. If anything, you either notice the interface is bad or unconventional or it is cluttered, because it has lots of functionality. It also depends if it "should" fit into the Linux eco system (similar commandline system and logic) or is this tool used for any operating system. I have my own scripts as wrapper for some tools, so they are excluded from discussions here. Note I think the discussion is about commandline interfaces that operate non interactive (in other words no "live" TUIs or interactive editors), so no Vim or htop.

    Tools like yt-dlp or awk or find or git are complex and overloaded with functionality, because it offers so much and has to offer all of that. Or the command works different, because of its nature of calling another command like parallel. Then there are commandlines that just deviates from the standard and bugs me a lot. One of the worst offenders to me is 7z from package extra/7zip in the Arch repositories. But it is not a standard GNU tool, therefore it does its own thing.

    So in the end, I do not think there is an exceptional good CLI, only bad or complicated ones. As long as it follows Linux standards its good to go. Often the best Rust CLI tools have pretty good ones that could be listened as standouts, but none specific in particular.

  • source