Skip to content

Instantly share code, notes, and snippets.

@jtryan
Forked from miguelmota/.bashrc
Created February 19, 2019 14:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtryan/f6fb406c2ae4f96f5c452b5a5d2a4689 to your computer and use it in GitHub Desktop.
Save jtryan/f6fb406c2ae4f96f5c452b5a5d2a4689 to your computer and use it in GitHub Desktop.
Show host IP address on your bash prompt.
# Show host IP address on your bash prompt.
#
# Example of prompt:
#
# moogs@192.168.1.100 : ~/Dropbox/workspace
# $
#
export PS1="\n\n\[\033[0;36m\]\u@$(ifconfig | grep "inet " | grep -v 127.0.0. | awk '{print $2}')\[\033[00m\]\[\033[0;32m\] : \w\[\033[00m\]\n\[\033[00;32m\]\$\[\033[00m\] "
export PS2="\[\033[0;32m\]>\[\033[00m\] "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment