MyTetra Share
Делитесь знаниями!
Настроить приветствие терминала (prompt) в bash
Время создания: 02.04.2021 10:13
Автор: b0ke
Текстовые метки: linux, unix, sh, bash, prompt, greeeting, set, cuustom, customize
Раздел: Информационные технологии - Linux - bash
Запись: and-semakin/mytetra_data/master/base/1617340426snxr4q1ptv/text.html на raw.githubusercontent.com

Приветстыие терминала настраивается прт помощи переменной окружения PS1.


export PS1="\u@\H :"


Результат:


username@domain:


Вот какие специальные символы можно использовать:


  • \a – A bell character
  • \d – Date (day/month/date)
  • \D{format} – Use this to call the system to respond with the current time
  • \e – Escape character
  • \h – Hostname (short)
  • \H – Full hostname (domain name)
  • \j – Number of jobs being managed by the shell
  • \l – The basename of the shells terminal device
  • \n – New line
  • \r – Carriage return
  • \s – The name of the shell
  • \t – Time (hour:minute:second)
  • \@ – Time, 12-hour AM/PM
  • \A – Time, 24-hour, without seconds
  • \u – Current username
  • \v – BASH version
  • \V – Extra information about the BASH version
  • \w – Current working directory ($HOME is represented by ~)
  • \W – The basename of the working directory ($HOME is represented by ~)
  • \! – Lists this command’s number in the history
  • \# – This command’s command number
  • \$ – Specifies whether the user is root (#) or otherwise ($)
  • \\ – Backslash
  • \[ – Start a sequence of non-displayed characters (useful if you want to add a command or instruction set to the prompt)
  • \] – Close or end a sequence of non-displayed characters
Так же в этом разделе:
 
MyTetra Share v.0.59
Яндекс индекс цитирования