start page | rating of books | rating of authors | reviews | copyrights

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 9.1 What's Special About the UNIX Command LineChapter 9
Saving Time on the Command Line
Next: 9.3 Reprinting Your Command Line with CTRL-r
 

9.2 Fix a Line Faster with Line-Kill and Word-Erase

It's amazing how often you'll see even moderately experienced UNIX users holding down the BACKSPACE or DELETE key to delete a partially completed command line that contains an error.

It's usually easier to use the line-kill character - typically CTRL-u or CTRL-x. (The command stty -a or stty everything (41.3) will tell you which. Article 5.9 shows how to change them.) The line-kill character will work on a command line (at a shell prompt (7.1)) and in other places where the terminal is in cooked mode (41.2). Some UNIX programs that don't run in cooked mode, like vi, understand the line-kill character, too.

Even better, many systems have a "word-erase" character, usually CTRL-w, which deletes only back to the previous whitespace. There's no need to delete the entire command line if you want to change only part of it!

On some systems with command-line editing (11.13), though, the line-kill and word-erase characters may not work the way we've explained. That's because the command-line editing isn't done in cooked mode; the shell handles every character you type. Check your shell's manual page.

- JP, TOR


Previous: 9.1 What's Special About the UNIX Command LineUNIX Power ToolsNext: 9.3 Reprinting Your Command Line with CTRL-r
9.1 What's Special About the UNIX Command LineBook Index9.3 Reprinting Your Command Line with CTRL-r

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System