what are some problems you've run into in the terminal with entering commands at a shell prompt? (other than copy/paste issues) so far I have:

- making a mistake on a single line / multiline command and having to press the left arrow 100 times, or just press ctrl+c and start over
- autocomplete not working (but would love more specific versions of this)
- problems with history? would love examples of history problems

(not looking for solutions right now, just more problems!)

@b0rk forgetting to escape a character. Especially a cheeky & when pasting urls for curl or wget.
@iliazeus @b0rk Yeah, the & character is trouble when putting URLs into the terminal, since that's used for sending a process to the background. That hits me pretty often
@b0rk Executing a command that contains both single and double quotes
@b0rk autocomplete working, but completing file paths for programs that don't actually expect filepaths.
@allpurposemat @b0rk Or the reverse - autocomplete not expecting the delimiter used before the file/path fragment and thus refusing to complete anything.
@b0rk keeping track of the difference between local and remote shells so you don't do something like turn of eth0 on the remote device
@b0rk keeping track of long running tasks without forgetting about them or using up space on your screen
@b0rk that first one, all the time!
@b0rk write out long command, realize I had to do something else first, so I ctrl-c (without running it) type the command, but then, sadly, the long thing isn’t in history, so I have to write it all again
@cafkafk thanks, this is a great one
@cafkafk
In zsh you can do Alt+# for commenting the whole line into history. In bash you can do Ctrl+A Ctrl+K and later Ctrl+Y.
@b0rk

@b0rk accidentally hitting tab to autocomplete on an empty command line will lock up my terminal for 30 seconds before saying "I found a thousand commands, do you want to see them?" No! If I can't get an autocomplete in a couple seconds, please stop!

(This is mostly an issue on Windows bash because the thing that searches the file system is very slow.)

