What is the debian_chroot
variable in my .bashrc
file? and what is it doing here?
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityChroot is a unix feature that lets you restrict a process to a subtree of the filesystem. One traditional use is FTP servers that chroot to a subset of the filesystem containing only a few utilities and configuration files, plus the files to serve; that way, even if an intruder manages to exploit a bug in the server, they won't be able to access files outside the chroot. Another common use is when you're installing or repairing a unix system and you boot from a different system (such as a live CD): once a basic system is available, you can chroot into it and do more work.
The prompt setting includes the content of $debian_chroot
in the prompt, inside parentheses, unless it is empty. This variable is initialized in /etc/bash.bashrc
to the contents of the file /etc/debian_chroot
. Thus, if you follow the convention to include a name for your chroots at the location /path/to/chroot/etc/debian_chroot
, your prompt will contain an indication of which chroot you're in. A program that follows this convention is schroot, a tool for building and using chroots conveniently (I think the original intent was to facilitate having a stable Debian in a chroot inside an unstable or testing Debian, but the program has evolved quite a bit beyond that).
if $debian_chroot; then ... else
block).PS1
I posted is default (K)Ubuntu prompt