User Tools

Site Tools


resources:bash_resources

bash Resources


bash variables

<2014.6.24>

List names, values and types of all variables

Useful on the command line, to see what you're working with:

declare -p



bash command prompt customization

<2016-01-27>

Show cwd basename, not entire absolute path

First, back up the copy of .bashrc that came with Ubuntu:

anthony@anthony-VirtualBox:~$ cp -p .bashrc .bashrc.orig

Changed \w (absolute path, I think) to \W (“basename”, just the single directory name):

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
# orig. line:
#    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
# adc changed 2016.01.27:
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\W\$ '
fi

Based on advice from:

http://askubuntu.com/questions/16728/hide-current-working-directory-in-terminal

http://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html



resources/bash_resources.txt · Last modified: 2019/05/22 16:08 by 127.0.0.1