@sixohsix thanks this is a great one
@b0rk Accidentally apply a keymap that unmaps one or more letters on the keyboard, so that it's impossible to type a command to apply a correct keymap.
@vatine @b0rk
On one of our earliest computers, the cat had a habit of stepping on the "remap keyboard" key and then walking across some more keys. One time he re-mapped the 'remap keyboard' key and it took a while to figure out how to revert it.
@b0rk Sometimes I need to delete stuff from my history, like when I accidentally type a password on the command line, but this happens infrequently so I can never remember how to do it and have to look it up again every time. (Currently using fish shell, but this also applied in every other shell I've used in the past.)
@skyfaller @b0rk corollated to that is history is written on exit, so "missing" history in other sessions on the same host until you logout and in again
@b0rk tabbing by mistake and ending up with "helpfully" escaped strings -- e.g. backslashes in my $variables.

@hattom @b0rk Yeah, this hits me a lot, since I often use variables to shorten/simplify commands when writing and running manual procedures for software installation

I think I sometimes hit similar issues when filenames have special characters that need escaping (usually spaces or quote marks)

@b0rk Missing history when I have multiple tabs open.

Some commands I ran yesterday don't appear to be anywhere!

@preinheimer thanks, this is a great one
@b0rk Pretty small, but it bothers me that standard Mac keybindings used in code editing (such as delete back a whole word with option delete) don't work. Others (skip back / forwards a whole word) do work though, which is nice.
@b0rk
Screwing up a command name and having that stuck in my history.
@erraggy @b0rk This omg. Especially when you have a two commands, get the second one wrong and how you forever have 3 commands in your history and one is ever so slightly wrong.

@b0rk problem with history: commands are not in my history anymore (I now got an archive for that).

pasting a command that had more than one line (although it looked like a one-liner) and then having executed multiple commands.

Using single-quotes in large strings that I want single-quoted (I got a solution for this one too).

Figuring out variable expansion (filled, empty, unset).

@b0rk

Annoyances
* Tedium of combining stdout and stderr (easy)
* Redirect output and replace source (easy — cf. Sponge)
* Mixed CLI argument format disciplines (e.g., diversity of dd, find, GNU-style, subcommands, etc)
* History gets lost between sessions
* Absence of manual pages
* Diversity of ways of getting help (e.g., -h, --help, help, etc).
* Idiosyncrasies of Bourne shell language

Difficult
* Parsing and structuring unstructured input (cf. PowerShell or Elvish Shell)

Bad UX
* Screen

@b0rk Today I spent 10 minutes trying to figure out why my script's output was always starting with an empty line.

Turns out I accidentally held Alt while pressing enter, forgot, and thus my prompt included a newline by itself. And as an avid user of Ctrl-R, I kept using that same input...

@b0rk wildcard expansion when using `sudo`. e.g.: `sudo stat /tmp/*` will work, but `sudo stat /root/*` won't
@ehabkost ooh that's a really good one thanks!

@b0rk Having multiple lines of unrelated text in my clipboard, and accidentally pasting all of it in, perhaps by right-clicking. The result being that the terminal tries to run hundreds of lines of garbage.

(In Unix terminals, Ctrl+U, Crtl+K can clear the preceding and proceeding text respectively. That can help recover.)

@b0rk Forgetting to put an extra space at the beginning of a command when it includes something secret, and then having to hunt for it in various history files to remove it. (Even just knowing where those history files are.)

@b0rk Besides the mistake-on-single-line thing:
• Shell/terminal combos pretending not to understand any control characters.
• Remote sessions that don‘t let me just locally select and copy any text, because the remote terminal actually likes mice and instead comes up with a remote selection inside the remote fullscreen editor.

Yes you can configure that, but you need to do it … 😉

@b0rk working across different shells on different machines, using ^w and sometimes having it delete a word (expected) and sometimes having it delete from the cursor back to the start of line (unexpected).
@b0rk
- autocomplete not available for the (sub)command
- autocomplete giving wrong suggestions (eg. files from pwd while they aren't useful/allowed options here)
- live synced history across different terminal sessions (not the default in bash and I hate it if I have to use a shell that's configured this way (iirc armbian zsh), since I'm using different sessions for different tasks and don't want the other commands mixed in the history )
@b0rk On autocomplete... inconsistency among tools is painful. Why does tabbing to complete a filename work for some tools but not others?

@b0rk

> entering commands at a shell prompt in the terminal
> love more specific, love examples

> so far I have
> copy/paste issues
> problems with history?

Ugh. Ctrl+R searches one too far, and then Ctrl+S doesn't work, because I forgot to set up with: stty -ixon
or because something cancelled my: stty -ixon

And Ctrl+S actually meaning XOff to force you to try Ctrl+Q trips people up, I see that repeatedly

> having to press the left arrow 100 times

YES

So very much of 'set -o emacs' works, but the simple M-z zap-to-char doesn't work, despite Emacs defining it same as the Vi df of 'set -o vi'

> autocomplete not working

YES

Like the Shell feels it knows better than I do whether I want Tab to search my Sh $PATH or my Sh $PWD, and for only 'chmod +x' Files or for all Files. And it's so often way wrong

> autocomplete not working

Zsh Tab flatly refuses to try if you're in the middle of a word

Like macOS Bash asked to Tab after "byo" inside: echo ~/Public/byo/bin/vim.py
will autocomplete happy happy to: echo ~/Public/byoverbs/bin/vim.py

But Zsh fails this test. it just beeps at you

> > beeps

They all beep too eagerly, too often, too loud, too long. Sh & Emacs & Vi suffer deeply from this dis'accomodating design fault. I frequently turn on the Terminal Visual Beep & mute my laptop just to shut them up

@pelavarre @b0rk oh yes accidental ctrl-s/ctrl-q screw me up all the time, it's never never never ever what I want. I should figure out how to disable those keybinding entirely. Only problem is that I do a lot of sysadmin so any customized preferences i set are never on the host I'm working on without automounted homes or building some personal ansible plays to distribute personal settings, which also won't apply to shared accounts like root, so customizing ends up being more work than I like
@b0rk tedious repetition when issuing commands that apply to the same paths/files. E.g. grep blah ../../path/to/file.name, followed by a desire to ls -l it, and then maybe less it.
@b0rk history being different on each terminal window, because each shell process loaded it from disk at different moments, and doesn't include commands from other shell processes that are still running
@b0rk "problems with history" Does "zsh truncates my history for some reason" (no, it's not the limit, and its not time-based expiry. sometimes there's a gap between the "day before yesterday" and "three months ago", with everything before and after intact) count? Because that plagues me.

@b0rk My fix is a cronjob which copies my zsh history every hour into a different file per day-of-month/hour combo so that I can then cludge those files together to one unified and deduplicated history when it happens again.

Turns out, without my shell history, I am *lost*.

@b0rk re: history problems, the order in which you open and close terminal tabs can be quite surprising. Open tab 1, run command. Open tab 2, press up. You get a command from prior to opening tab 1. Now close tab 2, open tab 3, press up. Now you command from tab 2, after tab 1 was opened. Some people copy/paste snippets to write history into certain hooks and then all of the above extends to subshells but subshells are often even more hidden, leading no complete disarray.
@dvogel @b0rk - THIS! History does not play nice with multiple concurrent sessions.
@b0rk I remember `Ctrl+S` used to completely freeze the terminal and you had to memorize that `Ctrl+Q` would unfreeze it. I don't know if there are popular terminal emulators that still do that by default
@b0rk accidentally pasting some binary content in terminal, then suddenly the printer starts printing loads of junk

@b0rk Normally, I can bite the bullet and push → however many times I need to. But I was working with the MySQL prompt the other day, and it didn't let me go back to previous lines at all! So, my current vote is multi-line editing.

My second vote is for tab-completion of local files; sometimes a program's autocomplete decides that, maybe because I have a file ignored by git(?), I don't want to complete it… but I do! Thankfully, my shell usually autosuggests the file, but… still frustrating.

@b0rk lately: terminal emulators using the key combination that the shell has always interpreted as "move cursor forward one word" as "search". This leads to having to press arrow keys 100s of times to do a simple edit.

Worst, though: repeating a command that includes the filename twice, for different files. I can never remember how to "do again but replace all occurrences of 102 by 106".

@b0rk
I've been using Linux for years and I still have yet to figure out how the hell Ctrl+r is supposed to work
@rolenthedeep can you say a bit more? would love to hear about what goes wrong

@rolenthedeep @b0rk

From a technology point of view ctrl+r is very simple, from an UX point of view it is an absolute disaster.

When you hit ctrl+r your shell prompt gets replaced, the command stays (including your cursor in the command), but you are typing between the single quotes at the start. As you type the command gets replaced with whatever the shell considers the current best match. If you hit enter, that best match will run, if you try to move the cursor you get out of the ctrl+r mode and get to keep the most recent matching command for editing.

(reverse-i-search)`{{ you are typing the search here }}': {{ but your command+cursor is here}}

If you want ctrl+r to be useful use the fzf key-bindings (they come with the fzf package, you can load them with source /usr/share/fzf/key-bindings.bash).

Once loaded you get a query field with working cursor and multiple results, pressing enter puts the result into your shell as if manually typed so you have a chance to edit it and also doesn’t immediately execute it which provides some safety at mode switch back from search to command entering.

@slatian
@b0rk
Right, like the VERY first thing I want to do is hit up arrow to get an older match. Which is the behavior of literally every shell on every OS
@b0rk A specific history problem: When my computer restarts, it automatically reopens all my terminals with the previously displayed text. But, all their individual histories are gone, so when I try to go up a command or two, it’s random junk instead of the command I wanted. On my work laptop, IT occasionally pushes out updates that force a restart when I’m not watching, so this can be confusing the next time I log in, and then sometimes I have to reconstruct complex command line invocations.
@b0rk Niche, but: the Plan 9 terminal (and its unix port) lets you use the mouse to edit the command line like any text. That’s great (and solves your first point), but hitting enter always submits from the current insertion point. That’s sometimes what you want, but way more often i’m changing a flag/parameter and then want to submit the whole line again. I wish opt-enter (or something) would just send the whole thing.
@b0rk On more mainstream shells & terminals: i’m frequently frustrated by autocomplete triggering when I don’t want it to, typically when i’m just trying to enter a tab. I mostly really dislike the implementation of autocomplete.
@a @b0rk You can use ctrl-e before enter (but it's still annoying to go through extra effort for the more common case..)
@b0rk Regarding history, not everything gets saved in a way one might expect if you are simultaneously working on a machine using multiple ssh sessions.

@b0rk if you begin to type a comand, but you need to run a comand bevor that, so you Ctrl+c the first command and end up writing the first one two times. Not really a problem but really annoying.

And for the auto complete issue: cmds that you can't run with your permissions won't be autocompletet (typing the cmd first and then Ctrl+a write sudo before it). And on some PCs writing a cmd behind sudo has no autocompletion.

@b0rk
And I have a issue with the .bash_history on my riverwm (https://codeberg.org/river/river) PC, that sometimes generates a new .bash_history+number file after I close the terminal and leaves a empty .bash_history file behind, which I suppose got something to do with river not closing the terminal the right way.
river

A non-monolithic Wayland compositor

Codeberg.org
@resera @b0rk it would be great to have an autocomplete integration that would detect permissions and at least indicate when that happened. (Allowing you to enter the password to give the prompt those permissions might be too much for a TUI)