Skip to main content

Change color prompt

Procédure pour personaliser le prompt Bash

  • \u : Display the current username.
  • \h : Display the hostname
  • \W : Print the base of current working directory.
  • @ : Display current time in 12-hour am/pm format
$ export PS1="[\\u@\\h \\W \\@]\\$"
[linodadmin@centos-01 ~ 01:50 PM]$

Pour le rendre Permanent copier-coler PS1 Value dans le .bashrc à la fin du fichier

Exemple (config srv)

$ export PS1='"[[\e[033[01;34m]33m]\u[u@\h[\e[01;35m]@[\e[02;35m]\H[\e[02;37m]:033[00m] ~ [\e[033[01;32m]30m]\w[\e[01;37m]033[00m]] $[\033[0;37m]"

Docs:

How to Change Bash Shell Prompt Colorful and Attractive in Linux

Change command line color in centos