This repository contains various utility scripts that I find useful for my development and server environments.
This script sets up a custom, colorful, and informative Bash prompt (PS1) designed for engineers. It displays the username@hostname, the current directory basename, and the current Git branch (if you’re inside a Git repository).
-
User & Hostname:
username@hostnamein green. -
Current Directory: Basename of the working directory in blue/cyan.
-
Git Branch Display: Shows
(branch-name)in pink/purple when in a Git repository. -
Two-Line Prompt: Separates information from input for better readability.
For installation in alpine docker images this extensions need to be installed first
apk update && apk upgrade && apk add bash curl git ncursesTo quickly apply this custom prompt to your Ubuntu (or compatible Bash) system, you can use the following one-liner. This command will download the ps1.sh script and pipe its content directly to bash for execution. It will append the PS1 configuration to your ~/.bashrc and then source it to apply immediately.
curl -fsSL https://raw.githubusercontent.com/Hugo2128/scripts/main/ps1.sh | bashWhat the script does:
-
Appends the
export PS1="…"configuration to your~/.bashrcfile. -
Sources (
. ~/.bashrc) your~/.bashrcfile to apply the new prompt configuration to your current shell session.
For those who prefer to inspect the script before execution (highly recommended for security best practices), you can download it first:
# 1. Download the script
curl -fsSL https://raw.githubusercontent.com/Hugo2128/scripts/main/ps1.sh -o ps1.sh
# 2. Review the script's content
less ps1.sh
# Or, if you prefer a graphical editor
# nano ps1.sh
# vi ps1.sh
# 3. Execute the script if satisfied
bash ps1.sh
# 4. (Optional) Clean up the downloaded file
rm ps1.sh