Customize OSX terminal prompt

How to customize default terminal prompt which looks like this?

1
ComputerName Directory UserName$

simply define PS1 variable with required format. To display only full path, use following:

1
export PS1="\w $"
  • \d – date
  • \t – time
  • \h – hostname
  • \# – command number
  • \u – username
  • \W – current directory (e.g.: Desktop)
  • \w – current directory path (e.g.: /Users/Admin/Desktop)

External links: