Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I have the current time printed in my prompt, which means I can easily see how long commands took to run, eg:

    [start time] $ ./run_long_script
    [ end time ] $
My actual prompt looks like:

    [09:36] bmd-mba|bmd ~
    $ whoami
    bmd
    [09:36] bmd-mba|bmd ~
    $
Details in https://github.com/coderholic/config/blob/master/.bash_profi...


Actually with that setup (which is a bit like mine) you can see how long it took from the finishing time of the last command you executed (when your PS1 was redisplayed) to the finishing of the command you just executed.


Is there a way to do this so the timestamp includes seconds? Thanks.


By default "\t" in your PS1 will display the time the same way `date +%H:%M:%S` does (which includes seconds).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: