Console Configuration Question for BSD Users

Hey drop us a line about the show. Feel free to ask questions, provide feedback and criticism, or just ramble on about anything your little heart desires.

Moderators: snarkout, Patrick, dann

Post Reply
User avatar
mowestusa
Posts: 298
Joined: Mon Apr 04, 2005 10:27 pm
Location: Farm Fields of Wheat and Corn
Contact:

Console Configuration Question for BSD Users

Post by mowestusa » Wed May 02, 2007 6:52 pm

(Question at the very end)
A thread has already been started which shows that we do have some BSD users, so I thought I would just ask.

I have just started using NetBSD on a really old laptop. I have to say, I'm really enjoying the experience, and the selection of precompiled packages for the i386 platform.

I found out something interesting about NetBSD configuration. My computer experience includes Amigas, all Windows, DOS, and Linux distros. All of them have configured the PC keyboard so that "backspace" deletes to the left of the cursor, and "delete" deletes to the right of the cursor. By design NetBSD configures both the "backspace" and "delete" to delete to the left, and it seems impossible to change in console mode (I believe x is able to be changed).

This behavior is on purpose because Unix terminals never had a "backspace" key, but instead had a "delete" key in that spot which deleted to the left. Also ASCII does not actually have a key to delete-right, so by design NetBSD PC keyboards function as they do. To delete-right in bash you are probably in emacs mode by default so you would use the combination "Ctrl-d". If in vim you can delete-right by entering into "command mode" and using the "x" key.

I was just wondering what the other BSD flavors has decided to do by default? Also what shells can you install for root and users by default in the other BSD flavors? (NetBSD offers only sh, csh, tcsh but of course BASH can be installed afterwards through the package manager.)

It is kind of fun to use the BSD's just to see the slight differences they have over Linux distros. I really am enjoying NetBSD on this old laptop with a Pentium 166 with 32megs of ram and using it in console mode only, no x. It is fast to boot, stable, responsive, and offers a great way to install binary packages without an internet connection.

User avatar
adam
Posts: 73
Joined: Sat Jun 03, 2006 4:43 pm
Location: Dora, Alabama

Post by adam » Thu May 03, 2007 2:02 am

Well on OpenBSD, ksh is the default shell. Backspace and delete works correctly but home and end keys do not. There are supposedly ways to get them to work, but I could never get both of them to work at the same time(probably user error on my part). ksh uses the bash C-a and C-e bindings for home and end, respectively, but in a screen session(and I cant live without using screen) that doesn't work out too well because of C-a being the screen command character and since I didn't bother looking into it, I don't know if the binding could be changed in either ksh or screen. I eventually just decided to go with bash(which all of the keys work correctly) on my user account and since i like using sudo, i just left the root account as ksh, which is recommended since sh, ksh, and csh are the only shells that are statically linked(necessary in single-user mode. If I ever do need to su to root I can just deal with it for a few commands.
Image

User avatar
Vogateer
Posts: 700
Joined: Thu Nov 17, 2005 11:18 pm
Location: Norman, Oklahoma
Contact:

Post by Vogateer » Thu May 03, 2007 7:41 am

Just a quick note on using screen, if you need to send a "Ctrl+a" to the console, you just hit "Ctrl+a, a" to do so.
Vim is beautiful

User avatar
mowestusa
Posts: 298
Joined: Mon Apr 04, 2005 10:27 pm
Location: Farm Fields of Wheat and Corn
Contact:

Post by mowestusa » Thu May 03, 2007 10:47 am

