Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add time at which commands were executed to terminal on Mac? (change format)

Tags:

bash

macos

The default format for my terminal line looks like this:

David-Mac-mini:~ david$

I'd love if there was a way for it to show by default as:

David-Mac-mini:~ david$ [Hh:Mm:Ss]
like image 814
David Radan Avatar asked Apr 08 '16 15:04

David Radan


1 Answers

You have edit or create your .bashrc or .bash_profile profile file. Add the command export PS1="\t"

You can add the following lines to customize your Terminal prompt:

\d – Current date
\t – Current time
\h – Host name
\# – Command number
\u – User name
\W – Current working directory (ie: Desktop/)
\w – Current working directory with full path (ie: /Users/Admin/Desktop/)
like image 180
Eugene Avatar answered Sep 23 '22 17:09

Eugene