💲 My shell today

In the same vain as @wizd3m's My desktop today thread, and with pretty much the same purpose as bhilburn's "Show off your config" Powerlevel9K wiki entry], I figured I would create this topic for people to show off their terminal shell configurations so people can display just how spicy their terminal prompts are.

(This is also a continuation of my hopefully soon to be publicly visible terminal enhancement guide, which may be linked here when that is available.)

This first post should be considered the template to follow, so that other people sharing can clearly convey what is involved with their configuration. If a specific file needs to be called upon, set its path to just the file name as users need to append onto that so it suits their configuration. If variables are used to call upon specific files, note which files correspond with which variables.

:sweat_drops: Don't be intimidated by this! While the below is a rather complex implementation, it doesn't have to be this way for you. This setup can surely be compressed into a single .zshrc instance rather than shared files strewn about your filesystem. While I will not demonstrate this, your submission to this thread doesn't have to be remotely as convoluted as this.

:confetti_ball: The whole point of this thread is to have fun and revel in being able to even tinker with this most basic aspect of Linux computing. If you're not enjoying yourself on your personal rig, you are most likely doing it wrong! Customization, especially in this day and age should be celebrated!

Shell information

Shell: zsh
Theme manager: Not applicable
Extension framework: Not applicable
Shell theme: Powerlevel10K
Custom fonts required: Nerd Fonts
Files provided: 6

:left_right_arrow: These first two files should be in a location that everybody can access, including root for the intended result below. This also means all users need permission to read these first two files.

:grey_question: While I haven't been able to figure it out, it should be possible to put all files you do not want another user to tamper with (at least, without superuser, or by not having them in /etc/sudoers) by storing shared files in root. Problem is, I haven't figure that out yet; maybe one of you could help help with this? zsh keeeps denying to read even with chmod 777.

.zsharerc

# ZSH shared configuration
# All user instances of zsh should source this file in their .zshrc.

# Set up the prompt
autoload -Uz promptinit
promptinit
setopt histignorealldups sharehistory

# Use emacs keybindings even if our EDITOR is set to vi
bindkey -e

bindkey "^[[1;5C" forward-word
bindkey "^[[1;5D" backward-word

# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
HISTSIZE=1000
SAVEHIST=1000
HISTFILE=~/.zsh_history

# Use modern completion system
autoload -Uz compinit
compinit

zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _correct _approximate
zstyle ':completion:*' format 'Completing %d'
zstyle ':completion:*' group-name ''
zstyle ':completion:*' menu select=2
eval "$(dircolors -b)"
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
zstyle ':completion:*' list-colors ''
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
zstyle ':completion:*' menu select=long
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
zstyle ':completion:*' use-compctl false
zstyle ':completion:*' verbose true

zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'

# Default Ubuntu bash ls colours
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# Global shell theme configuration files
source $THEMESHARE #.p10kshare global configuration location defined in .zshrc
source $THEMELOC #Powerlevel10K theme location defined in .zshrc

.p10kshare ($THEMESHARE)

# P10K shared settings
# Source this BEFORE P10K as it configures the shell theme.

# P10K Colours (Variables defined in .zshrc)
### Left prompt
POWERLEVEL9K_OS_ICON_FOREGROUND="$USERCOLOUR0"
POWERLEVEL9K_HISTORY_FOREGROUND="$USERCOLOUR1"
POWERLEVEL9K_CONTEXT_DEFAULT_FOREGROUND="$USERCOLOUR3"
POWERLEVEL9K_HISTORY_BACKGROUND="$USERCOLOUR2"
POWERLEVEL9K_DIR_DEFAULT_BACKGROUND="$USERCOLOUR3"
POWERLEVEL9K_DIR_HOME_BACKGROUND="$USERCOLOUR3"
POWERLEVEL9K_DIR_HOME_SUBFOLDER_BACKGROUND="$USERCOLOUR3"
POWERLEVEL9K_DIR_PATH_SEPARATOR_FOREGROUND="$USERCOLOUR1"
### Right prompt
POWERLEVEL9K_STATUS_OK_FOREGROUND="$USERCOLOUR3"
POWERLEVEL9K_BACKGROUND_JOBS_FOREGROUND="$USERCOLOUR1"
POWERLEVEL9K_BACKGROUND_JOBS_BACKGROUND="$USERCOLOUR2"
POWERLEVEL9K_TIME_FOREGROUND="$USERCOLOUR4"

