473,479 Members | 2,128 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to get the timestamp of a command in history?

dlite922
1,584 Recognized Expert Top Contributor
Hey guys,

An idea just came to my head. I ran some command on my host sometime in early January.

Is there a way to find out when exactly that command was run WITHOUT looking at secondary evidences (such as the timestamp of a file that command may have produced).

For example if I run ls, find, or grep and they exist in my command history. Is there a way, with a standard debian linux install, to find when that command was run?

I'm assuming the answer is a big fat 'NO', but I'm curious anyway.

:)

Cheers!


Dan
Jan 26 '11 #1
3 6469
sicarie
4,677 Recognized Expert Moderator Specialist
If you want it going forward you can modify the log format to do so.

If the command is still running you can check the options of process information commands (things like ps, etc...)
Jan 27 '11 #2
dlite922
1,584 Recognized Expert Top Contributor
ls,find,cat don't log by themselves.

Going forward I could just type 'date' before and after each command :) Going back through your history, you know when you ran what.

DM
Jan 27 '11 #3
tgmerritt
1 New Member
You cannot go back and get timestamps of commands that were already run, but you can add the following to your bash_profile in order to have history timestamp things going forward:

export HISTTIMEFORMAT="%F %T "

And then of course on your next login this will be exported.

You'll get output like this:

999 2011-08-24 10:12:02 vi .bash_profile
Aug 24 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6291
by: Christoph Becker-Freyseng | last post by:
Hello, is there a way to dump (and save) the command-history of the python interactive mode. Thanks, Christoph Becker-Freyseng
9
2261
by: Nicola Mingotti | last post by:
Hello , I'm tring Python 2.3 ( on source and binary distribution , on Linux and Windows ) and i think the command history doesn't work . When i use the Up-Arrow in Python2.3 started in an...
4
1912
by: Chris | last post by:
Since I've installed (from sources) Python 2.3.4 on SuSE 8.2 the command history is not working anymore. When I press the cursor keys I get ^[[A or ^[[B .... I also tried to install IPython but...
2
1766
by: Mel | last post by:
is there a way to disable text field history from poping up when the user enters a command that is already in the hitsory cache ? i know i can turn it off from WinDoze preferences. can...
0
1272
by: Leo | last post by:
Does someone know if there is a setting in the python Unix world to make the command history behave as it does in the Windows intepreter? Specifically, I like the fact that the command history...
2
2273
by: vbfoobar | last post by:
Hello, My question is: Is there an easy mean to make Python "command history" persistent across interpreter invokations? PS: In the case the question above is not clear, I rephrase it below...
1
4076
by: Sakcee | last post by:
this has been a problem for me for some time. I want to save the interpretters command history to a file, there is a history file in my user directory .pyhistory but it saves only like 500 or so...
1
3250
by: Stefan Bellon | last post by:
Hi all! I'm embedding Python in my own C (or rather Ada, but via the C interface) program. Everything runs fine. But I have a small question regarding command history. Let's take the simplest...
6
1924
by: ThomasC | last post by:
Hello, How to configure Python2.5's interactive interpreter to get command history ? I always got ^[[A and ^[[B . Thank you !! Thomas#
0
7019
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7067
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6719
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
6847
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5312
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
2980
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
2970
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
555
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
166
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.