return to table of content

Entering text in the terminal is complicated

onehair
15 replies
22h59m

Doesn't Windows, the most popular OS out there, have a cmd.exe terminal thing? Why isn't that harming Windows?

The Windows Command Prompt's default experience is worse than most if not all terminals you find on Linux systems. Even in play TTY, you're bound to find that the shortcuts the author mentioned work like a charm.

To make my cmd.exe bearable I am using https://chrisant996.github.io/clink

tl;dr You're comparing the choice of wheels on a plane to what makes planes sell more.

SAI_Peregrinus
5 replies
21h14m

Essentially nothing in Windows requires cmd.exe. Having a terminal in a desktop OS isn't a problem. Needing one is.

Just like having a GUI isn't a problem for a server OS, but needing one is a problem.

hnlmorg
4 replies
20h15m

Apple would disagree with you on both counts.

Plus for a long time desktop Windows needed cmd.exe to support login scripts.

Just as people use Linux daily without ever touching the command line. Eg Android, LG smart TVs (webOS), Satellite TV set top boxes (eg Sky Q), home routers, etc.

And if you want to focus on Linux running on laptops, then there are ChromeBooks and the old Asus EeePCs.

The reason desktop Linux isn’t polished is because every time a company invests heavily into desktop Linux, Microsoft undercuts them (like how they sold XP at a loss to thwart Linux in the netbook market). But the fact that Apple could take BSD, Google take Linux, and Nintendo also run BSD on some of their consoles, really speaks volumes about how there’s nothing technically stopping people running a POSIX platform like Linux and still hide the command line from regular users.

Though going back to my “Linux isn’t polished” point, I still think Linux+KDE is a lot more polished than modern Windows. But that’s just my biased opinion.

andsoitis
1 replies
12h24m

Just as people use Linux daily without ever touching the command line. Eg Android, LG smart TVs (webOS), Satellite TV set top boxes (eg Sky Q), home routers, etc.

None of those are (used as) general purpose computers though.

hnlmorg
0 replies
12h2m

Did you read my next paragraph where I acknowledged that point myself and gave some laptop examples too?

Plus I’d argue Android is the average persons general purpose computer. At least in terms of the people I know, they use their phones for 99% of things and actively avoid using a laptop as much as they can.

SAI_Peregrinus
1 replies
15h50m

I agree about Linux + KDE being more polished.

For my main point, I suppose I should have specified GNU/Systemd/Linux as needing a CLI, not everything with a Linux kernel. POSIX-style kernel + libc is a very good basis for an OS, and such an OS doesn't need a CLI exposed to the user. It's all the Udev/Systemd/SysVInit & similar stuff that's CLI-only, and desktop Linux tends to require interacting with one or more of those on at least an occasional basis.

hnlmorg
0 replies
11h53m

There are web based GUIs for systemd (and sysv init too).

But the main reason you don’t see GUIs for those services is because Desktop distros tend to abstract away systemd so you don’t even need to manage it, let alone have a GUI to do so.

Like with Windows, the average user wouldn’t be manually managing what services to start and stop.

And that’s the real crux of things. A lot of the stuff that people say you need a CLI for in Linux are operations that the average user wouldn’t know nor want to do on Windows even with a GUI. They just run a browser and if the machine goes slow they ask someone technical (friend or shop) to fix. I know this because I used to be that friend.

So I really don’t think the CLI is what holds back Linux. It’s just the economics was never there while Microsoft dominated the desktop world. And these days most people use phones and tablets as their general purpose device, so in a way Linux did eventually win anyway.

a1o
3 replies
22h40m

Windows has a new terminal as default that is pretty cool - I install MSYS2 and set it in the new Windows Terminal and it's all good. Gnome Terminal and other terminals on Linux are also pretty cool too.

If you want the worst default terminal experience just boot macOS.

xp84
2 replies
19h12m

Can you explain what's the big appeal of other terminal apps? I have been using Terminal for 21 years without any issue -- but I'm open to trying something else.

Actually I've only this year switched to an "AI enabled" terminal app called Warp.

rablackburn
1 replies
18h16m

I’m curious to know what your experience of changing to Warp has been like? Sounds like terminal was working fine for you - was the switch worth the time?

I signed up for the waitlist ages ago and finally got the announcement of Linux support in February but am still yet to try it. Mainly because I’ve had a particularly busy year and I can’t justify fiddling around with my stack just for fun. I have no appetite for the risk I may lose hours to fixing something that goes wrong.

xp84
0 replies
13h22m

On Warp: After adjusting a couple of minor settings, I found Warp to be worth it. In fact, I at first trialed it 'side by side,' meaning keeping Terminal.app and Warp both open -- and found myself going for the Warp window more often. So it was an easy call for me.

I chose to not use its custom prompt because I wanted things to be more 'stock' in the terminal and not to rely on an app external to the shell for the features -- the only really fancy prompt feature I have is git branch display, and that's already working fine with my existing zsh prompt.

So, anyway, I can vouch that it didn't try to make changes to my environment (other than that offering to override the prompt, which I think it does in a way that doesn't update your .zshrc/.bashrc file anyway).

And for what it does do, I think it's great. Having command outputs separated and in little scrolling panes, really great. And mouse-able, standard text field to edit commands in, also amazing. Say you have a long URL on the clipboard with a {object_id} variable in the middle. You can paste it in, and use the mouse to select "{object_id}" and replace it instead of using arrow keys etc. to manually delete and replace the variable. So with the above efficiency gains it is already pretty cool compared to any kind of terminal app I knew of.

The AI stuff has been great to have as well. It's really convenient to have free access, right in the terminal, to an LLM that I assume has been well prompted to produce shell or scripting code as requested.

One thing I turned off is their recent "Detect natural language automatically" feature. Before, if you wanted to invoke AI, you just did a #comment. So for instance "# docker command to remove exited containers" -- well, they updated it so that even without that "#" it should "just know" from inspecting the command. But I had a problem with it getting confused by a shell command that was also parseable as 2 English words. I think I prefer actually knowing whether I'm commanding a shell or operating an LLM, anyway.

BTW - it occurs to me that there are also big categories of features that it has which I don't even use, such as like, runbooks that can automate frequently-done tasks, things like that. Those may also factor into your decision.

delta_p_delta_x
2 replies
22h46m

Doesn't Windows, the most popular OS out there, have a cmd.exe terminal thing? Why isn't that harming Windows?

That's because the overwhelming majority of Windows usage, administration, and programming can be done almost entirely without ever touching the command-line, from Explorer.exe, Task Manager, Edge, Media Player, Paint, and built-in ZIP handling to the huge list of MMC snap-ins[1], and Visual Studio 2022.

tl;dr You're comparing the choice of wheels on a plane to what makes planes sell more.

For the record, aeroplane cockpits have also gotten considerably simpler in the intervening half-century since Concorde and the first 747s. Here is an Airbus A350 cockpit[2].

[1]: https://serverfault.com/questions/158075/what-are-the-names-...

[2]: https://cdn.airplane-pictures.net/images/uploaded-images/201...

squigz
0 replies
22h22m

For the record, aeroplane cockpits have also gotten considerably simpler in the intervening half-century since Concorde and the first 747s. Here is an Airbus A350 cockpit[2].

I mean, aesthetically it's simpler sure, but the complexity is still there; it's just now much more digital.

adrian_b
0 replies
22h13m

That does not match my experience, even if I also believed that myth.

At one time I had to install Windows Enterprise IoT on several kinds of embedded computers, all of which had various quirks.

The computers worked fine in Linux, from the first attempt to boot it, without the need to do anything special, but a customer wanted to have Windows on those.

After installing Windows, there have been a lot of problems, for instance Windows was unbelievably slow, because the SSD's had a very low writing speed, but they could not be replaced with decent SSD's, because the embedded computers were certified for certain applications only with their original components.

Making Windows usable on those computers has required a week of tuning and finding various workarounds by searching the Windows Knowledge Base and various Internet Forums, where many Windows users had the same complaints as me, but few were able to provide good advice about how to solve the problems.

I have been astonished to discover that for every workaround I was not able to find any way to do it in any graphic interface of Windows, but all workarounds required to use in a Cmd window some obscure Microsoft command-line utilities with a lot of magic command-line options, which I did not understand and I could not find in the official Windows Knowledge Base, but which were suggested as solutions on various Internet forums and indeed they worked as desired.

TacticalCoder
1 replies
22h13m

Doesn't Windows, the most popular OS out there, ...

The most popular desktop OS. It is nowhere to be found in the Top 500 supercomputers, is nowhere to be found on smartphones, lags in the Cloud, is nowhere to be found in the billions of appliances, etc.

Why isn't that harming Windows?

It is harming Windows. That horrible cmd.exe is one of the reason Windows lost in all the other markets and has hardly any market share there.

ddingus
0 replies
4h20m

Seriously.

Back in the 90's a lot of movie production was being done on the SGI IRIX computers. Jurassic Park themed ones even. Really spiffy machines with both an excellent GUI and terminal.

Cheap WIN NT boxes with nVidia GPUs on them, were seen as the beat path forward.

