Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829
Rep:
backspace makes a ^H character
At work we have an old database we log into using rxvt terminal with ssh -X. When accessing the system from a Debian 8 machine the backspace key works normal but on my new system with Debian 10 and my Ubuntu 18.04 laptop, the backspace keys prints a ^H on the screen. To delete a character I have press Ctrl and h keys. How can I make this work with Debian 10.
I've been reading about this but honestly i feel like im just going into a rabbit hole. I don't know if i need to change something on the server side or my desktop. This is also happening to my coworkers that just moved to Debian 10.
Thanks.
To delete a character I have press Ctrl and h keys. How can I make this work with Debian 10.
Execute the command
Quote:
stty erase "^h" (that is a ^ char followed by a h letter)
from your .bash_profile or such (if you're using bash on that system, of course, I think Debian often uses dash, if so, try .profile instead).
It is a well-known problem that some terminal emulators use "^?" and others "^h" (in both cases that is a ^ followed by the next char).
It is probably a matter of the terminal emulator you are using. You say the database is old so it may be expecting something older than what you are using. See if you have xterm installed. If so, try it. If not, try installing it and using it. There are a number of terminal emulators out there so try different ones, and check the configuration files to see what they use for the backspace. At a guess I would say your database computer is expecting a VT100 terminal. If you check the configuration file you will probably find that backspace sends an ascii-8 character or an ascii-128 character. Whichever it sends, change it to the other and see what happens.
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829
Original Poster
Rep:
Quote:
Originally Posted by ehartman
Execute the commandfrom your .bash_profile or such (if you're using bash on that system, of course, I think Debian often uses dash, if so, try .profile instead).
It is a well-known problem that some terminal emulators use "^?" and others "^h" (in both cases that is a ^ followed by the next char).
Just to make it clear, what you're saying is in my .bashrc file in my debian desktop, add that line in there and then try remote to the the database?
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829
Original Poster
Rep:
Quote:
Originally Posted by agillator
See if you have xterm installed. If so, try it. If not, try installing it and using it.
After installing it, it still didn't work.
Quote:
There are a number of terminal emulators out there so try different ones, and check the configuration files to see what they use for the backspace. At a guess I would say your database computer is expecting a VT100 terminal. If you check the configuration file you will probably find that backspace sends an ascii-8 character or an ascii-128 character. Whichever it sends, change it to the other and see what happens.
This is the contents of the file i use to launch it from my desktop. I have it as a custom app on my toolbar.
Just to make it clear, what you're saying is in my .bashrc file
No, although distro's differ, the .bashrc is normally only executed for a NON-login shell, you will need the .profile or .bash_profile one as that file is for a login shell, which is where a stty should be executed.
And note (from another of your messages):
Quote:
stty erase ^?
rxvt -vb --backspacekey "^H"
Here you set erase to DELETE (127), but you tell rxvt to expect a backspace (8). Probably if you would have left out the --backspacekey option it would have worked as DELETE is the default for rxvt.
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829
Original Poster
Rep:
Quote:
Originally Posted by ehartman
Here you set erase to DELETE (127), but you tell rxvt to expect a backspace (8). Probably if you would have left out the --backspacekey option it would have worked as DELETE is the default for rxvt.
I tried that with same result: when i hit backspace, it doesn't print the characters, backspace just doesn't do anything.
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829
Original Poster
Rep:
Quote:
Originally Posted by ehartman
No, although distro's differ, the .bashrc is normally only executed for a NON-login shell, you will need the .profile or .bash_profile one as that file is for a login shell, which is where a stty should be executed.
Where would I put that in the .profile file? Yes, you're right, I dont have a .bash_profile.
Code:
# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.
# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022
# if running bash
if [ -n "$BASH_VERSION" ]; then
# include .bashrc if it exists
if [ -f "$HOME/.bashrc" ]; then
. "$HOME/.bashrc"
fi
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
PATH="$HOME/.local/bin:$PATH"
fi
At work we have an old database we log into using rxvt terminal with ssh -X. When accessing the system from a Debian 8 machine the backspace key works normal but on my new system with Debian 10 and my Ubuntu 18.04 laptop, the backspace keys prints a ^H on the screen. To delete a character I have press Ctrl and h keys. How can I make this work with Debian 10.
I've been reading about this but honestly i feel like im just going into a rabbit hole. I don't know if i need to change something on the server side or my desktop. This is also happening to my coworkers that just moved to Debian 10.
Thanks.
Quote:
Originally Posted by agillator
It is probably a matter of the terminal emulator you are using. You say the database is old so it may be expecting something older than what you are using. See if you have xterm installed. If so, try it. If not, try installing it and using it. There are a number of terminal emulators out there so try different ones, and check the configuration files to see what they use for the backspace. At a guess I would say your database computer is expecting a VT100 terminal. If you check the configuration file you will probably find that backspace sends an ascii-8 character or an ascii-128 character. Whichever it sends, change it to the other and see what happens.
agillator's point was what I was thinking.
And given that it works one way in Debian 8 and another way in Debian 10 and Ubuntu 18.04, why can't you grab the stty attributes and compare?
Hello, I'm not sure what stty attributes are. Where do I look for them? Thanks.
After you logged in, on either system, do 'stty' and look at the "erase" line in its output (in my system it is the second line). If it is NOT 'erase = ^H;' this terminal (emulator) is NOT using backspace as the erase character, so you'll have to change it in your .profile by adding a line
Quote:
stty erase '^h'
Note that to be sure that is not a "real backspace", but a "^" character followed by an h
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 829
Original Poster
Rep:
Looks the same in both systems.
Code:
erik@topaz:~$ stty
speed 38400 baud; line = 0;
-brkint -imaxbel
erik@topaz:~$ ssh tethra
erik@tethra's password:
The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri Mar 20 16:15:25 2020 from topaz.aasteel.net
erik@tethra:~$ stty
speed 38400 baud; line = 0;
-brkint -imaxbel
erik@tethra:~$
erik@topaz:~$ stty
speed 38400 baud; line = 0;
-brkint -imaxbel
OK, your version of stty doesn't seem to give the "erase" line in the default case, so then use "stty -a" (return ALL stty settings) and look in the output for the "erase =" setting. You can (mostly) ignore all of the other settings given, they're not that important for Linux consoles and/or terminal emulators, only for real terminals, connected to i.e. a serial line/port.
The stty was originally written for those real terminals on Unix systems
Quote:
stty - change and print terminal line settings
and a lot of the settings are only for those serial lines (or the terminals, connected TO them). Even the speed is a fake one as "baud" is the serial transfer rate in bits per second.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.