Three More Command Line Shortcuts
Tip 22, Three Useful Command Line Shortcuts, had three quick hints for more
effective, or more fun, usage of the BeOS command line in the Terminal
application. Here are three more tricks you might not know about, which are
even more useful.
- One of the things that is the most irritating to do on a command line is
to type file names or, even worse, full file paths. Thankfully, the BeOS
gives you an easy way to enter the file path for an existing file: just
drag it from the Tracker into the Terminal window!
The Tracker sends a message to Terminal, telling it what file was
dropped, and Terminal types the text for the file's full file path (e.g.
"/boot/home/config/boot/UserBootscript") at the Terminal cursor.
Note that while you can drag and drop more than one file this way, and
Terminal will do the right thing, not too many command line tools
will (you usually have to quote or otherwise delimit multiple file names).
- A second way to speed typing file names is to use "Tab completion." This
is a feature of the bash shell, the default "flavor" for the BeOS command
line. It allows you to type enough of a file's name to make it unique, and
press the Tab key. The bash shell will finish typing the file name (or
path) for you.
There's more to Tab completion than that, and more than a single Tip can handle; check out
the O'Reilly book Learning
the Bash Shell to get all the ins and outs of Tab completion.
- There are some situations where Tab completion would be nice, but just
don't work. For example, when you are using the command line ftp tool, even
though you're typing commands you're actually inside the ftp program, not
the bash shell, and the ftp program does not do Tab completion.
In those situations, often you can just copy and paste text from the
Terminal window to type the text you want for your ftp command. But there's
an even faster way. First select the text you want to re-type at the
prompt, then right-click the selected text. It will be immediately re-typed
(just as if you had copied and pasted it) at the command line prompt.
Give these tips a try the next time you find yourself using the command
line in the BeOS, and see if they don't brighten your day!