SGI gear is also Jurassic Park style, "Spare no expense" and was not cheap! Super expensive machines, but people got what they paid for too.

Alias, Maya were ported to Windows and off to the races right?

Nope. Unix scripting, that awesome terminal and friends made all the difference in the world.

This was true even for smaller or single person shops who would do the work in a now slower SGI because the user experience was bang on point and that meant getting the desired outcome first time no bullshit.

The minute we had nVidia drivers, Linux was in to replace the SGI machines.

And, the production community realized they could each write tools or poet tools they were good at, share and share alike (to a point) and all be in business a whole lot cheaper and faster.

That took a couple maybe few years.

The "terminal" and what can happen in one and why really does matter.

Windows Power Shell is pretty OK at this point, but it is still its own thing, not playing very nice with the other kids in the sane box.

Lol, I always thought Microsoft happening in Redmond was symbolic. It really is!

squigz
10 replies
23h20m

95% of the population doesn't need to use the terminal.

Waterluvian
9 replies
23h14m

If you love cars, popping the hood is probably part of the experience. For everyone else, it’s the sign of a very frustrating day ahead.

As computer lovers, I feel we must endeavour to remain mindful that almost everyone else aren’t like us. They’re trying to get a task done. They don’t want to maintain or talk with the computer.

squigz
7 replies
22h34m

As computer lovers, I feel we must endeavour to remain mindful that almost everyone else aren’t like us. They’re trying to get a task done. They don’t want to maintain or talk with the computer.

This was pretty much my point. 95% of the population isn't like us, and don't need to interact with the terminal; thus, thinking the terminal is what's keeping Linux back doesn't make much sense to me

shadowgovt
5 replies
22h18m

The larger issue is the times that the Linux UX goes off the rails and the solution turns out to be "You're going to have to bleat this esoteric incantation at the command line." I plugged my laptop into a second monitor the other day and, oops, for whatever Godforsaken reason it didn't auto-detect. Suddenly I'm munging around in `xrandr` to get my screens to work.

To its credit, all the major desktop distributions today are making real inroads to narrowing the scope of situations where that happens. This was a much larger concern in the past, where key aspects of the user experience were still in the category "There was a command-line tool written to control it and that's all you'll ever need, dammit."

yencabulator
4 replies
19h53m

The alternative is "it just won't work". You too can live in that world by simply not trying to fix it.

My wife's Macbook won't suspend correctly when it's plugged into a Dell monitor, the monitor going into power save wakes up the laptop. I wish there was an arcane incantation that would fix it, but no, the proprietary walled garden is well locked up, with glossy user-friendly rounded corners everywhere.

xp84
3 replies
19h14m

This is the most insightful post in the thread -- there's definitely a false dichotomy here. It's not "have to use a terminal" vs "everything works without a need for a terminal ever" -- it's "able to use a terminal to accomplish some goal or recover from Really Bad Thing" vs "Can't Do That Thing / have to factory restore to recover".

Like the way Apple Maps on my iPhone can't save the person to notify when I navigate to Home. I can save a person to be notified to any arbitrary location besides Home. With Home though, the setting simply doesn't save. I'm sure if I had a terminal I could inspect the data involved and manually fix what's wrong, but the 'Apple' or GUI-only approach simply makes that out of the question. Even better, when the corrupted data is cloud-resident I think the answer is often just that it's broken permanently unless you want to create a brand new account.

There are millions of computers out there that just don't work right, or where people can't accomplish some goal they wish they could. That's the flip side of the 'terminal or not' coin. Neither is a good experience for users who aren't technical though. For nerds though the Terminal provides a great deal.

shadowgovt
1 replies
17h17m

In general, Apple would solve that problem by recommending you plug an Apple computer into an Apple monitor.

The Apple ecosystem is well incentivized to make all of their pieces work with their other pieces. The Windows ecosystem is pretty decently incentivized to make things work together in general (In both directions... Windows suffers in sales if there's some popular hardware it won't work with, and popular hardware suffers in sales if it doesn't work with Windows).

One certainly does run into the occasional Dell monitor with Apple laptop problem that you then need a couple of insider specialists to address. But I've not really been sold on the notion that The open ecosystem is strictly superior in that sense... In theory it is, in practice you can't be an expert at everything and there's no guarantee anyone's going to come along and care about how to fix your particular Dell / Linux distro configuration.

xp84
0 replies
13h16m

How does the monitor thing relate to what I was saying? In my case, I'm saying that Apple's tightly-coupled, app-OS-cloud integration means I have no ability to see what's wrong (and I'm positive the minimum wage phone support guys will not be able to escalate a bug like that to Engineering and get it fixed). My point was even first-party walled garden stuff doesn't work right, and having no access beneath the GUI rules out anyone outside being able to fix it. I get your point though that the 'right person' who could use that access to more obscure things may be rare anyways.

Workaccount2
0 replies
17h47m

I think my main gripe though is that there simply isn't enough drive to move things out of the terminal and into a GUI.

I really think that a core problem is that once you are in a position where you are contributing to distros, contributing to the kernal, you are well versed and acquainted with the terminal, and you love it's incredible power and efficiency. The cockpit is no longer a sci-fi meme, it's a meticulous masterpiece granting a god-like computing interface. Nobody at that level is interested in much GUI-ification, because, holy shit, this CLI is the best! (Never mind that software engineering is dominated by "complexity and control" types vs "simplicity and automatic" types of the wider population.)

Waterluvian
0 replies
21h59m

Sorry if I was vague! I was commenting in complete agreement with you.

skydhash
0 replies
13h51m

They’re trying to get a task done. They don’t want to maintain or talk with the computer.

Computers are complex things. Sometimes, things broke and you just can't do the task. But for a knowledgeable person, you just "pop the hood", fix the problem, and then get things done. On My iPad when the Files app freeze, there's nothing to be done other than reboot to get it working again. On Linux, I could pkill a software, restart it in debug mode or go find the logs to know what's wrong. Yes, there's a difference of mindset. But I prefer the "hood" to be there instead of having it be an opaque box.

If you want to get a task done, learn the software that can do it, externalize everything else (IT support). But sometimes, that software is the terminal or it's where the software is.

kragen
9 replies
19h12m

if you have a problem with gnu/linux (as opposed to android) you can usually find the solution on stack overflow, server fault, or superuser, but the solution you find there is going to be a textual command line, not a gui. gpt-4 can tell you how to solve the problem, but only using a textual command line, not a gui. text is the most powerful, useful, effective communication technology ever, period. always bet on text: https://graydon2.dreamwidth.org/193447.html

https://news.ycombinator.com/item?id=40909185 documents that this is actually also true for microsoft windows

on the other hand, 'always bet on text' doesn't mean 'always bet on editing your command line with inconsistent control-character commands in a mode where clicking with the mouse doesn't do anything'

Workaccount2
7 replies
17h39m

But that is passionately what I hate about it.

In GUI environments there are check boxes, buttons, menus and english labels for everything.

With linux it's like you are copying down a sacred language and presenting it at the alter with your fingers crossed. You just changed something. Didn't fix the problem. But the change still happened. Can you undo it? Probably not without way more digging. So now you just cross another set of fingers hoping you didn't break it more, or break something else in the future.

Compare to windows:

I checked this box that says "disable firewall". Then hit "Apply".

That did not fix my problem.

I unchecked the box that says "disable firewall". Then hit "Apply".

skydhash
3 replies
15h3m

The usual solution is to read the manual. The CLI is not an esoteric language. Software does complex things and you can either go with the GUI-fiction which...does things. Or have every options available to do what the software can do. Take find where the first line is the manual is: find - search for files in a directory hierarchy. Think however you want to find files inside a specific directory and find can do it for you and more. Most users will only have a few use cases for finding and that's what most GUI file explorers offer, but when you need that extra power, it's available to you.

The solution for your problem is to not do stuff you don't understand. And for the above use case, there's usually a GUI for it. The CLI stuff heavily assume that you know what you're doing.

kragen
2 replies
14h57m

the cli is just as much of a fiction, just fiction with a different focus

i agree that reading the manual is helpful, but doing stuff you don't understand is necessary to come to understand it, so i don't think it's good advice to avoid it. using the cli for simple things builds the skills you can use for more complex things. the same is true of a gui

(of course there are clis and guis incapable of doing complex things, and those are kind of a dead end)

skydhash
1 replies
14h30m

but doing stuff you don't understand is necessary to come to understand it

Only if you're doing an experiment and can constrain accidents. Any other type of activities would require to read the manual first. They're terse because they're supposed to be a reference, but you can usually find books that ease the way in. And then there's the domain expertise that is required. You need networking knowledge to interact with software like ip, operating system knowledge to understand what top is showing to you, etc. You can't get around that.

The GUI is a fixed canvas already painted by someone else, the CLI let you write your own poetry.

kragen
0 replies
14h17m

as i said in my other comment at https://news.ycombinator.com/item?id=40912296, text really helps a lot with constraining accidents

obtaining networking and operating systems knowledge includes as an essential part using software like ip and top (though try htop instead). it's not a strict sequencing but a back-and-forth interplay, synergistic with factors like study and mentorship

