Useful Keys and How to Get Them to Work in Linux

  • : Function ereg() is deprecated in /home/sparxsys_linux/www.linuxindya.com/includes/file.inc on line 647.
  • : Function ereg() is deprecated in /home/sparxsys_linux/www.linuxindya.com/includes/file.inc on line 647.
  • : Function ereg() is deprecated in /home/sparxsys_linux/www.linuxindya.com/includes/file.inc on line 647.
  • : Function ereg() is deprecated in /home/sparxsys_linux/www.linuxindya.com/includes/file.inc on line 647.
  • : Function ereg() is deprecated in /home/sparxsys_linux/www.linuxindya.com/includes/file.inc on line 647.
  • : Function ereg() is deprecated in /home/sparxsys_linux/www.linuxindya.com/includes/file.inc on line 647.
  • : preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/sparxsys_linux/www.linuxindya.com/includes/unicode.inc on line 311.
  • : preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/sparxsys_linux/www.linuxindya.com/includes/unicode.inc on line 311.
  • : preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/sparxsys_linux/www.linuxindya.com/includes/unicode.inc on line 311.
  • : preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/sparxsys_linux/www.linuxindya.com/includes/unicode.inc on line 311.
in

When you type a command, pressing the Backspace key should remove the last character. Ctrl-U should delete the line from the cursor to the beginning of the line, thus this key combination will delete the whole line if the cursor is at the end of the line.[a] When you have finished entering a command, and it is executing, Ctrl-C should abort it, and Ctrl-Z should suspend it. (When you want to resume the suspended program, enter fg for "foreground.")

[a] Ctrl-U means hold down the Control key and press u.

Ctrl-S stops the terminal output until you turn it on again with Ctrl-Q. This is probably less useful today, as most terminal emulations provide scrolling facilities anyway, but it's important to know if you have hit Ctrl-S by accident and the terminal all of a sudden "becomes unresponsive." Just hit Ctrl-Q to make it respond again; it was just waiting for you.

If any of these keys fail to work, your terminal is not configured correctly for some reason. You can fix it through the stty command. Use the syntax:

stty function key

where function is what you want to do, and key is the key that you press. Specify a control key by putting a circumflex (^) in front of the key.

Here is a set of sample commands to set up the functions described earlier:

$ stty erase ^H
$ stty kill ^U
$ stty intr ^C
$ stty susp ^Z

The first control key shown, ^H, represents the ASCII code generated by the Backspace key.

By the way, you can generate a listing of your current terminal settings by entering stty -a. But that doesn't mean you can understand the output: stty is a complicated command with many uses, some of which require a lot of knowledge about terminals.