hide random home http://www.be.com/documentation/user_docs/app_a_commandline.html (Amiga Plus Extra No. 5/97, 05/1997)

[Contents] [Prev] [Next] [Index]

App A: Using the BeOS Command Line Shell


One of the most common complaints about graphical user interface operating systems is that they eliminate or severely disable text-based command line control. This is especially frustrating to users accustomed to command lines, particularly those coming from Unix-based systems.

The BeOS is graphically based, but also has the command line capabilities found in most Unix systems. There are three main benefits to this approach:

Command Line Control and Tools

Just about anything you can do with the graphical interface on the BeOS you can also do from the BeOS command line. When combined with the Unix Posix features of the BeOS, many Unix tools can be used without change. Many of these are already installed in the file:///boot/beos/bin/ directory.

Getting Under The Hood

There are a number of powerful text-based tools which can give you a "look under the hood" at the BeOS. This is helpful for configuring complex systems or fine tuning the performance of specific applications and the system overall. For example, you can get a list of every process running on the BeOS, and initiate and stop processes from the command line.

Powerful Scripting Language

By using text-based commands, you can build powerful scripts to control virtually every aspect of the BeOS. These scripts can aid in configuration, and can even be the equivalent of double-clickable applications

The BeOS command line shell is based on the bash shell. This interface is used throughout the Unix community. The commands the BeOS uses are identical to those used with bash.


Note: bash stands for the Borne-Again Shell, a derivative of the original Borne shell. To learn about the features of this command and scripting environment, check some of the many books available on the subject. One of the most comprehensive is Learning the bash Shell, by Cameron Newham and Bill Rosenblatt, published by O'Reilly & Associates (also the technical publishers for the BeOS and of the Be Book for programming with the BeOS). O'Reilly & Associates is on the web at
http://www.ora.com/.

Accessing the BeOS Command Line

The BeOS command line environment is accessed through the Terminal application (file:///boot/apps/Terminal). Terminal supplies the text interface and gives you access to the bash shell tools that are integrated with the BeOS. When you double-click on the Terminal application, the following window opens:

The $ prompt tells you that the command line is ready to accept any typed command. You can open multiple Terminal windows at the same time, each one executing its own set of commands. To exit the command line shell, type exit, close the Terminal window, or quit the application. Closing the window terminates any command currently executing in that shell.

Examples of Common Commands

You can also see a listing of supported commands in the on-line documentation on your BeOS CD (file:///boot/beos/documentation/). As examples, here are a few common commands:

Command Does this
ls Returns a list of the files in the current directory (list).
cd path Change directory. Changes the current directory to path. Note that "cd.." moves up one directory from the current one.
application_name Typing the name of an application launches the application. If you type "application_name &", the application opens in the background and the process ID of the application is returned.
ftp server_domain
_name
Opens an Internet file transfer protocol session. You can find out more about this command in the chapter Using Internet Services.
telnet domain_name Opens a Telnet remote access session. To find out more about this command see the chapter "Using Internet Services."
ps Returns a list of every process currently running on the BeOS, including their state and process ID numbers.
kill process_ID Terminates the thread with the given process ID. If the thread is the main thread for an application, all associated threads are also killed. This command can be both helpful and dangerous, so be careful if you use it, especially with any BeOS system thread or process.



[Contents] [Prev] [Next] [Index]

http://www.be.com/
Copyright © 1997, Be, Incorporated. All rights reserved.