Chapter 18. Working Faster by Typing Less

Despite all the improvements in processor speed, transmission rates, network speed, and I/O capabilities, there is still a limiting factor in many uses of bash—the typing speed of the user. Scripting has been our focus, of course, but interactive use of bash is still a significant part of its use and usefulness. Many of the scripting techniques we have described can be used interactively as well, but then you find yourself faced with a lot of typing, unless you know some shortcuts.

Now “back in the day,” when Unix was first invented, there were teletype machines that could only crank out about 10 characters per second, and a good touch typist could type faster than the keyboard could handle it. It was in this milieu that Unix was developed and some of its terseness is likely due to the fact that no one wanted to type more than absolutely necessary to get across their command.

At the other end of the historical perspective (i.e., now) processors are so fast that they can be quite idle while waiting for user input, and can look back through histories of previous commands as well as in directories along your $PATH to find possible commands and valid arguments even before you finish typing them.

Combining techniques developed for each of these situations, we can greatly reduce the amount of typing required to issue shell commands—and not just out of sheer laziness. Rather, you may quickly find that these keystroke-saving measures are so useful ...

Get bash Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.