Home - Main - git - bsky

Prompt Minimalism

2026-07-29

My prompt originally look like this:
ghost@mini-pc:~$
and in a deeper directory:
ghost@mini-pc:~/Programs/dotfiles/terminal-scripts-(ts)$

Since I switched to oksh, the prompt has been annoying me as oksh doesn’t have line wrapping for input.

So I’ve now got it down to this:
~ >
and in a deeper dir:
.../dotfiles/terminal-scripts-(ts) >
Which is significantly better

Note that the -(ts) part is just showing the bookmark name (if any) for the current directory.

The biggest change is to truncate the directory to only 2 dirs, the current and parent.

I also got rid of the ghost@mini-pc part, as I know my username and which PC I’m on, so I don’t always need to see that info.

This is the full prompt section of my ~/.kshrc:

# Discipline function for relative present working directory
# by Martijn Dekker <martijn@inlv.org> 2020-08-09; public domain
function truncatedpwd
{
    v=$PWD keep=*/* # add /* for each element to keep
    [[ ($v == "$HOME" || $v == "$HOME"/*) && $HOME != / ]] && v=\~${v#"$HOME"} # Replace /home/<user> with "~"
    del=${v%/$keep}/
    [[ $v == /*/$keep ]] && v=.../${v#"$del"}
    [[ $v == \~/*/$keep ]] && v=.../${v#"$del"}
    echo $v
}

# Add my directory-bookmarks program to the prompt when relevant
PS1=' \[\033[1;35m\]'"\$(truncatedpwd)"'\[\033[1;34m\]$(directory-bookmarks current)\[\033[1;36m\] >\[\033[0m\] '