// Terminal Customisation

Make your Bash prompt your own

Colours, username, working directory and persistent ~/.bashrc changes.

Your Bash prompt can show helpful information without a bulky desktop environment. Keep edits simple, reversible and readable on your monitor.

Back up first

cp ~/.bashrc ~/.bashrc.backup

If .bashrc doesn't exist, create it with your editor.

A clean green prompt

Open ~/.bashrc and add:

# DarkPC: green username and cyan current directory
PS1='\[\e[1;32m\]\u@darkpc\[\e[0m\]:\[\e[1;36m\]\w\[\e[0m\]\$ '

\u prints the username, \w is the current working directory, and \$ shows $ for ordinary users or # for root. \[ and \] protect Bash line wrapping around colour codes.

Try changes immediately

source ~/.bashrc

This reloads the file in the current Bash session. You can also open another terminal to test safely.

Handy aliases

alias ll='ls -lah'
alias ..='cd ..'
alias grep='grep --color=auto'

Place them in .bashrc if you like them. alias works in interactive shells, not as a universal replacement for scripting.

Didn't appear after login?

Some terminal or console logins start Bash as a login shell, which reads ~/.bash_profile or a related profile instead. A common pattern in ~/.bash_profile is:

if [ -f "$HOME/.bashrc" ]; then
  . "$HOME/.bashrc"
fi

Avoid adding the same prompt code to multiple files. If your terminal behaves strangely, restore your .bashrc.backup from a new shell.

Useful official references