Skip to content

pkazmier/bash-prompt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bash-prompt

A lightweight (single file), cross-compatible (bash v3/v4, MacOS, Linux) bash prompt.

Dark Theme

Features

  • Single file installation to keep it simple
  • Works on MacOS and Linux (and probably others)
  • Multiple color themes that can be switched in the same session
  • Text input colorized to emphasize commands being executed
  • Easy to modify contents of prompt

Default Prompt

The included multi-line prompt has the following items:

  • Time of day in HH:MM format
  • Duration of previous command, colorized to indicate success or failure
  • Username, colorized to indicate root or non-root user
  • Hostname
  • Current path trimmed to three directories (configurable)
  • Current git branch if in a git repo
  • Number of running/sleeping jobs

Installation

Download .bash_prompt to your $HOME directory. Select a theme from the list below or create your own. Then add the following block of code to your $HOME/.bashrc or $HOME/.bash_profile, which will ensure the prompt is loaded only during an interactive session.

if [[ -n $PS1 && -f ~/.bash_prompt ]]; then
  . ~/.bash_prompt
  ps1_dark_theme  # Choose your theme here
fi

Color Themes

Here are the included themes. To switch the theme in your current session, type the name of a theme.

Note: your colors will vary depending on the ANSI color definitions in your terminal emulator. I have included my MacOS Terminal theme in the misc directory if you want to mimic this exact look. That color theme is based on Will Stone's Plastic theme for VSCode.

Switching Themes

Switching Theme

ps1_dark_theme

ps1_dark_theme ps1_dark_theme

ps1_colorful_theme

ps1_colorful_theme ps1_colorful_theme

ps1_white_theme

ps1_white_theme ps1_white_theme

ps1_blue_theme

ps1_blue_theme ps1_blue_theme

ps1_green_theme

ps1_green_theme ps1_green_theme

ps1_yellow_theme

ps1_yellow_theme ps1_yellow_theme

ps1_red_theme

ps1_red_theme ps1_red_theme

VSCode Integrated Terminal

Here is a screenshot of the bash prompt in the VSCode's integrated terminal.

vscode_term.png

About

A lightweight cross-compatible bash prompt

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages