On a Debian-family Linux system, set a common prompt for every interactive Bash.
Use the system-wide Bash rc file rather than a login-only file.
Which file is appropriate?
On Debian-family systems, /etc/bash.bashrc is commonly used for system-wide interactive Bash settings.
Detailed explanation
/etc/profileIncorrect. /etc/profile mainly initializes login shells.
Incorrect. /etc/profile mainly initializes login shells.
~/.bashrcIncorrect. ~/.bashrc affects only one user's interactive Bash.
Incorrect. ~/.bashrc affects only one user's interactive Bash.
/etc/skel/.bashrcIncorrect. /etc/skel/.bashrc is a template for new users and does not immediately update existing users.
Incorrect. /etc/skel/.bashrc is a template for new users and does not immediately update existing users.
/etc/bash.bashrcCorrect. Debian-family systems use /etc/bash.bashrc for common interactive Bash configuration.
Correct. Debian-family systems use /etc/bash.bashrc for common interactive Bash configuration.
Try it yourself
An example you can run in a temporary verification environment.
test -r /etc/bash.bashrc && sed -n '1,8p' /etc/bash.bashrc || printf '%s
' 'not present on this distribution'Expected result
存在する環境では/etc/bash.bashrcの先頭。非Debian系では未配置の場合があるKey points
- System-wide bashrc
- Interactive setting
- Distribution differences
Notes
- Environment: Debian系 Bash / 読み取り操作
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.