as for poetry, there are plenty of clis that aren't very expressive—rt-11, cp/m, grub, ms-dos, and mpv come to mind—and plenty of guis that are very expressive, such as godot, blender, inkscape, labview, solidworks, freecad, and sieuferd. you can write your own poetry as easily in godot as in bash

kragen
2 replies
15h2m

what would be ideal from my point of view for check boxes, dropdowns, and labels would be if they were a simultaneous alternative view of a command line, or rather a configuration line. an additional simultaneous view would provide a live preview of the result of that line. but you could still type and copy and paste the text

interestingly this is not too far from my usual experience with the command line. i want to compile a target, so i type `make ` and hit tab twice. i see a list of targets and pick one by typing a letter or three and tab, and hit enter. the compiler errors out right away with a c99 construct, so i add `-k` to the command line (^p spc - k ret) to see how widespread the carnage is. it's everywhere, so i add a compiler flag to the options and try again. and in 30 seconds i have a working build. or maybe i need to use a different compiler, or something, but it's easy to return to the fresh unpacked tarball or git checkout

this is close to the opposite extreme from what you describe in

You just changed something. Didn't fix the problem. But the change still happened. Can you undo it? Probably not without way more digging.

i very rarely do anything in text mode that is in any way hard to undo. shell commands are mostly purely ephemeral: their only effect is some text on your screen, an entry in your history file, and maybe an output file. if i want to change one, i hit ^p and change it before hitting enter. as for configuration changes, i would say that change management is actually the major strength of the text approach: you can copy configuration lines into your notes, comment out old versions in case you want to go back to them, check the whole configuration into git, diff it to see what all has changed, etc. everything can be undone in exactly the same way. everything is a controlled experiment, with the computer itself recording the configuration of each trial automatically and implicitly

admittedly there are occasional exceptions, like when you're reconfiguring the firewall or upgrading debian to a new release. though current configuration-as-code systems like docker and ansible go a long way to making all that stuff just as recoverable. the server went catatonic? too bad, revert the firewall rule change and reinstall it, and 45 seconds later the problem is fixed

by contrast, it's almost never obvious how to undo clicking on a command button or a menu item. even a dropdown selection is hard to undo: you have to remember what was previously selected

but yeah having to read the manual and slowly piece together a working command or configuration file is definitely worse than having every option documented in the place where you choose it

skydhash
0 replies
14h14m

but yeah having to read the manual and slowly piece together a working command or configuration file is definitely worse than having every option documented in the place where you choose it

That's where domain knowledge comes in. If you don't know anything about networking other than selecting the WiFi network and entering the password, you're going to have a hard time interacting with ip. If you don't know anything about codecs, ffmpeg will seem esoteric.

More often than not, in MacOS and the like, the GUI is reliable and there will be apps for not so common stuff. In Linux, the software (however complex) has already been written in CLI mode and works fine. Someone could do XLD or iTunes, but they're already happy with their ffmpeg scripts, and their MPD setups.

And the key to get there is to usually get a book about Linux at first, then learn about the software you are using.

Workaccount2
0 replies
13h22m

Trust me man, I know a few Concorde pilots and they sit in that cockpit and flip switches and the spin the controls such that the plane will glide like butter through a hurricane - while myself here is practically crash landing at every stop.

There is the chronic issue with skilled linux users where they keep flexing how good the terminal is (and lets be honest: flexing their fluidity and dexterity with it too) while completely missing the forest for the trees. The terminal sucks because it is difficult to use with an arduous learning curve.

There is a reason why Android, the most successful linux "distro" to the point at the summation of others is a rounding error, has no user terminal and a robust GUI. People don't even know it's linux. Thats what we need; an opensource linux distro that people don't even know is linux.

hiccuphippo
0 replies
17h49m

It also allows you to copypaste the solution, as opposed to following directions for a GUI settings window.

nine_k
6 replies
23h7m

Linux the kernel + some userland without terminal is used by majority of people in the form of Android and Chromebooks.

A terminal is a developer and sysadmin tool. It just so happens that most users of desktop GNU/Linux are developers and sysadmins. They are a few percent of population.

Workaccount2
5 replies
20h0m

Linux the kernel + some userland without terminal is used by majority of people in the form of Android and Chromebooks.

Exactly, so why hasn't the open source community driving free distros taken note of this?

Now more than ever, people want out of Windows, but the only they step into the seat of exit craft and see the above cockpit.

nine_k
4 replies
19h35m

free distros taken note of this?

Gnome tries hard to emulate Apple's approach. Results are mixed, but I've seen fans of it.

Elementary OS goes in the "normal users" direction, too.

OTOH if something goes badly wrong, and you do need to open the hood and follow an arcane tech support recipe, you open a command line, be it Linux. macOS, or Windows. (Not Android or iOS though, where you do a reset + restore dance.)

people want out of Windows

Yes, here's where they meet Steam Deck, that did take note, and just puts you into a cared-for gaming environment. It can also run a typical desktop. The hardware is proprietary, but the software is (mostly / completely?) free.

card_zero
3 replies
18h30m

you open a command line

Except Classic Mac OS never had this. You'd sometimes need to do arcane rituals like "re-bless the system folder", but they were entirely GUI-based arcane rituals that involved double-clicking icons, opening and closing windows, and dragging files in and out of folders.

nine_k
1 replies
18h23m

There was no other, simpler interface. And the whole system was much simpler (and less capable). The graphical hardware was way simpler and fully in-house, unlike the current GPUs that are third-party and evolve quickly.

card_zero
0 replies
18h1m

Exactly, there was no other, complicated interface. Except in 1991-1995 when System 6 was going to merge with AIX and be A/UX and Apple was going to merge with IBM and it was all briefly very weird.

skydhash
0 replies
15h20m

Except Classic Mac OS never had this.

Text interfaces: streams of discrete objects (characters) with some having special purposes

GUI: A matrix of pixels + a set of of rectangles with special properties attached.

