Skip to content

Instantly share code, notes, and snippets.

@h8d13
Last active March 28, 2025 14:10
Show Gist options
  • Save h8d13/18cfe3fb7b9517e4186607f7b8b067cb to your computer and use it in GitHub Desktop.
Save h8d13/18cfe3fb7b9517e4186607f7b8b067cb to your computer and use it in GitHub Desktop.
.profile for Alpine
# ~/.profile: executed by Bourne-compatible login shells
# Prompt that better adapts to terminal size changes
if [ $(id -u) -eq 0 ]; then
# Root user prompt with dynamic adjustment
export PS1='\033[0;31m┌──[\033[01;31mroot\033[01;33m@\033[01;96m\h\033[0;31m]─[\033[0;32m\w\033[0;31m]\n\033[0;31m└──╼ \033[01;33m# \033[0m'
else
# Regular user prompt with dynamic adjustment
export PS1='\033[0;31m┌──[\033[0;39m\u\033[01;33m@\033[01;96m\h\033[0;31m]─[\033[0;32m\w\033[0;31m]\n\033[0;31m└──╼ \033[01;33m$ \033[0m'
fi
# Make Konsole update its size information after resizing
shopt -s checkwinsize 2>/dev/null || : # Safely try to set bash option
# Enable colors for ls
export CLICOLOR=1
# Set color options for ls
if [ -x /bin/ls ] || [ -x /usr/bin/ls ]; then
# For Alpine, use BusyBox ls with color option
alias ls='ls --color=auto'
alias ll='ls -la --color=auto'
alias la='ls -a --color=auto'
alias l='ls -CF --color=auto'
fi
# Set TERM appropriately for better color support
export TERM=xterm-256color
# Configure line wrapping to handle long paths better
tput rmam 2>/dev/null || : # Turn off auto-margin (line wrapping) for status line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment