Questions about how to run a program or other operating system function when a given combination of keys is pressed.

learn more… | top users | synonyms (1)

90
votes
6answers
7k views

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 ...
49
votes
6answers
8k views

Exit vim more quickly

I use Vim mainly for quick edits rather than long work sessions. In that sense, I find the keyboard sequence for quitting especially laborious: Esc, Shift + ;, w, q, Enter. How to quit Vim (possibly ...
43
votes
12answers
28k views

Getting tmux to copy a buffer to the clipboard

I am trying to figure out a decent way to copy what I have in a tmux buffer into my clipboard. I have tried a couple of different things like bind-key p select-pane -t 2 \; split-window 'xsel -i ...
33
votes
2answers
8k views

Pasting X selection (not clipboard contents) with keyboard

I'd like to be able to paste the X selection using the keyboard. Currently I have to use the middle mouse button to do this. I gather that faking a middle mouse button press is fairly easy to do, ...
28
votes
3answers
8k views

Shell: how to go to the beginning of line when you are inside a screen?

I am inside a screen (screen -Ra). I have a long command, and I am at the end. Instead of keeping the left arrow, how can you go to the beginning of the line? CTRL-A works when I am in a normal ...
25
votes
6answers
17k views

How to get keycodes for xmodmap?

I'm trying to use xmodmap to remap Alt / Super keys on Dell L100 keyboard, and have trouble getting the keycodes. For instance, using xev doesn't give me keycode for Alt FocusOut event, serial 36, ...
21
votes
5answers
6k views

How to enable killing Xorg with Ctrl+Alt+Backspace

I don't remember why they did this, but at one point X.org decided that disabling CtrlAltBackspace to kill it was a good idea. I know there's a way to re-enable it but I don't remember how. Can ...
20
votes
3answers
10k views

Ctrl-s hang terminal emulator?

I came across a sentence in vimdoc: Note: CTRL-S does not work on all terminals and might block further input, use CTRL-Q to get going again. and this key indeed hangs my vim. I was ...
17
votes
8answers
3k views

How do I repeat the last command without using the arrow keys?

I know I can use Up to iterate through previous commands. Running the last command simply involves Up + Enter. However, I was thinking of buying the Happy Hacking Keyboard as I spend a lot of time in ...
17
votes
5answers
10k views

How to scroll in a terminal using keyboard?

How can I scroll in bash using only the keyboard? If it's not possible in bash, are there any other shells that support this?
16
votes
1answer
638 views

Shortcut keys that are independent to keyboard layout

Is there a way to define an association of a particular physical key of the keyboard to some action, independently of the letter that this key is associated to in any layout? Example: In most ...
15
votes
4answers
5k views

How to get vim to work with tmux properly?

I'm trying to figure out how to get vim and tmux play together. My problem is: When I use xterm-256color I get vim to work nicely, but the background doesn't render properly. I fixed this by using ...
13
votes
3answers
1k views

How can I keep control+d from disconnecting my session?

I regularly ssh to a centos 5 box. Somehow they keys are mapped so that control+d will log me out of my current shell. If I am sudo'ed to another use it puts me back to the previous user. If I am not ...
13
votes
1answer
2k views

Is there a back-“button” in w3m?

Does w3m offer a keyboard shortcut to go back one page? I couldn't find anything in the man pages.
12
votes
4answers
445 views

Is there a vim shortcut for <name of current file>?

In vim, if I'm working on a Python script, I will commonly type: :! python this_script.py to execute the script. Is there a shortcut for the name of the current file? If not, can I easily make one? ...
11
votes
2answers
2k views

Can less invoke vim instead of the default vi when I hit the 'v' key?

I want to launch vim instead of the default vi editor when I hit v in less. Are there any settings I can modify to allow me to do this?
11
votes
4answers
2k views

Is it possible to configure ctrl-w (delete word)?

Normally, Ctrl-w deletes back to the last whitespace. Is it possible to configure it to use additional characters, such as /? Edit: To be more clear: I don't want to configure the key for it, I want ...
11
votes
4answers
25k views

How do I quit from Vi?

I started Vi on my Ubuntu machine. However I don't know Vi, and now I can not quit. I see the editor and I can write text, at the bottom line there is a label "recording". How do I quit from Vi?
11
votes
2answers
3k views

How to change previous/next word shortcut in bash?

How do I configure Ctrl-Left and Ctrl-Right as previous/next word shortcuts for bash (currently alt-b and alt-f)?
11
votes
2answers
2k views

What is meant by a shell is in “vi” mode or “emacs” mode?

This question follows directly from the answer to one of my previous questions here. I am newbie to unix world and this site has helped a lot to understand some core concepts. In this case I am ...
10
votes
2answers
8k views

Shortcut key for scrolling inside a terminal

What is the shortcut key for scrolling inside a terminal? If I hit the Up or Down arrow or PageUp or PageDown, it will only traverse through command history, not let me traverse the previous part ...
10
votes
1answer
1k views

Keyboard shortcut to set gnome-terminal tab title

I like to work in Linux without using the mouse, because of that I would like to know if there is any method to set a keyboard shortcut to set gnome-terminal tab title.
9
votes
2answers
344 views

Weird control-d behavior

I can use cat as a very simple text editor by doing cat > foo.txt. If I then type: bar baz and then press ctrl+D, it now looks like this: $ cat > foo.txt bar baz^D with the cursor at the ...
9
votes
2answers
2k views

Select code block in vim

Given a code like this: 588 while ($linecounter > 0) { 589 $token = " "; 590 while ($token != PHP_EOL) { 591 if (fseek($handle, $pos, SEEK_END) == ...
9
votes
2answers
883 views

Alt-Left to skip words does not work in terminal emulators

On a Debian Wheezy machine at previous job, I got used to Alt+Left and Alt+Right to skip between words on active command-line (in bash). However, since at home I have upgraded to Jessie (Debian 8.0, ...
9
votes
4answers
5k views

Reload of tmux config not unbinding keys (bind-key is cumulative)

I've been experimenting with different tmux keybinding settings and I've noticed the following: If I reload my tmux config (from within tmux) the keybindings I once had loaded will remain loaded. The ...
9
votes
3answers
2k views

Yanking URLs in w3m

I have been using w3m for a couple of weeks and am convinced that it is my preferred text browser - with one exception. Is there any way to yank URLs to the clipboard without using the mouse? I have ...
9
votes
2answers
3k views

Mapping key combination with xmodmap

I'm trying to achieve the following mapping keycode 135 = <Ctrl-C> Is it possible to achieve this in some way?
9
votes
1answer
884 views

Assigning awesome keybinding for more than 9 tags

I'm using the awesome WM and the nine default tags (or "virtual desktops") are not anywhere near enough for me: I've got a lot of VMs and remote VNCs etc. In the past I've used window managers with ...
9
votes
1answer
716 views

How can I change the behavior of hotkeys in xmonad if the program is running?

I'm using a few key mappings in my xmonad.hs configuration file: ... , modMask = mod4Mask -- Rebind Mod to the Windows key ... [ ((controlMask, xK_Print), spawn "sleep 0.2; scrot -s") , ...
9
votes
1answer
126 views

Map a symbol to a specific key

I have the following problem: I use the intl variant of gb keyboard layout, i.e., what you get with: setxkbmap -layout gb -variant intl I use gmail in Firefox, and for some reason, the gmail ...
9
votes
1answer
980 views

Gnome stop grabbing my emacs keys

I am using Gnome in Ubuntu 11.04. I work a lot in Emacs, and I find that the Gnome window manager grabs some of the Emacs keys. To some extent, I can stop this by laboriously going through each of ...
8
votes
2answers
9k views

Xfce 4: Change global keyboard shortcuts

I use Alt+Space in Emacs, but in Xfce it pops up window manager menu at the upper left corner of a window. How do i disable Alt+Space for Xfce and change global keyboard shortcuts in general?
8
votes
1answer
676 views

What is the keyboard shortcut opposite to Ctrl+k?

Ctrl + K deletes rest of line in an UNIX command line. How do I delete all the text before the cursor?
8
votes
2answers
3k views

In GNOME 3, how does one assign keyboard shortcuts for applications besides the default applications?

In GNOME 3, there's a facility to assign keyboard shortcuts for applications like your default browser, default email client, default terminal etc. How do I do this for other applications?
8
votes
2answers
522 views

Is there any way to assign shortcuts to Nautilus bookmarks?

I have added several dirs as bookmarks to nautilus and I want to know if there a way to assign keyboard shortcuts to some of them.
8
votes
2answers
3k views

GNOME 3 Ctrl+Alt+D (show desktop)

I recently upgraded my system to GNOME 3. In previous versions of GNOME, the key combination Ctrl+Alt+D would hide all open windows and show the Desktop. This shortcut was eliminated from GNOME 3 ...
8
votes
2answers
210 views

Vim - map last shell command to the key

Is there any way to map leader-r to repeat last command sent to bash? For example, when working with C files I would like to compile and run program from vim without typing :!make or gcc. I know I ...
8
votes
1answer
795 views

Use M-C, M-V, M-A for Copy, Paste, Select All

I am using Kubuntu Linux 12.04 on a Macbook Pro, and I am seeking the ability to use the Command/Meta key for common shortcuts such as copy, paste, and select all. Attempted solutions: Remap Copy, ...
8
votes
2answers
202 views

Single key audio capture in Linux (save on key release)

I'd like to run a program that records audio only when the Right Control key is held down. On keyboard release the result would write to disk as, e.g. yy-mm-dd hh:mm.ogg. How might I do that? $ ...
7
votes
3answers
2k views

Shutdown from login prompt in tty

Suppose I boot a Linux machine without GUI. When it displays a tty login prompt, can I shutdown the machine with a keyboard sequence? Of course I could type in my username and password and then sudo ...
7
votes
3answers
3k views

Where do I find a list of terminal key codes to remap shortcuts in bash?

For example: "\e[1;5C" "\e[Z" "\e-1\C-i" I only know bits and pieces, like \e stands for escape and C- for Ctrl, but what are these numbers (1) and letters (Z)? What are the ;, [ and - signs for? ...
7
votes
3answers
4k views

How do I jump to the next or previous word with CTRL + arrow keys in a console?

In terminal emulation applications, pressing CTRL + Left / Right arrows jumps from one word to the previous or next one. Is it possible to have the same functionality in a Linux console, whether it is ...
7
votes
2answers
509 views

How can I switch 2 characters in vi?

I like the fact that I've memorized ddp for switching two lines (i.e. dd deletes the line and then p puts it back '1 higher'). Is there are similar set of keystrokes for switching 2 characters so ...
7
votes
2answers
2k views

how to close all panes but the current pane in tmux

I have a key bound to setup panes to my liking, but sometimes things get messed up or out of hand and I want to close all the panes and rerun the script. Is there a simple tmux command to close all ...
7
votes
1answer
2k views

Why didn't Ctrl-C work?

I just hit Ctrlc twice at my shell in an attempt to halt a process that is taking a long time to finish. ^C was echoed twice, but the process just kept going. Why didn't Ctrlc quit the process like ...
7
votes
1answer
3k views

How to execute a script in shell when a shortcut key is pressed

How could I execute a script in Shell when a shortcut key is pressed. Essentially what I need is when a shortcut key is pressed the script should read from a file and display that content in the ...
7
votes
1answer
6k views

How to close any window in Awesome WM?

The shortcut to close individual applications completely depends on the application developer. Some examples: Ctrl-q for Firefox Meta-F4 for Chromium Ctrl-Shift-q for GNOME Shell To close ...
7
votes
2answers
505 views

Program to show keystrokes (shortcuts) on display

I'm going to make a presentation about a software product and it has some key shortcuts, that I want to show. Is there a program, which displays the keyboard-shortcuts, that I have used?
7
votes
2answers
3k views

What is bash's meta key?

I tried to use xmodmap to map META_L to the MENU key but it doesn't seem to be accepted by bash as the meta key. So, I am wondering how these components (keyboard, X, xterm, bash) relate to each in ...