If you want to quickly write a program, text is the way to go. Most developers are scratching their own itch and already know the system. They may surface a few GUI settings (if it's GUI), but no one wants to build a complete GUI ecosystem on top of Linux (unless you go fo a restricted version like ChromeOS or Android).

And with scripts, you can quickly write your own software by using existing ones. It can be your very special computing world.

Mordisquitos
5 replies
22h37m

If the only Linux distributions were in the style of LFS, Gentoo and Arch* you would have a point, but as long as Ubuntu, Mint, OpenSUSE, Fedora, Manjaro and the myriad other user-friendly exist I fail to see the argument.

Yes, Ubuntu has a Concorde cockpit behind the scenes and yes, I can access it on my Ubuntu work* laptop and I am grateful that I have that choice. I would hate not having that level of control.

Meanwhile, my mother's laptop is also Ubuntu and my girlfriend's is Manjaro, and they are both perfectly happy "flying their drones around" without ever setting foot in the Concorde cockpit.

(*) I use Arch btw

Workaccount2
4 replies
20h3m

I have used ubuntu for 2 years now, and its the motivation for the post.

Ubuntu (or really any distro I am aware of) is great for pensioners (email readers) and power users (career linux user), with a protracted and hellishly complicated experience in between (technologically adept, but lifelong windows user).

True, if you just want to fly straight to one of the most popular cities, you can just enter it in the autopilot and it will go there. But if you want to go anywhere or do anything else, you better be good a googling and understanding "how to fly a Concorde".

skydhash
3 replies
15h38m

A better way is to get a book about linux administration (if you want an in-depth manual) or "How Linux Works" by Brian Ward. Then learn bash.

Windows is pretty much all GUI (I've left before getting used to Powershell) and that works great until you want to do rules-based changes or do profiles (without using MDM) with changes snapshot.

Most software have good manuals so once you've got a bit used to the linux's way, it's quite easy to adjust anything you need. And after a while, you find you're mostly using a few handful packages and you'd have their configuration saved in your dotfiles. As for packages suggestions, that's what distros are there for.

Linux is all about reading.

Workaccount2
2 replies
13h48m

Trust me, I understand that Linux is all about reading.

I also understand that it is perpetually irrelevant in the consumer computer space, despite everyone in that space absolutely hating the dominate OS. A hate that you can watch grow in virtually real time on any social platform. But that hate is focused on pushing the giant back in-line, not at abandoning that giant for fresh pastures. You know why?

Because 30 years ago, someone who touched grass realized that consumers cannot, let me repeat: cannot, use an OS that is "all about reading".

skydhash
0 replies
5h19m

Most consumers want appliances, aka a collection of software pre configured with a few customization options. When the current solutions (ipad, phone, MacBook, PC) fit, it’s great. And the current linux desktop distros are doing great in that regard, except on two points. They do not come pre-installed (with hardware support) and some software don’t support linux.

But as soon as you want something custom and do your own configuration, the manuals are required. Or you get someone to do it for you.

ddingus
0 replies
5h18m

Truth, but!

The middle hellish experience being described here is not a bad thing.

Fact is, Ubuntu used as autopilot is pretty great! It is way better than it used to be. Mere mortals can jump on a computer and often get the few things they want done.

What I do with users of that type, and myself depending on my moods and motivations for a particular machine, is treat it like Android.

Find the users an app they can click on and or tell them it is not going to happen.

Many will be happy with that.

The ones who are not need help.

Either they grow and become readers, and can pilot the computer properly, or they won't and helping them makes as much sense as their own efforts do.

kazinator
0 replies
19h22m

However, GNU/Linux's better terminal experience compared to Unix could be part of the reason why it wiped the floor with Unix.

When you log into a BSD box, it's like taking a time machine back to the 1980s.

jwrallie
0 replies
17h48m

When things work fine, then the average person does not need a terminal.

When you do have to fix something, you need a terminal. On Windows you need to touch the registry or worse. Try attaching a debugger to figure out the reason of a blue screen and tell me how user friendly it is.

Finding and changing a cryptic file to fix an issue is troublesome, but if the alternative is "just works" well... you cannot blame the terminal in that case, but the problems that are showing up.

bitwize
0 replies
20h16m

What's condemning Linux to negligible market share is lack of preinstalls. Virtually no one used Windows, either, until Microsoft did everything short of coercing OEMs to bundle and preinstall it during the 3.x era.

a1o
0 replies
22h43m

I must be doing something wrong because I can just use Home to go to the beginning of the line and End to go to the end and I am pretty sure all the things that are easy to type as just as easy to type be in Gnome Terminal on Ubuntu or Windows Terminal on Windows.

The only place I need to know a bunch of weird shortcuts to figure things out is in the macOS terminal where everything is the less intuitive as possible.

asciimov
12 replies
23h43m

In bash, if you set $EDITOR to your favorite text editor, you can send the current line to $EDITOR with ctrl-x ctrl-e. After editing the command you can save and exit for the command to execute.

oalders
6 replies
19h46m

Or even just bind it to ctrl-e in bash:

bind '\C-e: edit-and-execute-command'

kragen
5 replies
19h17m

that sounds horrific. every time you tried to go to the end of the line you'd get interrupted by launching an editor!

dgfitz
3 replies
19h2m

I always just use the home and end buttons for that kind of thing.

kragen
2 replies
18h42m

i don't even know where they are without looking at the keyboard. then when i try to press them half the time i accidentally press insert or print-screen instead

aendruk
1 replies
18h5m

When I have this problem I remap the key I needed to a location that does work for me.

kragen
0 replies
17h50m

now you have two problems

oalders
0 replies
18h38m

I have `set -o vi` so, `esc` and `$` takes me to the end of the line. `ctrl-e` is unused for me unless I bind it to something I think is useful.

drowsspa
0 replies
16h52m

I love these shortcuts but sadly I never remember them when I do need them

cyberpunk
0 replies
23h27m

You can also just press 'v' if you're using vi mode in ksh like hardened old unixbeards like me :}

abound
0 replies
22h11m

And for the fish folk, it's Alt-e

1vuio0pswjnm7
0 replies
15h11m

fc builtin does the same thing. No ctrl-key sequences required.

Just type "fc"

With previous commands, one can also specify a particular editor instead of default $EDITOR

For example, to edit the previous command with ed when EDITOR=vi

  fc -e ed
A quick way to make shell scripts from command line history in vi mode (where 15th entry in history is the desired command line):

  fc 15
  w1.sh
  %d
  wq

eviks
11 replies
23h11m

took me maybe 15 years of using the terminal every single day to get used to using Ctrl+A to go to the beginning of the line (or Ctrl+E for the end).

And the curse of bad defaults strikes again (daily).

After the realization that this is a weird default you don't train yourself for 15 years, but change it to your comfortable/common keybinds!

jorams
6 replies
22h48m

I wonder what terminal that is, because the Home and End keys, which I'm pretty sure are the expected alternatives, work fine in every terminal for me on Linux.

cellularmitosis
3 replies
19h4m

I feel like you're being willfully obtuse here. I can't remember the last time I used a laptop which had Home / End keys.

Edit: actually I do remember -- it was an HP ProBook from 2011.

userbinator
0 replies
14h58m

I can't remember the last time I used a laptop without Home/End keys.

Among them are a Dell from 2002, an IBM from 2006, another Dell from 2018, and a Lenovo from 2019.

...and here's one from 2024 that still does: https://www.storagereview.com/wp-content/uploads/2024/04/Sto...

jorams
0 replies
11h22m

For the complaint to make any sense in the first place there needs to be an expected alternative way to go back to the beginning and end of a line. Otherwise it would be "it took me maybe 15 years to get used to being able to go to the beginning or end of a line in one keystroke". The two such options I'm aware of are Home/End (on macbooks I believe that is Fn+arrow keys) and Ctrl-a/Ctrl-e.

What alternative key combinations do you expect to work for the purpose?

arp242
0 replies
12h51m

Almost every (Windows) laptop has them, although they do all use their own unique (IMHO often awkward) layout.

jmb99
0 replies
19h0m

There are many keyboards without home and end keys.

a1o
0 replies
22h37m

I have the same experience.

skydhash
0 replies
14h55m

Remaps Capslock to Ctrl and it will make a lot of sense. Other heavily used shortcuts are Alt+d, Alt+Backspace, and Alt+Left|Right.

nine_k
0 replies
21h38m

These defaults are not bad if you use Emacs :) Or if you use macOS that (gasp) supports the very same ^A and ^E shortcuts in all edit controls.

binary132
0 replies
22h2m

If you were an Emacs user you would find this to be a good and useful default. ;)

EVa5I7bHFq9mnYK
0 replies
9h33m

I'd rather press left or right arrow keys 40 times than pollute my brain with yet another keystroke to remember.

xg15
10 replies
23h4m

First, there’s “the baseline” – what happens if a program just accepts text by calling fgets() or whatever and doing absolutely nothing else to provide a nicer experience.

[...] there are actually a few features that you get for free just from your terminal, without the program needing to do anything special at all.

The things you get for free are: [...]

- backspace

- Ctrl+W, to delete the previous word

- Ctrl+U, to delete the whole line

Linux noob here, so this may be a stupid question, but how does that work under the hood?

The documentation for fgets() says [1]:

Reads at most count - 1 characters from the given file stream and stores them in the character array pointed to by str. Parsing stops if a newline character is found (in which case str will contain that newline character) or if end-of-file occurs.

Does that mean that, by default, fgets() blocks until the user enters a newline and, before they do, it lets them edit the line buffer using the backspace, CTRL+W and CTRL+U shortcuts?

But there seems to be no guarantee that a program is using fgets() to read an entire line - it could also set count to 2 and read individual characters. Those could not be "unread" anymore when a backspace occurs. Is there some magic that lets fgets() buffer characters internally in such a situation, or would the backspace/line editing functionality just be broken then?

[1] https://en.cppreference.com/w/c/io/fgets

_kst_
1 replies
21h33m

To be clear, it's not the terminal emulator (xterm, mintty, iTerm2, etc.) that does this. It's the tty layer. You can use the stty command to change the settings.

samatman
0 replies
20h2m

Yes, quite right. I was thinking of the terminal driver and typed emulator for some reason. Good catch.

xg15
0 replies
22h50m

Ah, that's exactly the answer and makes a lot of sense. Thanks a lot.

matheusmoreira
2 replies
9h46m

Does that mean that, by default, fgets() blocks until the user enters a newline

Yes. By default, terminals operate in canonical mode. I/O does not happen at all until the user inputs a full line. Until the user hits Enter, the characters on the screen are just sitting there in the terminal's memory while the application's read system call is blocking on the terminal's file descriptor. The terminal does not write the data until the line is complete.

and, before they do, it lets them edit the line buffer using the backspace, CTRL+W and CTRL+U shortcuts?

Provided that "it" refers to the terminal, then yes. Normally it's the terminal itself which allows you to edit the line you are typing on. This is also provided by the default canonical mode. Even the fact that letters show up on the line when you type is a terminal feature called echoing. So are things like backspace, delete, Ctrl+C for SIGINT, Ctrl+D for EOF.

Line and text editors just turn off all of this stuff. They place the terminal in raw mode where everything you type is sent immediately to the application where it is handled immediately. A wide variety of everyday programs do stuff like this. For example, password prompts simply turn off echoing to hide the characters.

Even the traditional Unix line ending \n is actually a feature of terminals. To the terminal, \n just moves the cursor down one line, \r is also needed to go back to the beginning of the line. The true line ending is therefore \r\n. The terminal just happens to invisibly turn \n into \r\n. This too can be disabled.

Joker_vD
1 replies
4h15m

The terminal just happens to invisibly turn \n into \r\n.

No, it was actually done by the Unixen itself, in the part of the kernel that handled ttys: it convert '\n' to '\r\n' on writes to ttys, and '\r' to '\n' on reads from ttys. Linux only recently have moved this functionality out into the user-land layer.

matheusmoreira
0 replies
3h8m

in the part of the kernel that handled ttys

Yes, that's what I meant.

  OPOST    Enable implementation-defined output processing.
That gets set in a termios structure that gets passed to the kernel's terminal subsystem via ioctl.

https://github.com/torvalds/linux/blob/master/include/uapi/a...

