x32x01
  • by x32x01 ||
The default shell used in all Linux distributions is the GNU bash shell. Once you start a terminal emulation package or log in from the Linux console, you get access to the shell CLI prompt. The prompt is your gateway to the shell. This is the place where you enter shell commands. The default prompt symbol for the bash shell is the dollar sign ($). This symbol indicates that the shell is waiting for you to enter text.
However, you can change the format of the prompt used by your shell. The different Linux distributions use different formats for the prompt. On our Linux system, the bash shell prompt looks like this:
Code:
root@1[~]$

You can configure the prompt to provide basic information about your environment. The above example above shows three pieces of information in the prompt:
  • The username that started the shell
  • The current virtual console number
  • The current directory (the tilde sign is shorthand for the home directory)
To display the current settings for your prompts, you can use the echo command as shown below:
Code:
root@1[~]$ echo $PS1
\u@\l[\W]\$
root@1[~]$ echo $PS2
>
root@1[~]$
1\aThe bell character
2\dThe date in the format ‘‘Day Month Date’’
3\eThe ASCII escape character
4\hThe local hostname
5\HThe fully qualified domain hostname
6\jThe number of jobs currently managed by the shell
7\lThe basename of the shell’s terminal device name
8\nThe ASCII newline character
9\rThe ASCII carriage return
10\sThe name of the shell
11\tThe current time in 24-hour HH:MM:SS format
12\TThe current time in 12-hour HH:MM:SS format
13\@The current time in 12-hour am/pm format
14\uThe username of the current user
15\vThe version of the bash shell
16\VThe release level of the bash shell
17\wThe current working directory
18\WThe basename of the current working directory
19\!The bash shell history number of this command
20\#The command number of this command
21\$A dollar sign if a normal user, or a pound sign if the root user
22\nnnThe character corresponding to the octal value nnn
23\\A backslash
24\[Begins a control code sequence
25\]Ends a control code sequence
 

Similar Threads

x32x01
Replies
0
Views
236
x32x01
x32x01
x32x01
Replies
0
Views
237
x32x01
x32x01
x32x01
  • x32x01
Replies
0
Views
232
x32x01
x32x01
x32x01
Replies
0
Views
247
x32x01
x32x01
x32x01
  • x32x01
Replies
0
Views
250
x32x01
x32x01
TAGs: Tags
bash shell prompt characters

Register & Login Faster

Forgot your password?

Latest Resources

Forum Statistics

Threads
517
Messages
519
Members
46
Latest Member
mjhl718
Back
Top