# P10K Custom icons
POWERLEVEL9K_DIR_PATH_SEPARATOR=$' \uE0B1 '
# POWERLEVEL9K_LINUX_UBUNTU_ICON=$'\uFA47'
# POWERLEVEL9K_ROOT_ICON=$'\uF071 '
POWERLEVEL9K_TIME_ICON=""

# P10K setup
POWERLEVEL9K_PROMPT_ON_NEWLINE=true
POWERLEVEL9K_LEFT_PROMPT_FIRST_SEGMENT_START_SYMBOL="\uE0B2"
POWERLEVEL9K_MODE="nerdfont-complete"
POWERLEVEL9K_STATUS_CROSS=true
POWERLEVEL9K_EXPERIMENTAL_TIME_REALTIME="true"

:house: The next two files below should reside in your /home directory. For .zshrc it has to.

:reminder_ribbon: Don't forget to define directory paths for shell theme files and run commands!

.zshrc

:left_speech_bubble: Looks different from any other .zshrc file doesn't it? That's because all of the conventional .zshrc stuff resides in .zsharerc, which this calls upon.

# Colours (Variables called from .p10kshare)
export USERCOLOUR0=107
export USERCOLOUR1=014
export USERCOLOUR2=024
export USERCOLOUR3=026
export USERCOLOUR4=033

# Custom icons (Multi-line symbol variables called from .p10k)
export USERICON=%F{$USERCOLOUR0}$'\uF31B'%F
export MTOPICON=$'\u256D'
export MBTMICON=$'\u2570'

# Shell theme files
# ! To use a different theme, remove this
#   block and define your own theme to use.
export THEMESHARE=.p10kshare #Global P10K theme configuration location
export THEMELOC=powerlevel10k.zsh-theme #Powerlevel10K theme location

# Run commands
# ! To define your own settings, remove
#   this block and configure for yourself.
source .zsharerc #ZSH global shell configuration location

# Greeting message
echo -e Welcome, $USER.
echo -e ""

# Load user P10K settings
source .p10k #Powerlevel10K local configuration location, presumably where .zshrc is)

.p10k

# P10K local configuration
# For local user

# P10K setup
### Multiline icons (Variables defined in .zshrc)
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="$USERICON %F{015}$MTOPICON%F"
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="  $MBTMICON\uF460 "
### Elements ("Usual" P9K / P10K stuff)
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(history context dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status background_jobs time)

:hash: The next two files should go into /root. For .zshrc, /root is root's home.

.zshrc for root

# Colours
export USERCOLOUR0=166
export USERCOLOUR1=011
export USERCOLOUR2=130
export USERCOLOUR3=166
export USERCOLOUR4=172

# Custom icons
export USERICON=%F{$USERCOLOUR0}$'\uF071'%F
export MTOPICON=$'\u250F'
export MBTMICON=$'\u2517'

# Shell theme files
# ! To use a different theme, remove this
#   block and define your own theme to use.
export THEMESHARE=.p10kshare #Global P10K theme configuration location
export THEMELOC=powerlevel10k.zsh-theme #Powerlevel10K theme location

# Run commands
# ! To define your own settings, remove
#   this block and configure for yourself.
source .zsharerc #ZSH global shell configuration location

# Greeting message
echo -e ""
echo -e "You are now super user."
echo -e ""

# Load user P10K settings
source ~/.p10k

.p10k for root

:memo: Literally the only difference here is the root heading, but maybe you want to append onto your segments and have root's config be more basic. That's up to you!

# P10K local configuration
# For root

# P10K setup
### Multiline icons
POWERLEVEL9K_MULTILINE_FIRST_PROMPT_PREFIX="$USERICON %F{015}$MTOPICON%F"
POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="  $MBTMICON\uF460 "
### Elements
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(history context dir vcs)
POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status background_jobs time)

Result:dagger:

:dagger: Slightly different from the code provided, but gets the point across.

:skull: Also don't ever rm -rf * as root, that's included as a joke. It'll be fatal for your system.

2 Likes

Also want to say, don't be intimidated by the first post; If your stuff's in a single file, that's perfectly alright. Most sane people don't do what I show. No shame in keeping it simple!

3 Likes