https://github.com/torvalds/linux/blob/master/include/uapi/a...

https://github.com/torvalds/linux/blob/master/include/uapi/a...

https://github.com/torvalds/linux/blob/master/include/uapi/a...

Linux only recently have moved this functionality out into the user-land layer.

That's certainly news to me. Numerous functions in this file allude to OPOST processing:

https://github.com/torvalds/linux/blob/master/drivers/tty/n_...

If it's not here, where did it move to?

sweeter
1 replies
19h59m

Programs like zsh, bash, ksh, fish and most TUIs put the terminal into cooked mode so that they can manage the terminals behavior manually. In cooked mode, the terminal is not new line buffered and instead every character is read. The terminal only appears to be new line buffered but is actually being managed by the shell, which then in turn allows the devs to add nice features like manipulating the text buffer to do tab completion or prepend the line with sudo.

gnubison
0 replies
1h25m

*raw

Cooked is when the kernel handles it (cooking it before it gets to your program)

PaulDavisThe1st
0 replies
13h21m

One of the first challenges I faced as someone who got paid to program: port the VMS "help" program to SunOS (a *nix). Initial challenge: how to respond to each keystroke rather than wait for enter/return. My boss was intentionally unhelpful and forced me to figure it out more or less all by myself (remember: no web, and hardly any O'Reilly books in 1986). I remain eternally grateful for his judgement to this day.

Uehreka
10 replies
22h5m

So when I use Windows Terminal and I press Ctrl-C, it always does the right thing: If I’m selecting text I want to copy it, if I’m not selecting text I want to kill the running process.

On Linux, every Terminal app I’ve used stubbornly refuses to copy when I press Ctrl-C, demanding I press Ctrl-Shift-C. When I paste, if I forget my manners and use Ctrl-V instead of Ctrl-Shift-V, I am punished by getting a weird character when I start typing again. And I am constantly pressing Ctrl-V because of muscle memory since no other app works this way.

Is there any terminal app for Linux that does things the Windows Terminal way and won’t slap me on the wrist for Improper Teletype Usage?

ordu
3 replies
21h13m

I copy from/to terminal with middle mouse button. Just select some text and click middle button where you want to paste the text. Some people don't like it because it needs a mouse, they prefer to keep their hands on the keyboard, but I don't see any issues with it.

This way to copy/paste uses it's own Xorg buffer, so you can copy something with Ctrl-C and select something else, and then Ctrl-V will paste the first thing and middle click the second. I have issues using Windows and smartphones because I sometimes try to copy by just selecting things, forgetting to hit Ctrl-C or something. It is really annoying.

Is there any terminal app for Linux that does things the Windows Terminal way and won’t slap me on the wrist for Improper Teletype Usage?

I think not. The trouble is programs running in terminal may want to deal with Ctrl-C by themselves. Text editors for example do that, but terminals have no way to know it. Terminals even don't know what program is running now, because job control is a job of a shell.

Uehreka
2 replies
19h26m

The trouble is programs running in terminal may want to deal with Ctrl-C by themselves. Text editors for example do that, but terminals have no way to know it. Terminals even don't know what program is running now, because job control is a job of a shell.

But then why does Windows Terminal (even when running against WSL) not have this problem? The terminal doesn’t need to know what’s running inside it to know “if text is selected, intercept Ctrl-C and copy the selected text”.

ordu
1 replies
12h8m

Idk, but I can guess. In windows terminal and shell are not so separate as in Unix. For example, is cmd.exe is a terminal or a shell? I believe it is both. Probably it is the same with powershell.

jasomill
0 replies
6h2m

This is a mistake, but forgivable, as Windows executable launch behavior blurs this distinction.

Just like UNIX shells, cmd and PowerShell are ordinary console programs.

The Windows equivalent to xterm and friends — i.e., the mechanism responsible for displaying console I/O in a window — is a bit complicated, has changed over time, and only recently (Windows 10 1809 / Server 2019) adopted a UNIX-like pseudo tty / terminal emulator model.

For a good overview of Windows console architecture, past and present, see

https://devblogs.microsoft.com/commandline/windows-command-l...

FooBarWidget
2 replies
21h35m

I've always configured my terminal to copy on select. I never press ctrl-c. I mean, why would I want to select text if not to copy it?

agapon
1 replies
21h28m

E.g., to press Ctrl-(Shift)-V and replace the selection with something you copied (to the buffer / clipboard) earlier?

kragen
0 replies
18h37m

that doesn't work in terminal emulators because the terminal emulator doesn't know how to delete the selected text in whatever program drew it there (which may no longer even exist)

sureglymop
1 replies
18h39m

I think you could achieve this in Wezterm, which is configurable with lua. Not on my laptop right now but will try to get it working later. I have other keybinds that run specific lua functions.

tomtom1337
0 replies
11h42m

Please do share what you learn! I'm considering switching from mac to Linux, and wezterm is my daily driver.

cellularmitosis
0 replies
19h6m

Its funny, the thing which most keeps me on a Mac is simply the disambiguation of copy vs kill (Command-C vs Ctrl-c) in the terminal.

alganet
9 replies
20h45m

This is nice. As always, Julia's articles are always a win.

Here's some stuff that's missing:

Within shell scripts, you can use `stty` to change a lot of stuff about the terminal, including how it deals with inputs. You can rewire all of these defaults and behaviors.

Here's an experiment I did a while ago using sh and stty: https://gist.github.com/alganet/63f1dbc97b8fd35f7bb14ec30f79...

It is able to capture and understand most keyboard combinations and even mouse gestures (hold/drag/drop) from within the shell in any VT100-compatible terminal (mintty, xterm, Terminal.app, vscode, so many others).

Runnable demo:

    bash -c "$(curl -L  https://git.io/fjToH)"
Run it and press some keys or move the mouse. Use Ctrl+W to exit. It supports zsh and ksh too, but not dash or other shells lacking `read -rn1`.

---

Here's another funny thing:

    `vi | cat -v`
If you pipe an interactive program to `cat -v`, you can see which VT100 escapes that program is using. I learned a lot from how vi does it.

alganet
3 replies
20h32m

Here's a bonus:

Ever ran a command that left your terminal mangled after it finished? No output, weird chars, etc.

That's lack of proper tty hygiene on the offending command. Instead of killing your terminal, type:

    stty sane
And you'll demangle it.

anothername12
2 replies
20h29m

I think the command “reset” does something similar

foresto
0 replies
11h6m

Or `tput reset` to skip the one-second wait intended for hardware terminals.

alganet
0 replies
20h24m

You are correct! I think it does a little more (restoring cursor if hidden, etc). If you have it, it is probably better than `stty sane`

cellularmitosis
1 replies
19h16m

On Sonoma I get:

    The invoked shell does not support interactive features

alganet
0 replies
18h58m

I don't have a mac here, but you might try replacing `bash` with `zsh` to see if zsh fares better. Sonoma should have it by default.

If I remember correctly, macos bash (3.2) is 19 years old. I don't think I tested it with that version back then.

matheusmoreira
0 replies
2h28m

you can use `stty` to change a lot of stuff about the terminal, including how it deals with inputs

You can rewire all of these defaults and behaviors

I've also found this article on implementing a terminal text editor to be illuminating:

https://viewsourcecode.org/snaptoken/kilo/

https://viewsourcecode.org/snaptoken/kilo/02.enteringRawMode...

Also, just in case anyone is wondering, as I once did, where many of these magical-looking stty parameters and symbols are coming from: they are control sequences defined a long time ago. A lot of stuff is defined in ambiguous old standards from the 70s such as ECMA-48 that include such arcane terminology not seen anywhere else.

For example, jargon like Select Graphic Rendition basically refers to a 70s version of the HTML <font> tag.

  SGR<params>TextSGR<0>
  <font params>Text</font>
Where params are something like 38/2 RGB to set foreground color. The parameter 0 clears the current style.

  ESC[38;2;R;G;BmTextESC[0m
  <font color="#RGB">Text</font>

         ESC = The literal ASCII escape character
  ESC[ = CSI = Control Sequence Introducer
  m    = SGR = Select Graphic Rendition
  38         = Set foreground color
  2          = Use the RGB color space
         RGB = Color
  0          = Reset style back to defaults
Parameters come before the command. Kind of backwards.

They even had the same implementation issues we have today with browsers. Terminals were and stil are inconsistent in what they implemented and how they did it. Stuff like colors is pretty well supported but many other features aren't. For example, SGR<7> is supposed to enable "negative image" mode, whatever that is. Standard doesn't really explain. Some terminals choose to do reverse video, other terminals do other equally valid things and to this day people have problems with it.

kfrzcode
0 replies
19h47m

friendly reminder to always check before you slurp code directly to bash from the internet. this may have broke my (admittedly totally non standard) configuration in weird ways I didn't care to document.

boneitis
0 replies
14h55m

Thanks!

In maybe similar spirit, another screwy way to explore terminal IO mechanics I came up with when reading the start of Kernighan's UNIX Programming Environment:

Open up three terminal windows:

  1) `man ascii`
  2) `nc -lvp 9001 | xxd -c1`
  3) `stty raw -echo; nc -nv 127.0.0.1 9001`
With the #3 terminal active, try reproducing the whole "Hex" column of the manpage, in order. And, observing that some values have multiple ways to produce them, and also observing the multi-byte payloads of some of the other keys.

I'm not going to pretend to grasp through and through what exactly I'm accomplishing with this but will happily read any commentary.

squigz
8 replies
23h47m

It took the author 15 years to learn basic readline commands?

eequah9L
3 replies
23h29m

Yeah, I have my doubts about the claim. I forgot what I read way back when as an intro book, but I suspect it was more like a month in my case, if that. But I remember having been surprised at various points that there was an undo (C-_), and a clipboard (C-y to paste) including a history (M-y). So yeah, I guess it depends on the scope.

Maybe it's a hyperbole? Dunno, doesn't really read that way.

0cf8612b2e1e
2 replies
22h49m

How can you discover something on the terminal itself? You fall into a pattern and stick with it. It is only if you get out of band information that you can learn these tricks.

squigz
1 replies
22h36m

Bit confused by this comment. I don't think anybody suggested you're going to find these things solely by interacting with the terminal - but rather through "out of band information" as you put it, which in GP's case, as he said, was a book. The surprising part of TFA, and replies to my comment - to me anyway - is how one can go so many years without picking up that information.

0cf8612b2e1e
0 replies
22h26m

I have never read a book about improving my terminal knowledge. I have a few tricks I have picked up over time (probably through posts like this!), but never done holistic research on the subject. Therefore, despite having used the terminal for decades, I likely have a similarly long list of basic terminal knowledge gaps. I do not know what I do not know.

tobinfekkes
0 replies
23h15m

I've been using terminal for +15 years, and I just learned what this is. Because you highlighted it being crazy that someone didn't know what it was, I looked it up.

Neat! Thanks for teaching me something today. This will be helpful, especially after I spent all morning messing with crontabs and logs and permissions and PATH env's.

Edit: Having read more about this now, I'm realizing that I do use a couple of these out of habit. I just didn't know they were called "readline commands". I thought they were just "how to use the terminal". But there's dozens and dozens of other commands I never knew were possible. Brilliant. Happy Monday.

throwaway2037
0 replies
10h17m

Here is the exact quote in question:

    > This really resonated with me: even though entering some text and editing it is a very “basic” task, it took me maybe 15 years of using the terminal every single day to get used to using Ctrl+A to go to the beginning of the line (or Ctrl+E for the end).
I think your take is a bit harsh. She is quite a popular writer, and day after day, lays out her ego out for a beating by the InterWebs each time that she posts. She is never afraid to be humble. That is part of the genius of her posts. She says what so many are afraid to say publicly -- "oh this 'simple' thing is very complex" or vice versa.

epidemian
0 replies
21h34m

I've also been using Linux and the terminal ~15 years, and these things i keep forgetting and relearning every now and then. About Ctrl+A in particular, it never sticks in my memory, since i find typing the Home key to be more intuitive. Maybe the author has this same "problem".

It's funny how other programs don't seem to have this issue, and their users are able to learn new things without having to resort to an external manual. Makes one wonder about the design of everyday things!

asciimov
0 replies
23h44m

Terminal feature discovery is hard. If you don't regularly use the commands it's easy to forget they exist.

phreack
7 replies
22h29m

I think the lowest hanging fruit would be doing something (anything) to improve discovery of commands. I have great grokking abilities but terrible memorization skills, and I end up forgetting how to do what I want to do and maybe even have done before. Browsing man pages for every command is my bane. It's also why I dislike GUI with unlabelled icons, I never remember what each one does.

jryb
1 replies
20h7m

Maybe try fish? Tab completion will suggest subcommands, and if you type - or -- and hit tab, it will suggest the available options with help text generated from man pages (example: https://flaviocopes.com/images/fish-shell/autocomplete.png). Doesn't really help with positional arguments but it's definitely enhanced the discoverability of many tools for me.

phreack
0 replies
10h54m

This is by far the best practical option! Life could be even better, but out of all options this one's great.

vmladenov
0 replies
18h50m

fzf replacing my default ^R has been a godsend to me for remembering how to do things in the shell.

https://github.com/junegunn/fzf

skydhash
0 replies
14h52m

A note file with the commands written would be your best bet. Then bring the most common ones in your shell as aliases or functions.

shadowgovt
0 replies
22h21m

At this point Google has basically taken over that function... "How do I _ on the command line?" more often than not gives one some starting point to develop from.

bongodongobob
0 replies
20h5m

GPT is great at this. I wrote a little program that I can call from a shell. Bashai.py show me a bash one liner that does x. It then shows me the command and asks if I want to run it with or without root. Simple, yet one of the best tools I've ever made for myself.

shadowgovt
6 replies
22h22m

license reasons, if the program’s license is not GPL-compatible – readline is GPL-licensed, not LGPL

The older I get, the less patient I become with finding out some user experience sucks because of GPL / non-GPL knife fights.

It's been thirty-nine years now. I think the GPL was useful at its origin, but now the benefits of open-source are proven out, the world is deeply interconnected via the Internet, and it's a hindrance to have some code burden other code with requirements. I, for one, don't expect to write any further GPL code in my lifetime. I'd rather code be maximally unencumbered from interoperation.

mxuribe
3 replies
21h43m

@shadowgovt Genuine question: if i wanted to create new software nowadays, and i wished for it to be as you noted "mmaximally unencumbered from interoperation", which license should i choose for my software? Which license would you use? Again, not trying to be snarky; just wanting to learn and understand. :-)

shadowgovt
2 replies
17h16m

I generally use the ISC license these days. It is short, indemnifies me from damage caused by the software I write being used by other people, has a thin requirement that the copyright be carried forward into other projects using my code (A requirement that I'm probably not going to enforce), And that's it. No encumbrances against interoperation with other people's code.

mxuribe
1 replies
15h55m

Today I learned! I hadn't heard of the ISC license. I've heard of GPL, Apache, MIT, and other common ones, but not USC until now. Thanks!

shadowgovt
0 replies
7h52m

The ISC is basically pretty similar to the MIT license.

throwaway2037
1 replies
10h23m

No, the GPL license for GNU Readline is very intentional. There is a bunch of written history from Richard Stallman about it. He felt it provided such an large advantage, that some programs might switch to GPL to use GNU Readline. After 35 years of development (started in 1989 according to Wiki), it has a hefty start is someone wants to beat it with a "clean room" BSD-licensed edition.

Some HN info about Stallman's reasoning: https://news.ycombinator.com/item?id=26606328

I cannot find any specific writing from him, but I am sure I read words from him about 25 years ago.

    > I'd rather code be maximally unencumbered from interoperation.
Yes, the problem is that commercial organizations would like open source to do all the hard work for them. Then, they use the software internally, and don't give anything back -- except two pence via RedHat licensing. (We have learned this the hard way in the last 10 years of major security bugs due to underfunded projects.) However, you are free to re-implement the API and license it in a different way.

shadowgovt
0 replies
7h53m

Yes, I think we are in agreement. The GPL in this era is a wrench in the process of useful code. You have brought to my attention how intentional that was.

Rms did something impressive but he doesn't impress me in this day and age. Many revolutionaries make for poor governors; in my personal opinion the software ecosystem would be best served by cutting around him these days.

colmmacc
6 replies
18h46m

Over 20 years ago now I wrote a state machine around readline that meant you could use it as a multi-line editor. Not "multi-line" as in a single line can wrap, but a true editor that lets you move up and down, but is windowless.

Here's a video:

    https://github.com/colmmacc/jot/raw/master/jot-demo.mp4
and the CVS repository for the Unix terminal IM client it is part of is at:

    https://c-hey.redbrick.dcu.ie/src/c-hey_cvs_latest/
It tracks and redraws your cursor when you move up and down between lines, and also pays attention to SIGWINCH to redraw things when the terminal size changes. I've never had the time to rewrite it in Rust, but I'd like to and then release it as a small library.

It's always surprised me that nobody else has done this.

marttt
0 replies
8h50m

Thanks for the screencast. Another +1 for bringing it back to life!

jxy
0 replies
15h34m

Yeah. That's how rio's text windows [0] look like in hold mode, except that it has a much simpler design and better support of mouse.

[0] https://p9f.org/magic/man2html/1/rio

atiedebee
0 replies
10h32m

Oh, that looks really cool! Is the current iteration of the program stable?

Willish42
0 replies
17h49m

This was fascinating!! Please do consider bringing it back to life as a library and sharing with HN.

I had no idea how much better such an editing experience is until your video, and completely agree about the benefit of not having to context-switch a la git commit "interactive mode". The "inline typewriter" effect is also really cool

Pr0ject217
0 replies
16h53m

Checked out the video. Looks cool!

JNRowe
0 replies
36m

That's pretty cool, gonna steal the idea.

I can implement that specific case with a couple of lines in zsh. Something like:

    autoload -Uz zed
    icommit() {
      () {
        zed $1
        git commit -F $1  # -a too, if you must ;)
      } =(:)  # Or maybe even =(< commit_template.txt)
    }
Then icommit, via zed¹, will initiate an inline editor with all the power of ZLE available. Hit C-x C-w to write and commit, or C-c to abort. Obviously, you'd want some error checking and the like².

Beauty of this basic implementation is that the keymap is fully controllable in zed as it is simply a new ZLE widget. It works with emacs or vi mode out of the box, and is fully customisable beyond that.

You could also make the interface generic by writing your own ZLE widget, so that it can be called directly from within the line editor and remove the need for wrapping commands like I did above.

¹ https://github.com/zsh-users/zsh/blob/master/Functions/Misc/...

² This at least uses, and cleans up, a temp file to handle the commit message so it isn't completely useless.

I_complete_me
6 replies
22h50m

I have great respect for Julia Evans and love her contributions that get shown here.

But...

"I’ve always thought that vi mode seems really cool, but for some reason even though I’m a vim user I didn’t really like using it when I tried it."

Really, that seems weird to me.

I use zsh (btw) and the problem she describes is a non-issue. And I am not a pro. (Sorry, Julia).

sevg
4 replies
14h55m

I have to agree with the other commenter (drewg123). Been a Vim user for decades but don't use Vi-mode in the terminal.

the problem she describes is a non-issue. And I am not a pro.

Not sure what you're saying here. Julia didn't describe a problem but a preference ("I didn’t really like using it"). I'm not sure how you can you call someone's preference a non-issue. It's a preference and we're allowed to have those last I checked! :p

I_complete_me
3 replies
9h33m

"even though entering some text and editing it is a very “basic” task, it took me maybe 15 years of using the terminal every single day to get used to using Ctrl+A to go to the beginning of the line (or Ctrl+E for the end)."

This sounded to me like she was describing a problem. My bad.

And I too am allowed express opinions, no?

sevg
2 replies
9h16m

In your first comment, you said it "seems weird" that Julia doesn't like Vi-mode.

In this comment, you quote Julia talking about Emacs-mode. Which doesn't really follow on from your first comment.

I_complete_me
1 replies
7h34m

Thanks. I appreciate your civility.

The lack of clarity is my fault.

I felt Julia was describing a problem that she was having for 15 years to do with editing on the CLI. Then she said "even though I’m a vim user I didn’t really like using it when I tried it."

To me, even still, it seems weird that there is a tool (vi-mode) that solves the problem she seemed to be describing earlier on. I am not denying that she "didn’t really like using it when I tried it".

Not sure that even with this reply I have cleared up my earlier confusion-causing comment. I shall endeavour to refrain from further nonsense in the future.

sevg
0 replies
6h15m

Ah, this reply does indeed make it clearer what you were saying :)

Whether I agree with what you were saying is a different matter (:p) but at least it makes more sense now!

drewg123
0 replies
20h46m

I don't find that strange at all (prefering emacs to vi mode). I feel the same way.

I use tcsh, and have it configured for emacs-style command line editing. I use emacs for complex stuff (coding) and vi for simple stuff (editing a config file), so I'm comfy with both.

I think my issue is that it seems slightly unnatural to remember the mode I'm in on a random terminal command line, and much easier to just use the emacs keys to edit when needed.

kragen
4 replies
19h8m

the top three default readline keybindings that would improve people's lives if they knew about them:

- control-w, which julia mentions in the post, to delete the last word

- control-o: when you're recalling a line from history, edited or no, runs the line and recalls the following line from history. so you can run a sequence of five commands from history by navigating to the first one and hitting control-o five times

- control-r: search backwards in time through your history as you type a search string. control-r again jumps to the previous hit, control-s goes back forward in time. hitting enter or control-o executes it

foresto
1 replies
10h34m

I've always wondered why control-s was chosen for this, given the obvious conflict with XOFF (pause), which in my experience is the default almost everywhere. One would have to (a) know why it wasn't working and (b) be willing to disable XOFF, in order to use that key combination for the forward history feature.

kragen
0 replies
6h21m

nowadays it is usually not the default anymore, since tcp connections and unix pipes have other ways to avoid overflowing their buffers. the history is that that keybinding originated on its. as i understand it, its also had another flow control protocol to avoid overflowing serial terminal buffers, the moral equivalent of the enq/ack scheme, which doesn't depend on hard real-time responsiveness to work reliably. (but it wasn't just literally ^e and ^f since emacs uses those even more than ^s.)

