How to create a custom terminal prompt?

can anyone guide me how can i create a good looking custom terminal prompt ?

Here is the documentation on that:

As for good looking, opinions vary :slight_smile:

1 Like

bash is what is used by default also on new installs of EndeavourOS…
But there are many ways to change how the terminal look and work.

me personally i do use also many others will burn my shell down now :wink:
But i wold suggest to start using bash and try out some prompt modifications first before you jump into changing the shell.

for a jump start… try this:

1 Like

I’m obligated to point out that this is BLOAT. :frog:

Zsh is a really nice shell, but not when it is all bloated up like that.

My way of doing it: Use bash. Use Konsole. Use one of the many Color Schemes and Fonts. I don’t see any benefit in more than just a subtle color, no benefit in zsh, and anyone using fish is on my weirdo list :wink:

1 Like

If you spend a lot of time in the terminal, it makes a difference. Zsh is really nice in interactive sessions and mostly compatible with Bash (both are POSIX compliant, as any shell ought to be, but Zsh supports most of Bash extensions to the standard, or something very similar). It’s faster than Bash (if you do not bloat it up with oh-my-zsh), and can be extended and configured to suit anyone’s preferences.

I use Zsh in graphical sessions with Konsole. But my user’s default shell is still Bash (for TTY and over SSH).

Fish is not POSIX compliant, so it’s just weird.

Check out starship available in Arch repos.
It’s super easy to set up, very customizable and already has a bunch of ready presets (if you don’t want to tweak it yourself)


Here is a thread from this forum.

What do you mean? Slower? I feel it’s very responsive.

Using oh-my-zsh in your .zshrc significantly slows down the loading of your terminal emulator.

Since I launch Konsole at least 50 times a day (probably much more), I want it to be as close to instantaneous as possible. I want to press the keyboard shortcut I use for it (Meta+<, which on an ISO keyboard I can just press with one finger) and I want the shell prompt to be ready and willing to accept my commands before my finger is even lifted from the key. No noticeable delay, pretty much instantaneous.

I achieve that by manually writing and optimising my .zshrc and not using any third-party bloat.

Oh-my-zsh is only good for one thing: stealing small fragments of code from it.

1 Like

I’m using it with p10k and never noticed any delay…

If you need to know how fast is zsh start, there’s a benchmark from Roman Perepelitsa here :

Lets exchange some code on this topic. Here is how I build my prompt in either bash or zsh:

function is_shell() {
    # which shell are we running in?
    # variable $SHELL is not sufficient
    # it stays on value 'zsh' if bash was started from zsh prompt
    local CURRENT_SHELL=$(ps -hp $$ | sed 's#.*\b\(.*sh\)#\1#')
    # $1 must be a shell name like "bash" or "zsh"
    if [[ $CURRENT_SHELL == "$1" ]]; then
        return 0
        return 1

# set boolean variable to identify the shell
if is_shell zsh; then
    setopt shwordsplit
    if is_shell bash; then

function my-prompt() {
    # color numbers

    if ((this_is_bash)); then
        BLUE="$(tput setaf $_blue)"
        ORANGE="$(tput setaf $_orange)"
        RED="$(tput setaf $_red)"
        GREY="$(tput setaf $_grey)"
        RESET="$(tput init)"
    elif ((this_is_zsh)); then

    if ((EUID == 0)); then
        # this is root

    if ((this_is_bash)); then
        PS1='${UCOLOR}╭─[\u@${ORANGE}\h (bash)${UCOLOR}] $(pwd)\n╰─#${RESET} '
    elif ((this_is_zsh)); then
        function set_win_title() {
            echo -ne "\033]0; [$USER@$HOST] ${PWD/$HOME/~} \007"
        precmd() { echo; }
        if [[ $TERM == "linux" ]]; then
            # tty is not good for special character "╭─" and "╰─"
            PROMPT=$'${UCOLOR}[%n@${ORANGE}%m${UCOLOR}] %d\n#${RESET} '
            PROMPT=$'${UCOLOR}╭─[%n@${ORANGE}%m${UCOLOR}] %d\n╰─#${RESET} '

The function is_shell is a helper function to determine the running shell. I know there is the $SHELL envrionment variable, but this is not accurate enough. If I am in zsh the variable shows zsh. If I then start bash inside a zsh session, the variable still shows zsh although I am running bash now. I am not sure if my is_shell function is the most effective way to determine the running shell, but at least it works. feedback welcome.

The function my-prompt actually creates the prompt. It works for bash or zsh.

If you want to know the numbers of the available colors, you can use this function:

function display_colors() {
    if [[ $1 ]]; then
        # print one line with the given color
        tput setaf $1
        tput setab $1 ${y// /=}$x
        # print all possible color; one per line
            x=$(tput op) y=$(printf %76s)
            for i in {0..256}; do
                echo -e ${o:${#o}-3:3} $(
                    tput setaf $i
                    tput setab $i
                )${y// /=}$x

Without argument it displays all 256 colors, one per line. With a number as argument it displays the color for that number.