Help with SSH and terminal modes for cli and vi

Started by ciaduck, July 11, 2026, 08:38:44 PM

Previous topic - Next topic
I could use a little help with figuring out terminal modes.

I ssh from powershell to opnsense, and invoke the shell. If I move my cursor to the start of the line (CTRL^A) and start typing, it doesn't redraw the line. If I set the terminal to vt100 (setenv TERM vt100) this seems to fix the issue. However, it makes vi unusable. As in insert mode, it doesn't draw new lines or refresh properly.

Is there something I can do to make the default xterm-256color work? or perhaps make vi work with vt100 mode?

I just don't understand enough about terminal modes.

This is running on a pcengines 2c4 and I do use the serial cable if I need to get local access to the system. The serial terminal all seems to work just fine. It's just when using SSH.

How are you getting a vi mode? The shell used on OPNsense is not bash or ksh or sh, at least it doesn't understand 'set -o vi'.
Deciso DEC740

Quote from: ciaduck on July 11, 2026, 08:38:44 PMI ssh from powershell to opnsense
What happens when you use PuTTY instead ?!
Weird guy who likes everything Linux and *BSD on PC/Laptop/Tablet/Mobile and funny little ARM based boards :)

Quote from: patient0 on July 11, 2026, 09:33:46 PMHow are you getting a vi mode? The shell used on OPNsense is not bash or ksh or sh, at least it doesn't understand 'set -o vi'.

Specifically, I ssh to root@opnsense, next I select "8" for shell. This launches tcsh.
From there I can enter any commands I care to, e.g. `configctl restart unbound`. If I need to edit a config file, I type "vi config.conf".

The rest is simply using vi. For example pressing "i" for "insert" mode and making my changes.

Quote from: ciaduck on Today at 05:32:16 PMThe rest is simply using vi. For example pressing "i" for "insert" mode and making my changes.
Oh, I see, I misunderstood. I thought you are talking about vi mode of the shell, like with bash you can set vi mode and that let you work with the command line and history with vi keys.

Not sure about Ctrl^A, you press them all together? What is it supposed to do; in control mode jump to the beginning of the line (to the left) and change to insert mode?
Deciso DEC740

Yes. I use CTRL+A and CTRL+E quite a lot in terminal shells. Often to get to the front or end of line to change the command.

For example going from using ls/ll to view things, then just hitting up-arrow and ctrl+a to change the command to vi, or rm, or something else I want to do with the file I've discovered.

This "line editing" command strategy with the terminal doesn't seem to redraw the line unless I set TERM=vt100.

I also use tab completion. But that seems to work just fine.

Quote from: nero355 on July 11, 2026, 11:30:40 PM
Quote from: ciaduck on July 11, 2026, 08:38:44 PMI ssh from powershell to opnsense
What happens when you use PuTTY instead ?!

I don't have PuTTY installed. I tried a "bash on windows" (MSYS2) terminal, and it has the same behavior as powershell.

I tried terminal from an ubuntu system I have, and "command line editing" does work. VI does not rerender properly.

I can probably live with setting it to vt100 to get cli working well. I rarely have to edit a config. It would just be nice if it worked.

Sorry, I don't understand enough about terminals to solve this issue. AI seems to think this is a common problem and has something to do with how input and interpretations differ between linux/windows and bsd. Remapping backspace is a common suggestion, but the mapping appears to already be there. I think there are a few more differences. For what it's worth, powershell can SSH to any of my linux systems and rewrite cli and render vim properly. This only seems to be an issue with the one BSD system I have (opnsense).

Thanks.

Quote from: ciaduck on Today at 06:58:05 PMI don't have PuTTY installed.
There is no need to install it so you can try it with very little traces left on your system :)
Weird guy who likes everything Linux and *BSD on PC/Laptop/Tablet/Mobile and funny little ARM based boards :)