2011-11-25 11:56:09 +00:00
|
|
|
[[!meta title="My Bash and Zsh prompt"]]
|
|
|
|
|
2011-11-25 11:58:38 +00:00
|
|
|
This article is for those who wonder how my very simple, but helpful prompt
|
|
|
|
in the shell is created and to learn the motivation behind it.
|
2011-11-25 11:56:09 +00:00
|
|
|
|
|
|
|
## How it looks like
|
|
|
|
|
|
|
|
[[!img bash-zsh-prompt-screenshot-20111125.png alt="Bash/Zsh Prompt"]]
|
|
|
|
|
|
|
|
## How it is created
|
|
|
|
|
|
|
|
Bash:
|
|
|
|
|
|
|
|
PS1='[\t] \[\033[1m\]\h\[\033[0m\]:\W\$ '
|
|
|
|
|
|
|
|
Zsh:
|
|
|
|
|
2011-11-25 11:58:38 +00:00
|
|
|
PS1="[%T] %B%m%b:%c%# "
|
2011-11-25 11:56:09 +00:00
|
|
|
|
|
|
|
## Motivation
|
|
|
|
|
2011-11-25 11:58:38 +00:00
|
|
|
* I need the hostname to know on which box I am working
|
|
|
|
* Time is helpful for copy & paste in logs (and to not waste space with ***xclock***)
|
|
|
|
* Short directory name (\W, %c) is helpful, long paths make the prompt
|
2011-11-25 11:56:09 +00:00
|
|
|
unusable and I usually know which tree I am in (if not: pwd helps)
|
2011-11-25 11:58:38 +00:00
|
|
|
* No need for **username@** like most distros do: If I am a user,
|
2011-11-25 11:56:09 +00:00
|
|
|
I am ***nico*** (***$*** in bash, ***%*** in zsh). Otherwise I am root (***#***).
|
|
|
|
|
|
|
|
[[!tag config sysadmin unix]]
|