[LINUX] Top 25 Bash Shell Prompt Characters

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:

yeahhub@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:

yeahhub@1[~]$ echo $PS1
\u@\l[\W]\$
yeahhub@1[~]$ echo $PS2
>
yeahhub@1[~]$

1 \a The bell character
2 \d The date in the format ‘‘Day Month Date’’
3 \e The ASCII escape character
4 \h The local hostname
5 \H The fully qualified domain hostname
6 \j The number of jobs currently managed by the shell
7 \l The basename of the shell’s terminal device name
8 \n The ASCII newline character
9 \r The ASCII carriage return
10 \s The name of the shell
11 \t The current time in 24-hour HH:MM:SS format
12 \T The current time in 12-hour HH:MM:SS format
13 \@ The current time in 12-hour am/pm format
14 \u The username of the current user
15 \v The version of the bash shell
16 \V The release level of the bash shell
17 \w The current working directory
18 \W The 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 \nnn The character corresponding to the octal value nnn
23 \\ A backslash
24 \[ Begins a control code sequence
25 \] Ends a control code sequence
You may also like:

Sarcastic Writer

Step by step hacking tutorials about wireless cracking, kali linux, metasploit, ethical hacking, seo tips and tricks, malware analysis and scanning.

Related Posts