LANGUAGE » SHELL_SCRIPT » ZSH

Prompt

Usage

Set the environment variable PROMPT.

Simple example:

shell
PROMPT="%n@%m:%~ $ "

Login information

SequenceDescription
%n$USERNAME.
%mThe hostname up to the first ..

Shell state

SequenceDescription
%~Current working directory. $HOME is ~
%#A # if the shell is running with privileges, a % if not. Equivalent to %(!.#.%%).

Date and time

SequenceDescription
%DThe date in yy-mm-dd format.
%*Current time of day in 24-hour format, with seconds.
%D{date}Date formatted using the strftime function. Ex: %Y/%m/%d %H:%M:%S

Visual effects

SequenceDescription
%B (%b)Start (stop) boldface mode.
%F (%f)Start (stop) using a different foreground colour. Ex: %F{13}