Jump to content
V.T. Eric Layton

Custom Bash Prompts

Recommended Posts

Especailly since I don't make any

Me neither. It's easy on Debian. (sunrat dodges hurled stones). :shifty: :whistling:

 

ps. I love the irony of your incorect speling. :D

Share this post


Link to post
Share on other sites

Good one Aryeh. There be some nasty but funny posts there, eg.:

alias rm="echo I\\'m sorry Dave, I\\'m afraid I can\\'t do that"

Share this post


Link to post
Share on other sites

Is that the page that had the infamous Snoopy prompt? It left the user with only 1 viewable command line and took up all the memory allocated to the environment space.

Share this post


Link to post
Share on other sites

Reviving the dead....lol

Here's my latest......using ZSH.....I'm also including todays weather.

shell_prompt.png

  • Like 2

Share this post


Link to post
Share on other sites

Wow! I like short and simple for my bash prompts:

 

user1[~]$

 

PS1='\[\e[1;32m\]\u[\w]\\$ \[\e[0m\]'

 

bash-prompt.png

  • Like 2

Share this post


Link to post
Share on other sites
Posted (edited)

lol....the screenshot I posted shows the whole screen including my prompt.....the prompt I'm using is just a single line! lol I included the local weather out of kindness...lol

Edited by wa4chq

Share this post


Link to post
Share on other sites
Posted (edited)

Hmm... that is short and simple. I'll bet you're a vanilla ice cream type, huh? ;)

 

Ha-ha, I don't know. Oh, here's the whole window with my neofetch:

 

konsole-2.png

Edited by saturnian
  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)
PS1="[%w] $fg[green]%n %~ $fg[white]--> "

prompt.png

Edited by wa4chq

Share this post


Link to post
Share on other sites

PS1="[%w] $fg[green]%n %~ $fg[white]--> "

 

Does this work only for ZSH? I tried it here (using BASH) and it gives me this prompt, all in white:

 

[%w] [green]%n %~ [white]-->

  • Like 1

Share this post


Link to post
Share on other sites

PS1="[%w] $fg[green]%n %~ $fg[white]--> "

 

Does this work only for ZSH? I tried it here (using BASH) and it gives me this prompt, all in white:

 

[%w] [green]%n %~ [white]-->

 

Zsh does not use that syntax in it's config. Here is my ~/.zshrc:

 

# Path to your oh-my-zsh installation.
ZSH=/usr/share/oh-my-zsh/

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="evan"

# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"

plugins=(git)

# User configuration
export PATH=$HOME/bin:/usr/local/bin:$PATH

ZSH_CACHE_DIR=$HOME/.oh-my-zsh-cache
if [[ ! -d $ZSH_CACHE_DIR ]]; then
mkdir $ZSH_CACHE_DIR
fi

source $ZSH/oh-my-zsh.sh

#Syntax highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

#Aliases
alias vtop='vtop --theme dark'
alias grep='grep --color=auto'
alias rb='dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Reboot'
alias pa='yay -Syu'
alias di='di -H -x tmpfs,run'
alias tor='chromium --proxy-server="socks://localhost:9050"'
alias myip='dig +short myip.opendns.com @resolver1.opendns.com'
alias mixer='pulsemixer'
alias mail='neomutt'
alias mkdir='mkdir -pv'
source /usr/share/doc/pkgfile/command-not-found.zsh
export _JAVA_OPTIONS='-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
export GEM_HOME=$(ruby -e 'print Gem.user_dir')
source ~/.rvm/scripts/rvm

transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi
tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; }

  • Like 1

Share this post


Link to post
Share on other sites

PS1="[%w] $fg[green]%n %~ $fg[white]--> "

 

Does this work only for ZSH? I tried it here (using BASH) and it gives me this prompt, all in white:

 

[%w] [green]%n %~ [white]-->

I believe so, only for zsh. If I try using bash prompts with zsh, they don't work. There are plenty of sites for pimping bash. Here's one...https://www.maketecheasier.com/customise-bash-prompt-linux/

  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

PS1="[%w] $fg[green]%n %~ $fg[white]--> "

 

Does this work only for ZSH? I tried it here (using BASH) and it gives me this prompt, all in white:

 

[%w] [green]%n %~ [white]-->

 

Zsh does not use that syntax in it's config. Here is my ~/.zshrc:

 

# Path to your oh-my-zsh installation.
ZSH=/usr/share/oh-my-zsh/

# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="evan"

# Uncomment the following line to disable bi-weekly auto-update checks.
DISABLE_AUTO_UPDATE="true"

# Uncomment the following line to enable command auto-correction.
ENABLE_CORRECTION="true"

# Uncomment the following line to display red dots whilst waiting for completion.
COMPLETION_WAITING_DOTS="true"

plugins=(git)

# User configuration
export PATH=$HOME/bin:/usr/local/bin:$PATH

ZSH_CACHE_DIR=$HOME/.oh-my-zsh-cache
if [[ ! -d $ZSH_CACHE_DIR ]]; then
mkdir $ZSH_CACHE_DIR
fi

source $ZSH/oh-my-zsh.sh

#Syntax highlighting
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

#Aliases
alias vtop='vtop --theme dark'
alias grep='grep --color=auto'
alias rb='dbus-send --system --print-reply --dest="org.freedesktop.Hal" /org/freedesktop/Hal/devices/computer org.freedesktop.Hal.Device.SystemPowerManagement.Reboot'
alias pa='yay -Syu'
alias di='di -H -x tmpfs,run'
alias tor='chromium --proxy-server="socks://localhost:9050"'
alias myip='dig +short myip.opendns.com @resolver1.opendns.com'
alias mixer='pulsemixer'
alias mail='neomutt'
alias mkdir='mkdir -pv'
source /usr/share/doc/pkgfile/command-not-found.zsh
export _JAVA_OPTIONS='-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
export GEM_HOME=$(ruby -e 'print Gem.user_dir')
source ~/.rvm/scripts/rvm

transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi
tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; }

Nice. I use to use "oh-my-zsh"....pretty slick....lot's of cool prompts to choose from.

vtop.....looks interesting......gotta look into that one.

well, I checked into vtop for MX-18 and Slackware....no dice. Guess I'll settle for nmon or htop.

Edited by wa4chq
  • Like 2

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...