Linux

[Linux] Prompt 관리

kissuu 2017. 12. 5. 09:25

0. Ref

 Item

 Ref. Url 

 Setting

 http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/


 Colorhttps://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/ 




1. Basic configuration

1. Display username, hostname and current working directory in the prompt

The PS1 in this example displays the following three information in the prompt:

  • \u – Username
  • \h – Hostname
  • \w – Full path of the current working directory
-bash-3.2$ export PS1="\u@\h \w> "

ramesh@dev-db ~> cd /etc/mail
ramesh@dev-db /etc/mail>



2. Setting

(1) Open bash
vi ~/.bashrc


(2) add PS1

...

PS1="\e[0;32m[giggs@\w]$ \e[m"

export PS1 

...

ex)

save image


(3) reload bash

source ~/.bashrc