CTRL+A not taking to the beginning of the line in Fedora 32 bash

Version info:
$ uname -r
5.6.14-300.fc32.x86_64
$
$ cat /etc/fedora-release
Fedora release 32 (Thirty Two)

In bash shell the keyboard shortcut to reach the beginning of the current line is CTRL key + A . This is the behaviour on an Oracle Linux 8.2 server running on kernel 4.18.0-193. Oracle Linux is pretty much a clone of RHEL/Fedora.
Fedora’s gnome terminal is bash as well, if I am not mistaken.

But, when I use the keyboard shortcut CTRL key + A in Fedora 32’s gnome terminal, it selects all the text in the terminal instead(as if it is a text editor) !!! I believe this wasn’t the case at least till Fedora 30. Only 2 weeks back, I upgraded from Fedora 30 to 32.

So, has anything changed with gnome terminal or bash recently ?
BTW CTRL+E shortcut remains the same (takes u to the end of the line)

I’m still on 31, but I’ve had a set -o emacs in my .profile forever… that should get it working at least, if not fix it.

2 Likes

Oh ok. Thanks rhiyddun. I added “set -o emacs” in ~/.bash_profile. Didn’t help.

$ cat ~/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs
set -o emacs
$ 
$ 
$ source ~/.bash_profile
$ 

Tried adding the same in ~/.bashrc file too. But, CTRL+A still selects all the text instead of taking me to the beginning of the line.
Tried setting “set -o emacs” directly in the shell . Didn’t work either. Not sure why?

BTW I never had to add this “set -o emacs” before. In the Oracle Linux 8.2, this “set -o emacs” thing is not set in .bash_profile or .bashrc files. But CTRL+A still takes you to the beginning of the line.

So, “set -o emacs” command makes the bash shell behave like an emacs editor. Right? I wanted to look up what -o does in set command. But, man page for set command seemed bit complicated for me !

In order to isolate the issue, try to install another terminal (i.e. terminator or tilix).
In that way you can try to figure out if the problem is related to the bash environment, or to some shortcut in gnome-terminal or GNOME itself that takes the precedence over the normal behavior.

3 Likes

Fedora 32 here, with gnome-terminal. Using set -o emacs makes ctrl + A go to the starting of the line as expected, so I’ve not been able to reproduce this bug.

bash-5.0.17-1.fc32.x86_64
gnome-terminal-3.36.1.1-1.fc32.x86_64
readline-8.0-4.fc32.x86_64

All of these shortcuts are only valid in emacs mode: bash keyboard shortcuts - Linux - SS64.com

By default, the readline mode is set to emacs:

In order to switch interactively between emacs and vi editing modes, use the ‘set -o emacs’ and ‘set -o vi’ commands (see The Set Builtin). The Readline default is emacs mode.

The complete doc is worth going over:

As you’ll also read there, command line editing is provided by the readline library. So, you should also check if you’ve changed any settings related to that.

(I use the vim mode, so none of these work here.)

To add to @alciregi’s suggestion, another way to test is to create a new user which will use the default configuration and see if the issue persists there. If it does not, then it is not a general OS level issue, but a user configuration level issue.

2 Likes

Notes on this: while it may be a “clone” of Fedora, the versions of software are completely different. This even applies to RHEL and Fedora: Fedora always has newer versions of software than RHEL, so not everything that works in Fedora will work that same on RHEL or other derivatives (CentOS/Scientific Linux). The actual versions of the software need to be taken into account.

Next, gnome-terminal is simply a terminal emulator. It will run whatever shell implementation you want to use. By default, in Fedora, the shell is bash, but lots of people use csh/zsh/fish and so on.

1 Like

Hi Cyril,

Could you check gnome-terminal’s preferences and see if “Select all” has a defined keyboard shortcut? If yes, just delete it and it should work as you’d expect, without having to edit any rc files.

3 Likes

alexpl is right. My bad.
Two weeks back, I changed the keyboard shortcut for “Select all” in gnome-terminal’s preferences to CTLR+A without thinking of this repercussion. :pensive:
The reason I did this was I could not find a ‘Select all’ option in drop down menus or right click in gnome-terminal.
Incidentally, this was to capture the entire terminal output of version upgrade from Fedora 30 to 32 which I did through command line :slight_smile:

Now, I have changed “Select all”'s keyboard shortcut to CTRL+Q. Hope this won’t have any repercussion :slight_smile: Is there a commonly used keyboard shortcut for this in gnome-terminal in the Linux community ?
Usually, how do you guys select all the text in gnome-terminal ? I don’t see any straightforward option for this.

Thank You alexpl.
Thank You Franscisco, alciregi

1 Like

I use either output redirection to a text file or I select text with the mouse, you can click some place and use Shift+click to select the end point.

3 Likes

Thats a great tip. Thank you alexpl :handshake:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.