Linux Style Bash Prompt

Bash Prompt

Linux Style Bash Prompt

When using any Unix system, my preferred shell is bash. However in OpenSolaris, the Bash shell needs some configuring to have the correct aliases, prompt style and also the correct paths.

Just create a .bashrc file as follows:

# Define default prompt to <username>@<hostname>:<path><"($|#) ">
# and print '#' for user "root" and '$' for normal users.
#
PS1='${LOGNAME}@$(/usr/bin/hostname):$(
    [[ "${LOGNAME}" == "root" ]] && printf "%s" "${PWD/${HOME}/~}# " ||
    printf "%s" "${PWD/${HOME}/~}\$ ")'


export PATH=$PATH:/opt/csw/bin:/usr/sfw/bin
export MANPATH=$MANPATH:/usr/gnu/share/man:/usr/share/man:/usr/X11/share/man:/opt/csw/man:/usr/sfw/man
export PAGER="/usr/bin/less -ins"

export TERM=dtterm

alias ls='ls --color=always'
alias ll='ls -l --color=always'
alias vi='vim'
alias rm='rm -i'

Browse Space

- Pages
- News
- Labels
- Attachments
- Bookmarks
- Mail
- Advanced

Explore Confluence

- Popular Labels
- Notation Guide

Your Account

Log In

 

Other Features

Add Content

- Add Comment