spacer graphic spacer graphic x10icon graphic [Bar]


The BeOS Command Line

 

If you're like some of us here at Be, the command line is not your first choice for how to get things done on your system. However, the BeOS command line is very powerful, and if you invest a little time in getting used to it, you'll probably come to wonder how you did without it.

So this week, not one but three quick tips for use in Terminal, the BeOS command line tool and your window to the BeOS shell, "bash."

First of all, there is a fair amount of documentation covering using the command line tool that comes with the BeOS. The BeOS User's Guide Appendix A: Using the BeOS Command Line Shell gives some introductory information, while the BeOS Shell Tools collection provides more detailed information about specific tools distributed with the BeOS, and how to use them.

Of course, to become a true BeOS power user, you'll want to learn more about the command line than these two resources will give you. For a much more extensive treatment of bash, you'll definitely want to get the O'Reilly & Associates book, Learning the Bash Shell.

Finally, one of the most confusing things about using a command line is knowing "where you are," or what the current working directory is. Here's a simple way to give yourself a constant reminder of where you are, by changing your command line prompt to include the current working directory:

  1. Launch StyledEdit, by choosing it from the Be menu (it will be in the apps sub-menu). An empty document will appear.

  2. Type this at the top of the document:

    PS1='$PWD/ $ '

  3. Choose Save As... from the document's File menu.

  4. In the Save File Panel that appears, save the file as .profile (note the period which is the first character of the name) in your /home directory.

    Your /home directory should be the default location which appears in the Save File Panel.

    Note: If you already have a .profile file, don't replace it when prompted. Instead, copy and paste the above line from the Untitled document into the existing .profile file (which you can open in StyledEdit by double-clicking it).

  5. Quit StyledEdit, and quit Terminal if you have it running. Then launch Terminal from the Be menu, and...

Voilà! Your command line prompt should now look like this:

/boot/home $

The directory path before your shell prompt (everything before the "$") is your current working directory, or "where you are" in the shell. Try using the cd command to move around, and watch your shell prompt change with you. Cool!


Copyright © 1999 by Be, Inc. All rights reserved. Legal information (includes icon usage info).
Comments, questions, or confessions about our site? Please write the Webmaster.