adam wrote:Well on OpenBSD, ksh is the default shell. Backspace and delete works correctly but home and end keys do not... I eventually just decided to go with bash(which all of the keys work correctly) on my user account and since i like using sudo, i just left the root account as ksh, which is recommended since sh, ksh, and csh are the only shells that are statically linked(necessary in single-user mode. If I ever do need to su to root I can just deal with it for a few commands.
I think I need to correct what I said before. NetBSD offers ksh (if this is referring to Korn Shell) not tcsh as the third option. Like OpenBSD, NetBSD also recommends one of the standard shells because all the rest are in user land which if disabled in some fashion would mean that you have lost your shell access.

By "works correctly" do you mean that OpenBSD in the ksh has backspace set up to "delete-left" and delete is set up to "delete-right". That is very interesting. On NetBSD my home, end, page up, and page down did not work until I passed the $TERM variable in .profile as "export TERM="wsvt25" which is the NetBSD console. Then home, end, page up, and page down worked instead of just beeping, but still the delete-left remained for backspace and delete keys.

I wonder why in BASH everything just works as you would expect in OpenBSD. They must have set up something that maps the keys different than standard ASCII or different from old Unix terminals.

Thanks for sharing your thoughts.

User avatar
adam
Posts: 73
Joined: Sat Jun 03, 2006 4:43 pm
Location: Dora, Alabama

Post by adam » Fri May 04, 2007 7:44 am

Vogateer wrote:Just a quick note on using screen, if you need to send a "Ctrl+a" to the console, you just hit "Ctrl+a, a" to do so.
doh. as much as i use screen, i haven't used much more than "C-a {c,n,p}" :lol:
mowestusa wrote:By "works correctly" do you mean that OpenBSD in the ksh has backspace set up to "delete-left" and delete is set up to "delete-right". That is very interesting. On NetBSD my home, end, page up, and page down did not work until I passed the $TERM variable in .profile as "export TERM="wsvt25" which is the NetBSD console. Then home, end, page up, and page down worked instead of just beeping, but still the delete-left remained for backspace and delete keys.
Actually, I just checked again and backspace(delete left) works but delete(delete right) just outputs a tilda(~). In ~/.profile you can use the "bind" command to bind the character output of the keys to their actions but I could only get one to work at a time :?
mowestusa wrote:I wonder why in BASH everything just works as you would expect in OpenBSD. They must have set up something that maps the keys different than standard ASCII or different from old Unix terminals.
I don't have a ~/.inputrc or an /etc/inputrc so unless it was done in compile time configuration(if that's possible), I'm not sure.

And to go back to your previous post:
mowestusa wrote:By design NetBSD configures both the "backspace" and "delete" to delete to the left, and it seems impossible to change in console mode (I believe x is able to be changed).
I'm not sure about NetBSD's X(or any of the BSD's X for that matter), but you should be able to do that with xmodmap.
Image

User avatar
mowestusa
Posts: 298
Joined: Mon Apr 04, 2005 10:27 pm
Location: Farm Fields of Wheat and Corn
Contact:

Post by mowestusa » Fri May 04, 2007 8:06 am

adam wrote:
mowestusa wrote:By "works correctly" do you mean that OpenBSD in the ksh has backspace set up to "delete-left" and delete is set up to "delete-right". That is very interesting. On NetBSD my home, end, page up, and page down did not work until I passed the $TERM variable in .profile as "export TERM="wsvt25" which is the NetBSD console. Then home, end, page up, and page down worked instead of just beeping, but still the delete-left remained for backspace and delete keys.
Actually, I just checked again and backspace(delete left) works but delete(delete right) just outputs a tilda(~). In ~/.profile you can use the "bind" command to bind the character output of the keys to their actions but I could only get one to work at a time :?
Does this happen in BASH too?
adam wrote:
mowestusa wrote:I wonder why in BASH everything just works as you would expect in OpenBSD. They must have set up something that maps the keys different than standard ASCII or different from old Unix terminals.
I don't have a ~/.inputrc or an /etc/inputrc so unless it was done in compile time configuration(if that's possible), I'm not sure.
I believe there is a binary file called "terminfo" that can be configured with these options and compiled. However, if you get a "~" in BASH than it sounds as if you have the same issue in OpenBSD or a similar issue as I have in NetBSD.
adam wrote: And to go back to your previous post:
mowestusa wrote:By design NetBSD configures both the "backspace" and "delete" to delete to the left, and it seems impossible to change in console mode (I believe x is able to be changed).
I'm not sure about NetBSD's X(or any of the BSD's X for that matter), but you should be able to do that with xmodmap.
From what I understand X in NetBSD is not an issue. It seems that X with its different configuration files sets "delete" to function as you would expect in all the other OSs.

User avatar
adam
Posts: 73
Joined: Sat Jun 03, 2006 4:43 pm
Location: Dora, Alabama

Post by adam » Fri May 04, 2007 8:58 am

Does this happen in BASH too?
Nope.
I believe there is a binary file called "terminfo" that can be configured with these options and compiled. However, if you get a "~" in BASH than it sounds as if you have the same issue in OpenBSD or a similar issue as I have in NetBSD.
This happens whether I login to a console or from screen. I'm not sure what TERM gets set to on the openbsd console but screen sets it to "screen". There is /etc/termcap which is a textfile with all of the terminal entries. From the man pages, it seems terminfo and termcap work together somehow. I really have no clue how all of that works. I don't think it has anything to do with the shells, however. [/quote]
Image

Post Reply