initially to get emacs running on unix systems you had to do a lot more than just stty -ixon -ixoff; you had to upgrade your host's ram and convince the other users that an editor was a reasonable use of such a large amount of resources. by comparison, adding a couple of extra wires to the modem cable to support rts/cts flow control (which was more reliable anyway) was no big deal

but yeah, it was a big pain for about 15 years, from 01990 to 02005. it still bites me occasionally when i accidentally type ^a^f in screen and accidentally enable xoff!

dgfitz
1 replies
19h3m

Oh I always do ctrl+shift+r for that last bit, like reverse-tabbing on a gui. Good to know about ctrl+s, though I imagine muscle memory will prevent me for ever using it. :)

kragen
0 replies
17h53m

normally control-shift-r is just control-r; both key combinations send the same byte, 0x12, so they both search backwards in readline history. is your terminal emulator doing something different? if you type control-v control-shift-r enter control-d as the input to the command od -t x1a, what does it say?

kazinator
3 replies
20h1m

I've never seen dash dump escape sequences instead of acting on arrow keys. Probably, it's due to a missing or wrong TERM value?

Nowadays, programs should be hard-coded to accept ANSI sequences and ignore TERM (unless they need to make some fine-grained distinction like do we have 256 color xterm compatibility).

Those programs will never have that problem of not understanding arrow keys.

