The Linux Keyboard HOWTO: Delete and Backspace (2024)

The Linux Keyboard HOWTO: Delete and Backspace (1)The Linux Keyboard HOWTO: Delete and Backspace (2)The Linux Keyboard HOWTO: Delete and Backspace (3)

5. Delete and Backspace

5.1 How to tell Unix what character you want to use to delete the last typed character

% stty erase ^?
If the character is erased, but in a funny way, then something iswrong with your tty settings. If echoprt is set, then erased charactersare enclosed between \ and /.If echoe is not set, then the erase char is echoed(which is reasonable when it is a printing character, like #).Most people will want stty echoe -echoprt. Saying stty sanewill do this and more. Saying stty -a shows your current settings.How come this is not right by default? It is, if you use the rightgetty.

Note that many programs (like bash, emacs etc.) have their ownkeybindings (defined in ~/.inputrc, ~/.emacs etc.)and are unaffected by the setting of the erase character.

`Getty used to do the right thing with DEL and BS but is broken now?'

Earlier, the console driver would do BS Space BS(\010\040\010)when it got a DEL (\177).Nowadays, DEL's are ignored (as they should be,since the driver emulates a vt100). Get a better getty, i.e.,one that does not output DEL.

`Login behaves differently at the first and second login attempts?'

At the first attempt, you are talking to getty. At the second attempt,you are talking to login, a different program.

5.2 How to tell Linux what code to generate when a key is pressed

On the console, or, more precisely, when not in (MEDIUM)RAW mode, use

% loadkeys mykeys.map
and under X use
% xmodmap mykeys.xmap
Note that (since XFree86-2.1) X reads the Linux settings of the keymapswhen initialising the X keymap. Although the two systems are not100% compatible, this should mean that in many cases the use ofxmodmap has become superfluous.

If, for example, you want your Backspace key to generate BackSpace(ˆH), instead of the default Delete, then

% loadkeyskeycode 14 = BackSpace%
will do.

`Why doesn't the Backspace key generate BackSpace by default?'

(i) Because the VT100 had a Delete key above the Enter key.

(ii) Because Linus decided so.

5.3 How to tell X to interchange Delete and Backspace

% xmodmap -e "keysym BackSpace = Delete" -e "keysym Delete = BackSpace"
Or, if you just want the Backspace key to generate a BackSpace:
% xmodmap -e "keycode 22 = BackSpace"
Or, if you just want the Delete key to generate a Delete:
% xmodmap -e "keycode 107 = Delete"
(but usually this is the default binding already).

5.4 How to tell emacs what to do when it receives a Delete or Backspace

Put in your .emacs file lines like

 (global-set-key "\?" 'delete-backward-char) (global-set-key "\C-h" 'help-command)
Of course you can bind other commands to other keys in the same way.

5.5 How to tell emacs to interchange Delete and Backspace

Put in your .emacs file lines

 (setq keyboard-translate-table (make-string 128 0)) (let ((i 0)) (while (< i 128) (aset keyboard-translate-table i i) (setq i (1+ i)))) (aset keyboard-translate-table ?\b ?\^?) (aset keyboard-translate-table ?\^? ?\b)

5.6 How to tell kermit to interchange Delete and Backspace

Put in your .kermrc file the lines

 set key \127 \8 set key \8 \127

5.7 How to tell xterm about your favourite tty modes

Normally xterm will inherit the tty modes from its invoker.Under xdm, the default erase and kill characters are # and @,as in good old Unix Version 6.If you don't like that, you might put something like

 XTerm*ttymodes: erase ^? kill ^U intr ^C quit ^\ eof ^D susp ^Z start ^Q stop ^S eol ^@
in /usr/lib/X11/app-defaults/XTerm or in$HOME/.Xresources, assuming that you have a line
 xrdb $HOME/.Xresources
in your $HOME/.xinitrc.

5.8 How to tell xmosaic that the Backspace key generates a DEL

Putting

 *XmText.translations: #override\n\ <Key>osfDelete: delete-previous-character() *XmTextField.translations: #override\n\ <Key>osfDelete: delete-previous-character()
in your $HOME/.Xresources helps.

The netscape FAQ, however, says:

 Why doesn't my Backspace key work in text fields? By default, Linux and XFree86 come with the Backspace and Delete keys misconfigured. All Motif programs (including, of course, Netscape Navigator) will malfunction in the same way. The Motif spec says that Backspace is supposed to delete the previous character and Delete is supposed to delete the following character. Linux and XFree86 come configured with both the Backspace and Delete keys generating Delete. You can fix this by using any one of the xmodmap, xkeycaps, or loadkeys programs to make the key in question generate the BackSpace keysym instead of Delete. You can also fix it by having a .motifbind file; see the man page for VirtualBindings(3). Note: Don't use the *XmText.translations or *XmTextField.translations resources to attempt to fix this problem. If you do, you will blow away Netscape Navigator's other text-field key bindings.

5.9 What about termcap and terminfo?

When people have problems with backspace, they tend to look at their termcap(or terminfo) entry for the terminal, and indeed, there does exist a kb(or kbs) capability describing the code generated by the Backspace key.However, not many programs use it, so unless you are having problems with oneparticular program only, probably the fault is elsewhere.Of course it is a good idea anyway to correct your termcap (terminfo) entry.See also below under "The TERM variable".

The Linux Keyboard HOWTO: Delete and Backspace (4)The Linux Keyboard HOWTO: Delete and Backspace (5)The Linux Keyboard HOWTO: Delete and Backspace (6)
The Linux Keyboard HOWTO: Delete and Backspace (2024)

FAQs

How do you Backspace on Linux keyboard? ›

Modern terminals use "Ctrl + ?" for Backspace. Most systems will recognize the latter as Backspace these days as physical terminals have largely been replaced by terminal emulators on PCs, but you may still run into systems that haven't been upgraded and still expect "Ctrl + H."

How to delete key in Linux? ›

As a Linux user, your GPG keyring comprises a long list after importing the keys of the other users to your system. You can delete the unnecessary GPG keys by using the “gpg” command.

How will you use Backspace and delete key? ›

The Backspace key erases the text to the left of the insertion point one character at a time. The Delete key erases the text to the right of the insertion point.

What is the command to Backspace? ›

How is the Backspace key used, and what is its function? The Backspace key has one function: delete text to the left of the cursor. In some Internet browsers, you can press the Backspace key to go back to the previous page. However, most browsers today use the shortcut combination Alt + ← instead.

What does Ctrl Alt Backspace do in Linux? ›

The Ctrl+Alt+Backspace shortcut key combination is used for terminating the X server. You might want to terminate the X server especially when: a program caused the X server to stop working. you need to switch from your logged-in session quickly.

What is Alt Ctrl delete in Linux? ›

Linux. In the Linux operations system, the Ctrl-Alt-Del key combination is used as a shortcut for logging out of the system.

How do I delete in Linux? ›

Deleting a single file

You can quickly and easily delete a single file with the command “rm” followed by the file name. With the command “rm” followed by a file name, you can easily delete single files in Linux.

What is the command key for delete? ›

To deletePress
Next characterDelete
Next wordCtrl+Delete or Ctrl+Backspace
Previous characterBackspace

How to delete text in Linux command? ›

To delete one character, position the cursor over the character to be deleted and type x . The x command also deletes the space the character occupied—when a letter is removed from the middle of a word, the remaining letters will close up, leaving no gap. You can also delete blank spaces in a line with the x command.

How do I delete text with backspace? ›

A backward delete is executed by pressing the key marked Backspace . This deletes the character that is to the left of the cursor. Afterwards the cursor moves one position to the left and all characters that were on the cursor or to the right of it are moved one position to the left.

How do I delete if my backspace is not working? ›

Here is what you should do:
  1. Go to Start > Settings > Ease of Access.
  2. Under the Keyboard tab, go to Sticky Keys and Filter Keys to make sure the toggle is set to Off.
Jan 20, 2023

How do I delete without backspace? ›

Every keyboard has a delete/backspace key to delete backward, but if it doesn't have a “delete forward” key ⌦, simply hold the fn (function) key and press the delete key. If preferred, you can also use ⌃ control + D to delete forward.

How do I control Backspace? ›

Ctrl+Backspace in most text programs

Pressing Ctrl + Backspace deletes the word to the left of the cursor in many programs, including OneNote, PowerPoint, Microsoft Word, and the Notepad text editor. Text programs that don't support this shortcut often delete one character to the left of the cursor.

How do you use Backspace control? ›

When editing text by pressing the Ctrl+Backspace key combination, it should delete the previous entire word to the left of the cursor. Instead, it deletes the next entire word to the right of the cursor (i.e. the same thing Ctrl+Delete does).

How do I enable Ctrl Alt Backspace? ›

Enable Ctrl+Alt+Backspace
  1. Open the Terminal and run gksu pluma /etc/default/keyboard.
  2. Find the line: XKBOPTIONS=""
  3. Replace it with: XKBOPTIONS="terminate:ctrl_alt_bksp"
  4. Save the modified file and close it.
  5. Reboot your computer to take affect.
Apr 29, 2017

What is Ctrl D in Linux? ›

Ctrl+D. This shortcut will effectively log you out of any terminal and close it, or get you back to the original user when used after su or sudo commands. It sends an EOF (End-of-file) marker to bash. Bash exits when it receives this marker. This shortcut is similar to running the exit command.

What does Ctrl Alt F7 do in Linux? ›

Ctrl+Alt+F7 or Alt+Ctrl+F7 is a keyboard shortcut used to switch between open console windows in Linux.

What does Ctrl Alt F8 do in Linux? ›

Then, with Ctrl Alt F8 , you should see the output of ls -la . Virtual consoles may also run other things than getty (a terminal manager program that initialises a virtual/physical terminal or modem and runs login to ask for your username and password). On some installations, one of the consoles outputs system logs.

What does Ctrl Alt F11 do in Linux? ›

Ctrl+Alt+F11 or Alt+Ctrl+F11 is a keyboard shortcut used with SAP products to make the window full screen.

What does Ctrl Alt F5 do in Linux? ›

Ctrl+Alt+F5 or Alt+Ctrl+F5 is a keyboard shortcut used to switch between open console windows in Linux.

What does Ctrl T do in Linux? ›

Save this answer. Show activity on this post. This key combination, a binding inherited from the emacs text editor, causes the last 2 characters typed to be swapped at the end of the line, used in the middle of a line, it swaps the character at the left of the cursor and the one under the cursor.

How to delete all text in Linux? ›

Vim delete all lines
  1. Go to normal mode - ESC.
  2. Enter command mode - :
  3. Select All - %
  4. Delete - d.
Dec 18, 2022

How to delete everything in Linux? ›

To delete everything in a directory run: rm /path/to/dir/* To remove all sub-directories and files: rm -r /path/to/dir/*

How do I force delete in Linux terminal? ›

When to Use the –force Flag in Linux
  1. To delete a file in Linux, the rm command will remove it from the system disk. ...
  2. The -f parameter is optional input when using the rm command. ...
  3. Several other optional parameters are available, so the -f flag can be used with others to delete a file.
Nov 9, 2022

How do you delete words in Linux? ›

Alt + Backspace will delete the word on the left, Ctrl + Del will delete the word to the right from the current position.

Which key is used for deleting text in Linux? ›

Which command is used for deleting a single character? Explanation: The simplest text deletion is achieved using 'x' command. This command deletes the character under the cursor and then the text on the right shifts towards the left to fill up space.

How do you delete part of a line in Linux? ›

To remove selected parts of lines from each FILE, we use the cut command in the Linux system. The cut command is used to remove and print the selected section of each FILE in the Linux operating system using a terminal. It is also used to cut the selected parts of a line by byte position, character, and field.

How do you delete a text? ›

Delete individual text messages
  1. Open the Voice app .
  2. On the bottom, tap Messages .
  3. Tap the conversation.
  4. Touch and hold the message you want to delete. Optional: To delete multiple messages, touch and hold the first message, then tap more messages.
  5. In the top right, tap Delete .
  6. Tap Delete to confirm.

Which command I am used to delete text? ›

  • To delete one word to the right press CTRL+DEL.
  • Both the Del or Delete key and Backspace key are used to delete text. ...
  • If not, here's a quick way to duplicate the forward delete functionality on a Mac laptop. ...
  • In Microsoft Word this is accomplished by pressing, often accidentally, the INS (Insert) key.

How do you press backspace without Backspace key? ›

For example, on a Windows-compatible keyboard: Pressing the left arrow key performs a non-destructive backspace, which moves the cursor one space to the left, but does not delete the previous character.

Why is my delete key not working? ›

Driver issues could be responsible for the issue “Delete key not working Windows 10”. In this case, it is recommended that you update the keyboard driver. If this does work, great! If not, try rolling back or uninstalling the keyboard driver.

Why use delete instead of backspace? ›

Both the Del or Delete key and Backspace key can delete text. However, when dealing with text, pressing the Del deletes text to the right of the cursor. Pressing Backspace deletes text to the left (backwards) of the cursor.

What is the function of F7 key? ›

More Information
Enhanced function keyWhat it does
ReplyF7: Replies to the e-mail in the active window.
SaveF11: Saves the file in the active window.
SendF9: Sends the e-mail in the active window.
SpellF10: Starts the spell checking program in the active document, if the document's program has this feature.
11 more rows

What does Ctrl Shift QQ do? ›

Chromebook-Specific Shortcuts

Ctrl + Shift + Q – Log out of your Chromebook. Press the key combination twice to quit. Alt + E – Open the Chrome browser's menu. This only works if a Chrome browser window is open and focused.

What is Ctrl Alt Shift R? ›

Screencasting. Ctrl + Alt + ⇧ Shift + R. Ctrl + ⇧ Shift + Show Windows then select the Screen Record button on the toolbar.

What is Ctrl Shift B? ›

Windows logo key keyboard shortcuts
Press this keyTo do this
Windows logo key + Ctrl + Shift + BWake PC from blank or black screen.
Windows logo key + PrtScnSave full screen screenshot to file.
Windows logo key + Alt + PrtScnSave screenshot of game window in focus to file (using Xbox Game Bar).
64 more rows

What is the opposite of Ctrl Z in Linux? ›

Undo, redo, and other shortcut key functions
Command SHORTCUT KEYProcedure
Redo CTRL+YTo reverse your last Undo, press CTRL+Y. You can reverse more than one action that has been undone. You can use Redo command only after Undo command.
5 more rows

How do I change CapsLock to Backspace in Linux? ›

How to change CapsLock key into Backspace
  1. From MintMenu, go to: All Applications > Preferences > Keyboard. ...
  2. Click the Layout tab.
  3. If you have more than one keyboard layout listed, select the one you use, then click the Options button. ...
  4. Scroll down to the CapsLock key behavior list item, and expand it.

What is Ctrl E in Linux? ›

Similarly, use CTRL+E to move the cursor to the end of the line. Alt+F moves one word forward, and Alt+B moves one word back. Shortcuts: Instead of Left arrow, left, left, left, use CTRL+A to go to the start of the line or Alt+B to move back one word.

What is Ctrl L in Linux? ›

Ctrl+L. This shortcut is equivalent to the clear command. It clears your terminal screen.

What does Ctrl D do on Linux? ›

Ctrl+D in the Linux shell

In the Linux command-line shell, pressing Ctrl + D logs out of the interface. If you used the sudo command to execute commands as another user, pressing Ctrl + D exits out of that other user and puts you back as the user you originally logged into.

How to change keys in Linux? ›

How to remap or swap special keyboard keys in Linux?
  1. Step 1: Find the KeyCode (number assigned to key) and Keysym (name of key) for your desired keys to swap. ...
  2. Step 2: Swap the keys by issuing following command: ...
  3. Step 3: Create “swap.desktop” file and put it into ~/.config/autostart with following contents in it:
Mar 31, 2017

How do I disable Ctrl Alt Backspace in Linux? ›

Check in System Settings > Input Devices > Keyboard > Advanced (tab) > check the option Configure keyboard options > search for Key sequence to kill the x server and uncheck the option for the shortcut. wow, thanks!

How do I change Caps Lock to Delete? ›

Under the Settings tab, check the box for Change the Caps Lock key and set the new keycode to 51 for Delete. You are good to go!

Top Articles
Latest Posts
Article information

Author: Clemencia Bogisich Ret

Last Updated:

Views: 5701

Rating: 5 / 5 (60 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Clemencia Bogisich Ret

Birthday: 2001-07-17

Address: Suite 794 53887 Geri Spring, West Cristentown, KY 54855

Phone: +5934435460663

Job: Central Hospitality Director

Hobby: Yoga, Electronics, Rafting, Lockpicking, Inline skating, Puzzles, scrapbook

Introduction: My name is Clemencia Bogisich Ret, I am a super, outstanding, graceful, friendly, vast, comfortable, agreeable person who loves writing and wants to share my knowledge and understanding with you.