Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the timestamp of each command line in my terminal history?

I would like to know how long a command that I entered into my terminal has been running. It would be great to be able to get the timestamp of every command in my history. Let me know if you need any more information in order to be able to answer this question. Thanks.

EDIT: I am using a bash terminal.

like image 955
abw333 Avatar asked Jan 24 '13 02:01

abw333


People also ask

How can I see all command line history?

Here's how: Open Start. Search for Command Prompt, and click the top result to open the console. Type the following command to view the command history and press Enter: doskey /history.

How do I turn on time stamp history?

To enable timestamp in Bash history in Linux, you need to set the HISTTIMEFORMAT environment variable. This variable is used to print the timestamp associated with each displayed history entry. Here, the %F option is used to display the date in YYYY-MM-D D (Year-Month-Date) format.

How do I get terminal command history?

To view your entire Terminal history, type the word “history” into the Terminal window, and then press the 'Enter' key. The Terminal will now update to display all the commands it has on record.


1 Answers

Assuming you are using command prompt

HISTTIMEFORMAT="%d/%m/%y %T "

then

history

http://www.cyberciti.biz/faq/unix-linux-bash-history-display-date-time/

like image 55
Hitman47 Avatar answered Oct 10 '22 06:10

Hitman47