|
| ||||||||||
| Tags: batch script, command line, redhat, timestamp |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| ||||
| ||||
| How to List command line history with timestamp
|
|
#2
| |||
| |||
| Re: How to List command line history with timestamp
You can use the HISTFILE and HISTFILESIZE variables to keep a command log. History is a common command for shell to list out all the executed commands. It is very useful when it comes to investigation on what commands was executed that tear down the server. If the command line history could provides the date time of the commands being executed, that may really narrow down the scope of the user actions that cause the server malfunction. |
|
#3
| |||
| |||
| Re: How to List command line history with timestamp
You already have such a file in .bash_history and you can call up your previous commands with up arrow. If the command line history could provides the date time of the commands being executed, that may really narrow down the scope of the user actions that cause the server malfunction. When used, this will make libcurl attempt to figure out the timestamp of the remote file, and if that is available make the local file get that same timestamp. By default, history do not append with timestamp, but it is easy to configure it to display timestamp, you just need to set one environment variable HISTTIMEFORMAT. HISTTIMEFORMAT takes format string of strftime. |
|
#4
| |||
| |||
| Re: How to List command line history with timestamp
Check out the strftime manual to choose and construct the timestamp that suit your taste. My favorite is “%F %T “. I would suggest you to put the export into ~/.bash_profile as well as /root/.bash_profile. In case you do not have .bash_profile, you can choose to put into ~/.bashrc. It works on Windows Server 2003 and Windows Vista, however I don't know if non-default regional settings change the behavior of these variables. |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to List command line history with timestamp" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need help with Opera backup list and winrar command line shortcut | Adesh1 | Windows Software | 5 | 06-05-2011 12:01 AM |
| List of Windows XP and Windows Vista Command line Shortcuts | Pyrotechnic | Tips & Tweaks | 6 | 15-10-2010 08:18 AM |
| xcopy command line together with wmplayer command line | Aislinn | Operating Systems | 5 | 31-03-2010 12:13 PM |
| Problem: Command Line Option Syntax Error. Type Command /? For Help | Nadeem | MediaCenter | 3 | 03-09-2009 05:41 PM |
| autorun.inf - shell\..\command with command line parameter doesn'twork | kakii | Windows XP Support | 1 | 18-05-2007 01:24 AM |