kragen
2 replies
18h29m

it's more likely because she's running a version of dash compiled without readline support, probably debian's version (which is compiled that way because it's not intended as an interactive shell, but rather the lightest-weight posix-compliant shell they could build)

i agree about ansi sequences. even that doesn't go far enough, though: we should probably be moving past character-cell terminals to something better so we can have things like proportional fonts, multiple font sizes, properly spaced borders, and rounded corners

kazinator
1 replies
16h29m

Looks like I'm wrong. If I fire up an interactive dash on Ubuntu or Debian, no arrow keys. /bin/sh is dash, but that's only for hash bang scripts.

Not just no arrow keys, but nothing. No Ctrl-P to recall previous line. No editing beyond the POSIX TTY line discipline stuff: Ctrl-W word erase, Ctrl-U line erase, backspace.

kragen
0 replies
15h48m

also i'm wrong; it doesn't have an option to compile with readline, just libedit (which indeed is not included in the debian package configuration). the incantation was as follows:

    : Downloads; apt-get source dash
    : Downloads; cd dash-0.5.12/
    : dash-0.5.12; sudo apt install libedit-dev
    : dash-0.5.12; ./configure --with-libedit
    : dash-0.5.12; make
    : dash-0.5.12; src/dash -E
libedit supports ^r but not ^o

on the other hand my dash process with libedit is 1.3 megs rss while my bash process is 7 megs rss. and the dash executable is only 130k. still, bash is only about 20% slower to start up

hawski
3 replies
23h36m

I plan to make one day an alternative to terminals. My idea is not fully fleshed out, but I would like to try to forgo TTYs altogether. Use only pipes, file descriptors and job control.

The closest thing I saw to what I have in mind is this: https://github.com/letoram/cat9/ but more in a way of interface.

nine_k
0 replies
21h34m

Are you talking about terminals, or about shells?

I suppose the latter. Have you checked Oilshell, Elvish, or PowerShell (yes, on Windows)?

hnlmorg
0 replies
23h12m

I’m working on a similar vision. Except instead of replacing the terminal, I’m turning it into a more of an ergonomic interface for structured data and multimedia.

I’m open to discussing thoughts on this.

cxr
0 replies
21h49m

One thing to start with is to not throw the user into a screen consisting of a grid of fixed width character cells at the very beginning. This is what immediately sends a signal of discomfort to most users not already familiar with terminal emulators. There's no real reason why the default experience of having a dialog with your system installation couldn't take place within an interface that resembles iMessage or ChatGPT or something like Quicksilver. Things like /bin/rm certainly don't care whether they're being invoked from a terminal emulator that has the conventional look or whether it's in a chat-like interface—it doesn't rely on any line drawing characters or output alignment. Even the Python REPL doesn't depend on that sort of thing a great deal, except for stuff like ASCII art arrows pointing to syntax errors. Only when you want to use stuff like vi or ps and ls helpfully trying to put things into columns will you start running into trouble if your terminal emulator has an non-traditional UI. This can be ameliorated to some degree with heuristics to detect e.g. spaces being used for alignment and cursor positioning escape sequences in the output stream.

1vuio0pswjnm7
3 replies
20h17m

"The other day I asked what folks on Mastodon find confusing about working in the terminal, and one thing that stood out to me was "editing a command you already typed in".

This really resonated with me: even though entering some text and editing it is a very "basic" task, it took me maybe 15 years of using the terminal every single day to get used to using Ctrl+A to go to the beginning of the line (or Ctrl+E for the end)."

