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[01;34m]\u[\e[01;35m]@[\e[02;35m]\H[\e[02;37m]:[\e[01;32m]\w[\e[01;37m]$[\033[0;37m] '

Docs:

How to Change Bash Shell Prompt Colorful and Attractive in Linux

[https://www.bulafish.com/centos/2018/04/25/change-command-line-color-in-centos7/](Change command line color in centos)centos