How to review the history and the commands that has been done in this history?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers How to review the history and the commands that has been done in this history?
# 1  
Old 04-17-2011
How to review the history and the commands that has been done in this history?

Hello every body,
Kindly inform me How Do i find out the time I executed a command previously on UNIX Solaris??

To be more specific and more clear about what i want to know is that I want a command the enables me to know the history and which command i run at this history/time.


FYI I used the following command but it did not work with me:
#export HISTTIMEFORMAT=`%F %T`



Thanks in Advance

BR
Ahmed Amer
Cairo,Egypt
# 2  
Old 04-17-2011
You can use the command "history" to show the previous commands.
Check the file ~/.sh_history

regards,
Ahamed
This User Gave Thanks to ahamed101 For This Post:
# 3  
Old 04-17-2011
The the command "history" enables me only to check the command and NOT the date/time of the running time!!!!!
# 4  
Old 04-17-2011
Quote:
Originally Posted by ahmedamer12
The the command "history" enables me only to check the command and NOT the date/time of the running time!!!!!
Code:
# export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S"

or (equal)
Code:
# export HISTTIMEFORMAT="%F %T "

and results
Code:
# history
   36  2011-04-13 23:55:19 history
   37  2011-04-13 23:55:22 history

Code:
# export HISTTIMEFORMAT="%a %b %d %H:%M:%S %Y "

Code:
# history
   36  Çar Nis 13 23:55:19 2011 history
   37  Çar Nis 13 23:55:22 2011 history


regards
ygemici
This User Gave Thanks to ygemici For This Post:
# 5  
Old 04-18-2011
Looks like the HISTTIMEFORMAT doesn't work in ksh. I tried it, no luck. But works in bash though
export HISTTIMEFORMAT="%F %T "
# 6  
Old 04-18-2011
MySQL

BASH
Code:
# export HISTTIMEFORMAT="%F %T "
# history
1001  2011-04-18 23:21:22 history
1002  2011-04-18 23:21:30 export HISTTIMEFORMAT="%F %T "
1003  2011-04-18 23:21:32 history

KSH
Code:
# PS1='$(date "+%F %T"|read -s)# ' 
# history | sed '$!N;s/^\([0-9][0-9]*[\t ]*[0-9][0-9]*-[0-9][0-9]*-[0-9][0-9]*.*\)\n[0-9][0-9]* *\(.*\)/\1 \2/'
602     2011-04-18 23:22:01     ls
604     2011-04-18 23:22:05     ls -l
606     2011-04-18 23:22:07     history

TCSH
Code:
# set history= ( 1500 "%h %Y-%W-%D %P %R\n" )
# history
   14 2011-04-18 23:23:17 ls -l
   15 2011-04-18 23:23:20 history

regards
ygemici
This User Gave Thanks to ygemici For This Post:
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (1 Reply)
Discussion started by: sriky86
1 Replies

2. Shell Programming and Scripting

commands History

how to list all commands history for a username during a certain time ? Maany Thanks (2 Replies)
Discussion started by: Sara_84
2 Replies

3. Shell Programming and Scripting

history commands

Hi Guys, I am running RHEL5, I am trying to find out the history of the cammands that were executed on my server. I have files that are missing I just want to find out what happened to them. I used history | more but I can't find anything related to my query. I also checked... (1 Reply)
Discussion started by: Phuti
1 Replies

4. UNIX for Dummies Questions & Answers

Hiding history of my commands

i have several boxes running either ubuntu, redhat or solaris. there are multiple people with root access on these boxes. i really dont like people looking through my command history, is there a way i can prevent this? what files do i have to edit to prevent anyone from being able to see what... (7 Replies)
Discussion started by: SkySmart
7 Replies

5. UNIX for Dummies Questions & Answers

Clearing history of commands executed

Hi, I have cleared the commands by using >$HOME/.sh_history. But if i issue HISTORY it shows some reference numbers but not the commands executed. But i want to truncate those line numbers too. May i know how i can achieve this? Thanks (1 Reply)
Discussion started by: pandeesh
1 Replies

6. UNIX for Advanced & Expert Users

History to Another file [local user history , but root access]

Hi all, My need is : 1. To know who , when , which command used. 2. Local user should not delete this information. I mean , with an example , i can say i have a user user1 i need to give all the following permissions to user1, : a. A specific directory other than his home... (3 Replies)
Discussion started by: linuxadmin
3 Replies

7. UNIX for Dummies Questions & Answers

Using history of commands to save typing?

Hi, How do I add a history function to my shell? What I mean is if I have used the command: xemacs file.tex, I'd like to be able to type 'x' then use the arrow keys and go through all the commands I've done starting with an 'x'. Thanks! (3 Replies)
Discussion started by: pmasterkim
3 Replies

8. Linux

history of commands

I would like to log all the commands I type (on the terminal) to a file. The command "history" does this only for current terminal only. I typically keep around 10 terminals open. Thanks, j Note: I do not have root access. (2 Replies)
Discussion started by: superuser84
2 Replies

9. Solaris

History commands

Dear What's the command to be executed to retreive all history commands for a specific user? (1 Reply)
Discussion started by: abu_hassan
1 Replies

10. UNIX for Dummies Questions & Answers

Combining elements of different commands in history

What is the correct format for a single command that would combine portions of 2 different lines in the command history? I'm using a C shell. Here's a simplified command history to clarify: 4 rm file1 5 ls -ld file2 file3 file4 6 cat file 5 With the above history, what would be the... (5 Replies)
Discussion started by: Dbyte
5 Replies
Login or Register to Ask a Question