2

im trying to print the current time and date to the screen each time a command is issued on sift linux (ubuntu 14) via command line.

so for example

sansforensics@siftworkstation:$ fdisk -l image.dd sansforensics@siftworkstation:$ output of command current time and date sansforensics@siftworkstation:$ 

im not looking for

start_time=`date +%s` <command-to-execute> end_time=`date +%s` echo execution time was `expr $end_time - $start_time` s. 

which prints out the time it took for the commands to run, im looking for the current date and time each time a command is issued.

1 Answer 1

3

You are looking for PROMPT_COMMAND here:

PROMPT_COMMAND='date' 

As per man bash:

PROMPT_COMMAND If set, the value is executed as a command prior to issuing each primary prompt. 
Sign up to request clarification or add additional context in comments.

1 Comment

That's perfect thank you! been trying to find this for an hour.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.