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="[[\033[01;33m]\u@\h[\033[00m] ~ [\033[01;30m]\w[\033[00m]] $"

Docs:

How to Change Bash Shell Prompt Colorful and Attractive in Linux

Change command line color in centos