I'm new to Unix and have bought today a copy of "The Unix Programming Environment". I'm trying out the stuff from the book. But some of them are not working as expected like : To kill a line and re-type it again, @ character should be used :


$ ddtae@
Thu Nov 28 18:12:47 IST 2013

my terminal

$ ddtae@
ddtae@: command not found

Another example is to use # to erase last character


$ dd#att#e#e

which comes out as date and print it.

my terminal

$ dd#att#e#e
dd#att#e#e: command not found

in my system # is used for commment

Although they have mentioned that these characters are system dependent. How can i find the characters for my system to perform above two tasks.


Terminal line control can be queried and/or set by stty. To see the current settings, use stty -a. The manpages provide details.

For example, from stty -a you might find this kill-line control:

kill = ^U

The caret means hold the control key (Ctrl) and then type the character shown (U). To change the line-kill sequence, you could do:

$ stty kill \@

NOTE: The backslash is an escape to signify that the character following is to be interpreted literally by the shell.

Having changed your line-kill to this, (a literal @), you can now obliterate a line that looks like:

$ ddtae@

NOTE: In the above, scenario, when you type ddtae, when you type the character @, the entire line will be erased.

One way to restore the default settings (and this is very useful when you have inadvertently altered settings) is to simply do:

$ stty sane

Yet another use of stty is to control character echo-back. For instance, a simple way to hide a user's password as (s)he types it is to do:

echo "Enter password"
stty -echo
read PWORD
stty  echo
echo "You entered '${PWORD}'"
  • Thanks for the additional edits. I've added a bit more but it was 110% better than before. I literally didn't know what you guys were talking about until your edits so thanks! – slm Nov 28 '13 at 19:23

A book that mentions @ and # as line edition characters is seriously dated. It's about 40 years out of date. These are features from the very early days of Unix, and while they still exist, @ and # are not the default setting on any modern system — instead the character erase character is backspace (defined as ^h or ^? depending on the system — if all goes well, it's what the BackSpace key sends) and the line erase character is ^u (Ctrl+U). It is very rare to change these settings nowadays, except sometimes with the BackSpace key because it can send two different characters depending on the OS, terminal type and configuration.

These characters can be configured with the stty command, for example stty erase \# kill @ to set the antique Unix settings. You can see the current settings with stty -a. You can configure many other terminal-related settings. If you screw up, run stty sane to get back to a usable configuration; you can do that from another terminal, e.g. stty sane </dev/pts/42 to restore the configuration of the terminal pts/42 (run tty to see the name of the current terminal).

The stty settings only apply when the terminal is in “cooked mode”, which is the extremely crude command line editor built into the terminal driver. Modern shells have their own editor and set the terminal to raw mode, so the stty settings don't apply. Bash, csh and ksh emulate the cooked mode edition characters, whereas tcsh, zsh and fish stick to their own key bindings.


The commands you're looking for are shell dependent and can often be customized by the sysadmin and users as well.

Bash is one of the more common default shells in Linux. It looks like you're looking for what the bash manual calls the Readline Command Names and their key-bindings.

 $ ddtae@

The @ could be intended as the unix-line-discard in bash: CTRL + u or alternatively the backward-kill-word ALT + Backspace

$ dd#att#e#e

In the above example the # can simply be the Rubout which is normally mapped to Backspace.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.