Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show time next to the command line in terminal/console

Tags:

linux

shell

When I execute command line (linux) I want to know what time there were executed when I scroll up my terminal window. I saw this once setup in linux environment but how to do that?

Time before command line

like image 605
TroodoN-Mike Avatar asked Oct 18 '25 06:10

TroodoN-Mike


1 Answers

You need to set your prompt variable (PS1). Something like the following should get you going:

<~/temp>$ export PS1="[\$(date +%k:%M)]> "
[12:16]> 
like image 128
jaypal singh Avatar answered Oct 19 '25 22:10

jaypal singh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!