TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: What are the best and worst command-line interfaces you have used?

33 pointsby de_keyboardover 3 years ago
I am interested in learning what makes a great (or terrible) command-line interface.<p>What are some of the best and worst command-line interfaces you have used?

33 comments

urxvtcdover 3 years ago
Nearly everything that packs or unpacks stuff. tar, gunzip, and else. I can never remember if they are going to unpack everything into a subdirectory or spill everything into my home, and conversely I never know if after zipping there&#x27;s gonna be a directory inside or not. Luckily dtrx and atool do the thing you want most of the time.<p>From the time I was a teen I think I remember that mount was difficult to use, and mounting a CD image required passing some arcane options, though maybe I just didn&#x27;t know how to use it (on the other hand I didn&#x27;t know how to use Daemon Tools either, and it just worked).<p>I don&#x27;t have a problem with git though. I don&#x27;t think it&#x27;s the command-line interface that&#x27;s hostile, it&#x27;s git itself if you don&#x27;t know what you&#x27;re doing. After taking some time to learn it I actually enjoy solving difficult problems with git.
评论 #29334724 未加载
评论 #29337705 未加载
评论 #29333865 未加载
评论 #29330221 未加载
评论 #29330526 未加载
评论 #29330156 未加载
评论 #29340310 未加载
jasodeover 3 years ago
The ImageMagick utility mogrify.<p>By default (without specifying extra command-line options) it <i>overwrites</i> the input files. [1]<p>In decades of computer use, that is the only command line tool that tricked me into destroying my data because I didn&#x27;t realize it works differently from all the other tools I use that don&#x27;t do that.<p>Usually, a command line utility with <i>less options specified</i> is relatively &quot;safe&quot; and you have to add extra syntax to make it &quot;unsafe&quot;.<p>It was definitely a violation of: <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Principle_of_least_astonishment" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Principle_of_least_astonishmen...</a><p>EDIT reply to: <i>&gt;The whole reason for mogrify&#x27;s existence is that it overwrites the original image file.</i><p>Sure, I understand that but many other <i>destructive</i> tools will have safety UI features such as creating &quot;.bak&quot; backup files. That&#x27;s what many other command line tools do including image utilities. So something like mogrify could have been designed with hypothetical syntax as <i>&quot;mogrify -nobackups&quot;</i>. The principle is to type <i>extra syntax</i> to make it more dangerous while still accomplishing the (observable) goal of changing the original files.<p>[1] <a href="https:&#x2F;&#x2F;superuser.com&#x2F;questions&#x2F;1575004&#x2F;imagemagick-how-to-avoid-overwriting-existing-files-with-mogrify" rel="nofollow">https:&#x2F;&#x2F;superuser.com&#x2F;questions&#x2F;1575004&#x2F;imagemagick-how-to-a...</a>
评论 #29330097 未加载
评论 #29335669 未加载
bduffanyover 3 years ago
Not the worst (I think `tar` and `unzip` probably take the cake) but `find` is pretty atrocious IMO. The order in which you specify certain flags like `-maxdepth` relative to other option flags matters (not just relative to plain arguments, but relative to other option flags starting with `-`).
评论 #29332893 未加载
评论 #29336453 未加载
btschaeggover 3 years ago
Good:<p>For interactive shell scripting:<p>- AWK. Old enough to be part of the POSIX standard and yet considerably more awesome than almost any other UNIX command.<p>- socat for any kind of network&#x2F;socket testing stuff.<p>- sponge and entr just for their genuine usefulness with minimal interface.<p>For interactive use:<p>- SSH. I mean, obviously. It&#x27;s also astounding how well OpenSSH integrates into the whole *NIX TTY landscape. You can use it for years and still learn neat things about it.<p>- Vim. Yes, it&#x27;s obscure to learn, but once you do, boy do you get a lot out of it. Also: Since `:terminal`, working on one-off scripts has become considerably more awesome.<p>- htop and btop++ are good examples of TUIs for interactive use.<p>- tig is also quite cool for many git interactions (especially partial staging).<p>- lnav for log analysis tasks.<p>For batch jobs you set up and trigger as needed:<p>- Beets (see: beets.io). It&#x27;s impressive how streamlined it works once you&#x27;ve set it up.<p>Bad:<p>- Pretty much anything Microsoft. I really don&#x27;t understand how it&#x27;s possible to consistently produce bad CLI programs for such a long time.<p>- As a prime example, have a look at `sc sdshow` and `sc sdset`.<p>Edit: Perhaps to clarify about the sc SDDL commands:<p>If you look them up, you won&#x27;t find much &quot;bad&quot; in their documentation. Because nothing about the SDDL syntax they are built on is documented. The best you can do is scrape together what you can from third-party blogposts with a perceived signal:noise ratio of .000001.<p>And SDDL in itself is <i>phenomenally</i> badly designed. And, of course, this being Microsoft, the tool isn&#x27;t designed to be used together with other programs.
rwmjover 3 years ago
My niggle is with commands that cannot be composed, ie. consumed by other tools or shell scripts or built into pipelines. There are lots of small things that break composition: Not exiting with a non-zero code on error, sending error messages to stdout, not producing output that can be easily parsed by another command. Too many commands suffer from one of these problems, unfortunately.
评论 #29335748 未加载
评论 #29330176 未加载
sergiotapiaover 3 years ago
worst is git by far.<p>i&#x27;m used to it now but when I was learning, &quot;what the fuck did `git reset --hard` do? where is --soft? Is there a no-flag version? What the fuck did I leave mercurial for. God damn I miss svn.&quot;<p>I still kind of miss Mercurial and TortoiseHG.
评论 #29330076 未加载
评论 #29343426 未加载
评论 #29335185 未加载
评论 #29330083 未加载
评论 #29341115 未加载
评论 #29330006 未加载
评论 #29335792 未加载
codemusingsover 3 years ago
Worst: sqlplus by Oracle. No autocomplete, no backspace, no history function. It&#x27;s like nobody ever inside Oracle ever had to use this craptastic piece of software to accomplish anything.<p>EDIT: Oops backspace works. Might have been a combination of putty and sqlplus. Nevermind.
评论 #29329996 未加载
visiblinkover 3 years ago
The best: an old CD player called Workbone on Slackware. It made great use of the number keys for pause&#x2F;play&#x2F;ff&#x2F;rw&#x2F;eject.<p>The worst: I used to work with an awful custom-built industrial computer.<p>You had to enter the 10-character alphanumeric codes of 98 rail cars into a command-line interface that didn&#x27;t permit backspacing. One mistake. Car 97. Do it all again.
notacowardover 3 years ago
Many of the worst ones I&#x27;ve used have been embedded in physical devices - ethernet or fibre channel switches, disk arrays or controllers, etc. I&#x27;ve been around long enough that I don&#x27;t expect every CLI in the universe to have things like history, command line editing, or autocomplete, so that&#x27;s OK. On the other hand, many of these interfaces are wildly <i>inconsistent</i> and that bugs me. Some commands are object-verb and some are verb-object. Some are abbreviated, some are verbose. One command produces an identifier in format X, but the next command consumes it in format Y so you can&#x27;t even use your terminal&#x27;s copy&#x2F;paste function. Excessive modality is another common problem in these interfaces. Which sub-sub-sub-mode was the command I needed in, again? Can&#x27;t know without actually <i>entering</i> that mode, and then the next related thing you have to do is in a completely different part of the tree. Using such interfaces directly can be painful, and automating them is often inordinately difficult too.
BlackLotus89over 3 years ago
Why is nobody hating on megacli? It&#x27;s the only tool I use where I actually need a wrapper script. There are other horrible command line experiences, but nothing anyone here listed I would describe as horrible...
评论 #29331784 未加载
runjakeover 3 years ago
The Windows Resource Kit binaries come to mind. They were distributed together in the same ZIP, but:<p>1. They used differing return values for success and failures. Sometimes, a 0 was a success, sometimes 1 was a success, and sometimes only 4 was a failure, but everything else was a success.<p>2. They used different command-line switch formats. Some utilities used a hyphen, others used a forward slash.
adonovanover 3 years ago
ps(1). It has two incompatible theories of options from the two parent tools that spawned it, both equally horrible. ps -e f is not the same as ps -ef or ps ef. Also, implementations vary wildly across platforms.
cpachover 3 years ago
Two of my favourites are Watson and Homebrew. Very well thought out.<p><a href="https:&#x2F;&#x2F;tailordev.github.io&#x2F;Watson&#x2F;" rel="nofollow">https:&#x2F;&#x2F;tailordev.github.io&#x2F;Watson&#x2F;</a><p><a href="https:&#x2F;&#x2F;brew.sh&#x2F;" rel="nofollow">https:&#x2F;&#x2F;brew.sh&#x2F;</a>
评论 #29336037 未加载
blakesterzover 3 years ago
Does something simple like htop count? I believe there&#x27;s a bunch of other good stuff that uses ncurses as well.
Cicero22over 3 years ago
I detest the MikroTik cli. I suppose the cli itself isn&#x27;t terrible, but the fact that it&#x27;s coupled with the mikrotik scripting language leaves a very bad, nearly rotten, taste in my mouth.
stackedinserterover 3 years ago
To me, openssl and nmap are the worst.<p>Kubectl is among the best: commands make sense and have internal logic, interface is discoverable, output is configurable and supports different formats.
评论 #29330078 未加载
评论 #29330092 未加载
BoxOfRainover 3 years ago
I&#x27;m rather fond of pgcli at the moment, though I haven&#x27;t used it long enough to get a brilliant feel for it yet.
评论 #29376168 未加载
speedgooseover 3 years ago
I find it very easy to remember many terrible command line user interfaces, they are already mentioned in the discussion, but very hard to name a single great one.<p>Maybe a good command line user interface is one you don&#x27;t notice nor remember. It just work smoothly. So I will start with cat.
评论 #29334988 未加载
amznbyebyebyeover 3 years ago
R dplyr is one of the best interface I have ever seen for manipulating data. I think one of Hadley’s biggest contribution to the world of data science. It feels like my brain can breathe out dplyr code
zaphirplaneover 3 years ago
Anything with the Command —global-flags subcommand -subflags command -flags parameters<p>Git does this but is workable because it’s 2 levels and you don’t need to specify various flags defaults are usually ok
ossusermivamiover 3 years ago
anything that doesn&#x27;t have (preferably zsh) shell completions.<p>I mostly discover flags with tab completions and the attached help to it (maybe that&#x27;s only a zsh feature not sure if other shell have help on flags on completion)<p>bonus point to very smart completion, i.e: on kubectl if i do kubectl -n foo get pods [TAB] it will get the tab from the namespace foo on completion not from the default&#x2F;current namespace.
hosejaover 3 years ago
Tangentially, I&#x27;m continually surprised at the lack of trivial GUIs for CLI tools. Like, command builders (output is a command you can run&#x2F;paste into terminal) with procedurally-generated (or hand-built but without much design consideration) widget interfaces - a simple checkbox or line input for each option, with helpful concise tooltips. Training wheels for CLI.
nikiviover 3 years ago
Best is probably <a href="https:&#x2F;&#x2F;github.com&#x2F;cli&#x2F;cli" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;cli&#x2F;cli</a>
makeitrainover 3 years ago
I worked in a campus bookstore with an old terminal system to access the inventory database. It was a simple text interface. What I loved about it was that the commands to navigate were quick to learn (key was first chars in command) and the response time was instant. So you could jump to any part of the system with a few keystrokes ingrained in muscle memory.
评论 #29333980 未加载
gerbercjover 3 years ago
I recommend reading this site: <a href="https:&#x2F;&#x2F;clig.dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;clig.dev&#x2F;</a>
sam_lowry_over 3 years ago
The combination of mosh and screen has been a big productivity booster for me. The shell alias server1=&#x27;mosh root@server1 -- screen -xRR -D&#x27; keeps the connection forever even if I change networks.<p>The only pity is that mosh breaks compatibility with earlier versions once in a while.
评论 #29333997 未加载
cr3ativeover 3 years ago
I generally dislike interfaces which don&#x27;t react well to terminal resizing, usually because they&#x27;re trying to do something fancy with progress bars.
matthewmacleodover 3 years ago
rsync is probably my least favourite. I literally don&#x27;t think I have ever correctly written a command that does what I intended on the first attempt.<p>I do like anything that&#x27;s a nice well-structured representation of an API though – things like the AWS CLI are pretty good in practice, IMO.
gonewestover 3 years ago
Surprised to see nobody calling out ffmpeg as one of the most hostile UIs anywhere
评论 #29345346 未加载
discord23over 3 years ago
&gt; worst command-line interfaces<p>If you mean TUI wise as in curses, nearly all of them.<p>Command line parameters however, there are so many examples. Tar, unrar and unzip take the cake, all in the same category of tools. &quot;unrar x&quot; whatever it is, I always have to look it up. dd because of the way its parameters are specified: dd if=&#x2F;dev&#x2F;zero of=foo.bar bs=4096 count=1024 . It&#x27;s all historical and I can live with it, but many of them at least have the saving grace that they have excellent manpages or you&#x27;ve used them so often it becomes second nature.<p>There should be a special place in hell for tools that combine short and long style command line options with a single dash. Like &quot;foo -b a -r -baz 123&quot; with &quot;-baz&quot; being a single option, because I will automatically add an extra dash there out of habit.<p>Coworkers discovering ncurses or some library around it tend to go on a TUI frenzy for a while, and it inevitably ends up being some convoluted mess nobody wants to use. I&#x27;ll admit there&#x27;s a few indispensable curses based tools, for instance top (and some variants along that line), but they&#x27;re far and few in between. At most dialog comes to mind for dealing with prompts for end users, but I personally abhor it in anything but a setup or installation context.<p>Those very same coworkers also make tools with indecipherable command line options, often because they don&#x27;t know the language they&#x27;re working in has a standardized option parser library or module.<p>&gt; best<p>I don&#x27;t remember which tool it was, it could be &quot;crm&quot; (for failover, think like heartbeat and pacemaker) but I might be mistaken. It&#x27;s been years since I&#x27;ve used it. The command line had options like so:<p>tool [options] section action resource_src resource_tgt<p>But the best part was, if you just started the tool without any options, it&#x27;d drop you into a pseudo-shell. It&#x27;d show you a blank prompt ending in &quot;&gt;&quot;. If you then typed &quot;section&quot; you&#x27;d end up with a &quot;section&gt;&quot; prompt.<p>I remember for what I was doing with it, it felt really intuitive. At any point I could type &quot;help section&quot; and it&#x27;d list the available actions for that section, together with short example.<p>I&#x27;ve forgotten the real syntax, but you&#x27;d have commands like:<p>tool node status<p>tool node standby servername<p>tool service stop dns<p>tool service migrate dns secondary<p>If you were in the pseudo-shell, you could do:<p>$ service<p>service$ migrate dns secondary<p>service$ up<p>$ node<p>node$ status<p>node$ exit
ponyousover 3 years ago
lazygit and lazydocker - both are really great
swahover 3 years ago
Best: darcs
KronisLVover 3 years ago
Best: probably that of Docker. <a href="https:&#x2F;&#x2F;github.com&#x2F;docker&#x2F;cli" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;docker&#x2F;cli</a><p>Why: it didn&#x27;t force you to read man pages or look up documentation, but instead allowed every command to explain what it does to you, either when you&#x27;d run it with --help, or just no parameters (in case it expects any). Furthermore, invocations of these commands weren&#x27;t just a long string of arguments, but rather commands that are logically grouped and can essentially be navigated as a tree. All of that made it extremely useful and pleasant, at least in my eyes.<p>It just feels like it&#x27;s made to actually be used by developers and to help them as much as possible. Whether you agree with me on that or not, i suggest that you have a look at this excellent talk by Dylan Beattie, &quot;Life, Liberty and the Pursuit of APIness: The Secret to Happy Code&quot;, which talked more about the discoverability of systems and the developer experience: <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=lFRKrHE8oPo" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=lFRKrHE8oPo</a><p>Nowadays, you can actually use something like Typer for Python to create similarly useful interfaces, which i strongly advise you to have a brief look at: <a href="https:&#x2F;&#x2F;typer.tiangolo.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;typer.tiangolo.com&#x2F;</a><p>Example:<p><pre><code> $ docker Usage: docker [OPTIONS] COMMAND A self-sufficient runtime for containers Options: ... (a list of items) -v, --version Print version information and quit Management Commands: ... (a list of items) image Manage images Commands: ... (a list of items) Run &#x27;docker COMMAND --help&#x27; for more information on a command. To get more help with docker, check out our guides at https:&#x2F;&#x2F;docs.docker.com&#x2F;go&#x2F;guides&#x2F; $ docker image Usage: docker image COMMAND Manage images Commands: ... (a list of items) ls List images ... (a list of items) pull Pull an image or a repository from a registry Run &#x27;docker image COMMAND --help&#x27; for more information on a command. $ docker image pull &quot;docker image pull&quot; requires exactly 1 argument. See &#x27;docker image pull --help&#x27;. Usage: docker image pull [OPTIONS] NAME[:TAG|@DIGEST] Pull an image or a repository from a registry $ docker image pull alpine:3.15 3.15: Pulling from library&#x2F;alpine 59bf1c3509f3: Pull complete Digest: sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300 Status: Downloaded newer image for alpine:3.15 docker.io&#x2F;library&#x2F;alpine:3.15 $ docker image ls REPOSITORY TAG IMAGE ID CREATED SIZE alpine 3.15 c059bfaa849c 11 hours ago 5.59MB </code></pre> The worst: tar<p>Why: <a href="https:&#x2F;&#x2F;xkcd.com&#x2F;1168&#x2F;" rel="nofollow">https:&#x2F;&#x2F;xkcd.com&#x2F;1168&#x2F;</a><p>In short, it&#x27;s the exact opposite of the previous example. Frankly, without memorizing the flags, i still have no idea how to work with archives with it. Say, i want to create a compressed archive with it.<p>Example:<p><pre><code> $ tar tar: You must specify one of the &#x27;-Acdtrux&#x27;, &#x27;--delete&#x27; or &#x27;--test-label&#x27; options Try &#x27;tar --help&#x27; or &#x27;tar --usage&#x27; for more information. $ tar --usage Usage: tar [-AcdrtuxGnSkUWOmpsMBiajJzZhPlRvwo?] [-g FILE] [-C DIR] [-T FILE] [-X FILE] [-f ARCHIVE] [-F NAME] [-L NUMBER] [-b BLOCKS] [-H FORMAT] [-V TEXT] [-I PROG] [-K MEMBER-NAME] [-N DATE-OR-FILE] ... (a really long list of items) $ tar --help Usage: tar [OPTION...] [FILE]... GNU &#x27;tar&#x27; saves many files together into a single tape or disk archive, and can restore individual files from the archive. Examples: tar -cf archive.tar foo bar # Create archive.tar from files foo and bar. tar -tvf archive.tar # List all files in archive.tar verbosely. tar -xf archive.tar # Extract all files from archive.tar. Main operation mode: ... (a list of items) -c, --create create a new archive Operation modifiers: ... (a list of items) Local file name selection: ... (a list of items) File name matching options (affect both exclude and include patterns): ... (a list of items) Overwrite control: ... (a list of items) Select output stream: ... (a list of items) Handling of file attributes: ... (a list of items) Handling of extended file attributes: ... (a list of items) Device selection and switching: ... (a list of items) -f, --file=ARCHIVE use archive file or device ARCHIVE Device blocking: ... (a list of items) Archive format selection: ... (a list of items) FORMAT is one of the following: ... (a list of items) Compression options: ... (a list of items) -z, --gzip, --gunzip, --ungzip filter the archive through gzip Local file selection: ... (a list of items) File name transformations: ... (a list of items) Informative output: ... (a list of items) -v, --verbose verbosely list files processed Compatibility options: ... (a list of items) Other options: ... (a list of items) Mandatory or optional arguments to long options are also mandatory or optional for any corresponding short options. The backup suffix is &#x27;~&#x27;, unless set with --suffix or SIMPLE_BACKUP_SUFFIX. The version control may be set with --backup or VERSION_CONTROL, values are: ... (a list of items) Valid arguments for the --quoting-style option are: ... (a list of items) *This* tar defaults to: --format=gnu -f- -b20 --quoting-style=escape --rmt-command=&#x2F;usr&#x2F;lib&#x2F;tar&#x2F;rmt.exe --rsh-command=&#x2F;usr&#x2F;bin&#x2F;rsh $ # Copied from the Internet, because the documentation is overwhelming $ tar -vczf new-archive.tar.gz .&#x2F;files-i-want-to-archive .&#x2F;files-i-want-to-archive&#x2F; .&#x2F;files-i-want-to-archive&#x2F;test1.txt .&#x2F;files-i-want-to-archive&#x2F;test2.txt .&#x2F;files-i-want-to-archive&#x2F;test3.txt $ # Consider the full format instead, maybe we should actually use the full parameters more often? $ tar --verbose --create --gzip --file=new-archive.tar.gz .&#x2F;files-i-want-to-archive </code></pre> In short, using tar does not inspire joy and it feels overcomplicated, no matter how you look at it, possibly either because creating archives is a complicated domain (though the zip tool might not necessarily support that claim), or because the tool has grown over time and no longer does just one thing and does it well.