home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 8.20 How Many Backslashes? Chapter 9 Next: 9.2 Fix a Line Faster with Line-Kill and Word-Erase

9. Saving Time on the Command Line

9.1 What's Special About the UNIX Command Line

One of UNIX's best features is the shell's command line. Why? Every modern operating system has a command line; we don't use card readers with obscure job setup cards any more. What makes UNIX's special?

The UNIX shell command line allows lots of shortcuts. Some of these you'll find in other operating systems; some you won't. In this chapter, we'll introduce a lot of these shortcuts. Among other things, we'll discuss:

  • Faster erasing ( 9.2 ) of mistakes with the line-kill and word-erase characters. (These aren't just a feature of the shell; they work at many places other than a shell prompt.)

  • Filename completion ( 9.8 , 9.9 , 9.10 ) , which allows you to type the beginning of a filename and let the shell fill in the rest.

  • Command substitution ( 9.16 ) , which lets you use the output from one command as arguments to another. (Note: this is different from pipelining ( 1.4 ) .)

  • Process substitution ( 9.18 ) in bash , and a script named ! for other shells, lets you put the output of a command into a temporary file - and give that filename to a process.

  • Type-ahead ( 9.19 ) , the ability to type your next command (or commands) while the previous command is still running.

  • How to handle command lines that become too long ( 9.20 , 9.21 , 9.23 ) .

Some fundamental command-line features that we aren't discussing in this chapter, but which are discussed elsewhere, are:

  • Job control ( 12.1 ) , which lets you run several commands at the same time.

  • Aliases ( 10.2 ) , or abbreviations, for commands. Shell functions ( 10.9 ) are similar.

  • Command-line editing ( 11.13 ) and history substitution ( 11.1 ) are two different ways (both useful) to "recall" previous commands.

  • Quoting ( 8.14 , 8.15 ) , the way you "protect" special characters from the UNIX shell.

  • Wildcards ( 15.2 ) .

You don't need to be a command-line virtuoso to use UNIX effectively. But you'd be surprised at how much you can do with a few tricks. If all you can do at the command line is type ls or start FrameMaker, you're missing out on a lot.

- ML

Previous: 8.20 How Many Backslashes? UNIX Power Tools Next: 9.2 Fix a Line Faster with Line-Kill and Word-Erase
8.20 How Many Backslashes? Book Index 9.2 Fix a Line Faster with Line-Kill and Word-Erase

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