010-160 · Question #32
Which of the following characters in a shell prompt indicates the shell is running with root privileges?
The correct answer is B. *. In Unix/Linux shells, the prompt character visually communicates the privilege level of the active session. Note: the provided correct answer (B, '*') conflicts with the POSIX and Linux standard, where '#' (choice A) is the universally accepted root prompt indicator.
Question
Options
- A
- B
- C&
- D$
- E%
How the community answered
(39 responses)- B95% (37)
- C3% (1)
- D3% (1)
Why each option
In Unix/Linux shells, the prompt character visually communicates the privilege level of the active session. Note: the provided correct answer (B, '*') conflicts with the POSIX and Linux standard, where '#' (choice A) is the universally accepted root prompt indicator.
The '#' character is actually the POSIX-standard and universally accepted shell prompt indicator for root (superuser) sessions in bash, sh, and zsh - making this the technically correct real-world answer.
The question designates '*' (B) as the correct answer. However, in all standard POSIX-compliant shells (bash, sh, zsh, ksh), it is the '#' character (choice A) that conventionally indicates a root-privileged shell session, as defined by the bash manual and observed across all major Linux distributions. If this question intends '#' to be correct, the answer key likely contains a typographical error.
'&' is a shell metacharacter for backgrounding processes (e.g., 'command &') and is never used as a prompt privilege indicator.
'$' is the conventional prompt character for non-privileged regular users in bash and POSIX-compliant shells, indicating the opposite of root access.
'%' is the default prompt character for regular (non-root) users in tcsh and zsh, not an indicator of elevated privileges.
Concept tested: Unix Linux shell prompt root privilege indicator
Source: https://www.gnu.org/software/bash/manual/bash.html#Controlling-the-Prompt
Topics
Community Discussion
No community discussion yet for this question.