wiki:UsersGuide/Shell

Version 7 (modified by Jakub Jermář, 8 years ago) ( diff )

Shell

HelenOS is primarily controlled by means of an interactive shell called Bdsh. This sections teaches you the basics of using this shell.

Type help (+Enter) to get a list of built-in commands.

Basics

The shell supports common text-editing controls. In addition to that the following controls are defined:

Keystroke Action
Enter Submit and execute the command
Up Arrow Move to older history entry
Down Arrow Move to newer history entry
Tab Complete name of command or file

Other command-line driven applications (e.g. SBI) support exactly the same controls as the shell. (The command-line input is implemented in a common library called CLUI).

Internal Shell Commands

The shell supports a few basic commands which are built into it. (Such as listing directories, creating and moving them, deleting files, etc). Other HelenOS commands are external (i.e. these are executable files on the file system) - this is similar to other operating systems.

To get a list of internal commands supported by the shell enter the command:

# help

External Commands

Most other HelenOS functionality is implemented in regular executable files (external commands), similar to other operating systems. These executables are traditionally divided into two groups: applications and servers.

Servers can be considered similar to UNIX daemons. When you run them in the right way, they will return control to the command line, but continue running in the background. To obtain a list of available servers:

# ls /srv

Applications are regular executables that perform some task and terminate. They can also be interactive applications (e.g. Tetris). To obtain a list of available applications, enter:

# ls /app

To execute a server or application, simply type its name (plus enter) on the command line. (Some servers or apps require command-line arguments, however). To run Tetris, for example, enter:

# tetris

Arguments with spaces

Bdsh supports syntax for passing arguments containing spaces. To enclose such an argument, use single quotes:

# command 'hello world'

Embedding a literal single quote is also supported:

# command 'Joe''s book'

I/O redirection

It is possible to redirect standard input and output of a command from/to a file using the following syntax:

from myinput.txt | command Will execute command with the input taken from file myinput.txt
command | to myoutput.txt Will execute command with its output written to file myoutput.txt
from myinput.txt | command | to myoutput.txt It is possible to redirect input and output at the same time

HelenOS does not support pipes yet, so running command | command etc. is currently not supported.

Note: See TracWiki for help on using the wiki.