Only took me a year or so to get used to using "v" in vi mode and fc. I am not a "developer" but I prefer textmode command line to GUI. I do not use X11/Wayland/etc.

I learned sh on NetBSD which I still think is one of the best shells available. It's fast. vi mode is the default. People may disagree but I think for editing single a line of text, i.e., a "command", vi mode offers more precision. For example, being able to jump directly to a particular column number.

https://web.archive.org/web/20240528201424if_/https://pubs.o...

   #list previous commands
   fc -l 
   #edit 5th command on the list
   fc 5 
IMO, as a dumb computer user who is not a "developer", this is not complicated. I think terminal emulators are complicated, though. I do not use them.

I believe fc came to POSIX from ksh.

For me, it is not that UNIX is objectively good. It is that the available alternatives are still comparatively bad.

kragen
0 replies
18h32m

yes, fc is from ksh

going to a particular column number is not useful to me because my commands are not on punched cards with column numbers printed on them. going to a particular piece of text is, and ^r or ^s gets me there with readline (in vi mode or emacs mode). i don't want to mentally count how many characters are on the line before the place i want to go; i have a computer to do that for me

vi movement by words is useful though, and slightly easier than emacs alt-f and alt-b

imp0cat
0 replies
11h34m

editing a command you already typed in

It's been mentioned here before, but you should suggest the Ctrl + X, Ctrl + E combo - they can edit the command in their favourite text editor and then it gets executed when they exit the editor.

1vuio0pswjnm7
0 replies
11h1m

tcsh has a (maybe) unique command line editing feature: transpose characters.

Ctrl-T

It's vi mode is not as good as libedit's (IMHO) yet each shares the same author/maintainer.

Though it's no longer the default, I believe tcsh may still be included with MacOS.

glial
2 replies
1d

Nice to see this writeup. Entering text into the terminal, and copying output out, is a huge barrier to entry for beginners. Windows terminals in particular feel downright antagonistic to use.

glial
0 replies
22h35m

I haven't used the new one! Will check it out, thanks.

vrnmh
1 replies
22h48m

Another neat trick is to use ctrl-x ctrl-e, this gets the command in a vim buffer (default editor for me). Edit the command and then :wq to reflect the changes

shmerl
0 replies
18h51m

That's neat!

thestoicattack
1 replies
23h20m

the readline keybindings come from Emacs

Because I’m a vim user, It took me a very long time to understand where these keybindings come from

libreadline supports a basic vi mode. In bash, `set -o vi` lets you use vim-style editing. It is a lifesaver.

nightpool
0 replies
23h5m

Already addressed in the article

jFriedensreich
1 replies
22h29m

warp and and some powershell version were the only “terminals” i used that seemed fixing the input line, but also did not quite feel right. the worst parts of terminals for me are that input line does not behave like a normal text field with mouse click, select and everything a user would expect in another context, that history mostly scrolls on a line basis instead of smooth pixel scrolling like any other document (don’t get me started on pagers, i still don't manage to disable man pages opening in some archaic mode that takes 3 tries to even exit from git), commands that default to tuis or clearing the screen. i tried to avoid unix as long as possible because of this and the absurd random / hostile folder names + layout but just because *nixes won does that mean we have to keep these archaic absurdities alive? why does even something where innovation would be simple like the vscode terminal feel like that and not like the chrome console with a normal text input line with graphic autocomplete and mostly immutable command response history with collapse/expandable sections? even unix commands that would not work in this mode could just run in something like an inline widget or new tab where they could read input lines by character or whatever weird behavior they expect.

Asooka
0 replies
11h43m

Ideally we'd have the equivalent of an ipython notebook for the terminal. But GUI on Unix is still an unsolved question with more and more incompatible implementations being written daily, so I'm not holding my breath. After using Linux for over 20 years now, I've concluded that if you want a desktop OS, use Windows. If you use Linux, learn to live in the terminal - it's the only consistently working piece of the OS, everything else is consistently broken.

inickt
1 replies
21h16m

Likely an unpopular take, but I switched to the "Natural text editing" preset in iTerm2 to get editing shortcuts that match the traditional macOS ones. It has the advantage of just remapping to the normal control sequences inside terminal apps, so you basically get this functionality everywhere without needed to change it in multiple places/worry about readline support/etc. It isn't perfect (I have rarely needed to enter sequences manually that then are remapped), but I find I have used way more command editing since its part of my muscle memory.

https://pliszko.com/blog/post/2021-10-31-natural-text-editin...

thiht
0 replies
8h54m

Came here to say this, it's one of the first things I configure when I install iTerm.

Being able to naturally use cmd+arrows, opt+arrows, cmd+del or opt+del is invaluable to me. I don't want text editing in my terminal to be special.

emmelaich
0 replies
16h25m

From which, plan9/sam/acme got it's inspiration afaik.

The downside is being required to use the mouse often plus some dexterity.

willlma
0 replies
5h7m

I switched my Mac terminal to Warp.dev simply for the default mac text input. I can ⌥ and ⌘ left and right to select words or until the end of the line ⌘A to select all. It comes with so many other bells and whistles that I've mostly ignored for this simple convenience. I don't use emacs (or vim) keybindings in any other context and I'm not sure why the terminal forces you to.

pama
0 replies
4h55m

I use M-x shell and variants in Emacs for almost all of my command line work. No problems with editing, as it is always Emacs on top. For true ncurses apps there are some limitations inside vterm or ansi term but even there, I can still use elisp and fix these problems if needed.

larsbrinkhoff
0 replies
12h50m

Mode ∞: shell mode in Emacs.

kkfx
0 replies
22h58m

Also worth mention the Plan 9 "fixed prompt" where any command is at the top, with it's output underneath, there are few variants and in few cases they are comfy.

kapitanjakc
0 replies
1d

For me, Ubuntu's terminal is perfect.

Give me arrows, tab, Ctrl+(R/C/D/W) etc and its a great.

But I agree with the point that different systems have their own implementation which could lead to frustration.

I am working on set of servers only accessible through PAM and those admins don't allow anything. It gets so frustrating.

I feel a lot of the frustration also comes from shifting to unfamiliar environment. Like I work on those restricted servers and am cursing the admins, but when I switch to Ubuntu's terminal I am thanking the gods for liberation.

imp0cat
0 replies
11h27m

Rlwrap is a great utility. rlwrap telnet ... makes life so much easier.

hnlmorg
0 replies
22h40m

some things this post left out

+ wide characters

+ different keyboard modes causing the same key press to be presented by different ANSI escape sequences

+ different TTY states (eg local echo)

+ different OSs having subtly different syscalls for changing TTY states

+ differing support for terminal emulation (most these days roughly emulate xterm, but even there, none aim for 100% be compatibility)

+ a lack of a consensus on how to check for features provided by a terminal (some use ANSI escape sequences and wait for an ansi sequence to be returned from the term (that’s how the old VTs worked), some check $TERM (that’s how the first wave of terminal emulation was detected), some terms expose themselves as xterm and ignore the VT feature sequences, but set other env vars. it’s honestly a bigger mess than the user-agent string.

…and this is assuming a POSIX system. Things get doubly interesting when you throw Windows into the mix

hi_dang_
0 replies
20h20m

I thought this was going to cover RS232 implementations. Oh well, next time :-)

frankus
0 replies
23h57m

Periodic reminder that many emacs-like keybindings exist in almost every text field in macOS: Ctrl A, E, P, N, K, Y, T, and probably others I'm forgetting (start of line, end of line, previous line, next line, kill (delete everything to the end of the line and put it in a special pasteboard), yank (paste from that special pasteboard) and transpose characters).

Edit: more complete list here: https://jblevins.org/log/kbd

Edit 2: can't believe I forgot Ctrl-D, which is forward delete.

chasil
0 replies
23h41m

some programs (the dash shell, cat, nc, git commit --interactive, etc) don’t support using arrow keys at all.

The dash shell does in fact support an editing mode if compiled with libedit. Debian derivatives do not do so (likely for concerns of space). They very much should, as people who start with bash will have much to unlearn.

The POSIX standard also specifies "set -o vi" as an optional extension. Every shell claiming POSIX-compatibility must support set -o vi if the shell implements this editing mode (so ignore inputrc if it pleases you).

"[set -o] vi: Allow shell command line editing using the built-in vi editor. Enabling vi mode shall disable any other command line editing mode provided as an implementation extension."

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V...

cancerhacker
0 replies
18h31m

A meta-question for those of us very comfortable composing complex sequences on the command line: when I’m trying to help someone with something, how can I avoid becoming frustrated by their lack of facility - or worse, their lack of interest in obtaining facility, without being an ass and taking over the keyboard? Grumble.

Sparkyte
0 replies
15h26m

Or you can just write a bash script file to do shortcut executions of complicated terminal commands...

LordDragonfang
0 replies
21h47m

See also the same blog's previous article, "What happens when you press a key in your terminal?"

https://jvns.ca/blog/2022/07/20/pseudoterminals/

(It's a great article, and I'm fairly surprised the post doesn't directly link to it)

Drygord
0 replies
12h27m

I just press and hold backspace and try again from scratch