Shell prompt

From LQWiki
Jump to navigation Jump to search
The term shell prompt is often used as a synonym for command line interface or terminal.
This article, however, is about the prompt itself, which is part of the CLI.

A shell prompt is a prompt (a bit of text) printed by the shell to indicate it is ready to receive a shell command. Typically, it looks like this:

tweedleburg:~ #

In this example, tweedleburg is your computer's hostName.

The shell prompt is highly customizable, and is often set by .profile or equivalent files.

sh shells

In shells based upon /bin/sh, the shell prompt traditionally ends with $ for ordinary users and # for root. It is set by means of the PS1 variable. A minimalist example:

export PS1="$LOGNAME\$"

For detailed examples and syntax, see the articles for various implementations:

csh shells

For csh and related shells, the prompt is traditionally % for non-root users.

set prompt="$user% "