How to run a command without hitting Enter Key?

Accidently I mapped Enter via xkbset to Pointer_button2.

Now every time I hit Enter some gibberish text appears.

I thought of a workaround involving remapping it back, but that means I will have to run a command xmodmap -e "keycode 135 = Pointer_Button2" (or any other keycode but that of Enter). But I’m not able to run this command in terminal, without hitting Enter.

How do I do so?

I’m running Ubuntu 12.04.

Asked By: user13107

||

You could put it into a script (.sh) and then double click it. Most modern desktop environments give the option of running a script instead of opening it in a text file.

Answered By: chees

Run the command from a non-X terminal.

CTRL+ALT+F2 should get you to a normal console. Login as your normal user, and then run the command there.

xmodmap only affects X sessions so it needs DISPLAY to work outside the X server, like this:

DISPLAY=:0 xmodmap
Answered By: Burhan Khalid

You can use CTRL+J or CTRL+M as an alternative to Enter. They are the control characters for linefeed (LF) and carriage return (CR).

Answered By: camh

If you have a mouse and graphical display you can copy the end of a previous line in your terminal and paste it onto the end of your command.

Answered By: Eric Layton

CTRL+O is another option. With bash it executes the command and moves to the next most recent in history, it is useful to cycle back through a chain of previously executed commands.

Answered By: Graeme

If you have a mouse then just copy this -> “

and paste next to your command and then paste entire command in the terminal.

Like
enter image description here

Answered By: xeon
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.