Prev | Current Page 193 | Next

Christopher Negus

"Linux Bible, 2008 Edition: Boot up to Ubuntu, Fedora, KNOPPIX, Debian, openSUSE, and 11 Other Distributions"


When your Linux system is installed, often a prompt is set to contain more than just a dollar sign
or pound sign. For example, in Fedora or Red Hat Enterprise Linux, your prompt is set to include
the following information: your username, your hostname, and the base name of your current
working directory. That information is surrounded by brackets and followed by a dollar sign (for
regular users) or a pound sign (for the root user). Here is an example of that prompt:
[chris@myhost bin]$
If you change directories, the bin name would change to the name of the new directory. Likewise,
if you were to log in as a different user or to a different host, that information would change.
57
Running Commands from the Shell 2
You can use several special characters (indicated by adding a backslash to a variety of letters) to
include different information in your prompt. These can include your terminal number, the date,
and the time, as well as other pieces of information. Table 2-6 provides some examples (you can
find more on the bash man page).
TABLE 2-6
Characters to Add Information to the bash Prompt
Special Character Description
\! Shows the current command history number. This includes all previous commands
stored for your username.
\# Shows the command number of the current command.


Pages:
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205