How to run a command without hitting Enter Key?

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).


In a terminal window (I tested only aterm, rxvt, vte and xterm) you can select the end of line, which pasted back has the effect of pressing Enter:

#          ____________type the command____________  __select to end of line__
#         /                                        \/                         \
bash-4.2$ xmodmap -e "keycode 135 = Pointer_Button2"

Then paste the selected text back in the terminal window with the middle mouse button click (or with simultaneous left and right mouse button click, if configured so).


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