How to delete history for a particular user


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users How to delete history for a particular user
# 1  
Old 01-15-2009
How to delete history for a particular user

Hi All,

Whenever I log in to my terminal and execute some cmds and then I type "history", I get the list of all the commands that I have executed.

I want to know where is the history been stored (any path location ?)
Secondly,if I want to delete the history or some part of the history, can I do it ? If yes, how?

Thanks and Regards,
Shubhranshu.
# 2  
Old 01-15-2009
If your shell is bash, execute 'man builtins'. Search for 'history'.
# 3  
Old 01-15-2009
Generally you dont have permission for execute this operations, only a Superuser. Search your ./bash_history if you have bash, and delete them if you can.
# 4  
Old 01-15-2009
In KSH, the the location of the history file is based on the HISTFILE variable. Usually, you set this variable to your home directory.
ie. HISTFILE=~/.history
# 5  
Old 01-16-2009
default for ksh ist .sh_history and for bash .bash_history in your home directory

logout, log in and use ">.sh_history" for example
# 6  
Old 01-20-2009
Thanks for the answers...

I got the file .. mine is in bash so I got the .bash_history file
I removed the contents of the file.

hyper20:~ 22> cat .bash_history
hyper20:~ 23>


but then when I agian type the command history :- it is still showing the history of commands executed Smilie

==========
hyper20:~ 23> history
1 1:53 showbl
2 2:05 cd
3 2:05 while [1]
4 2:10 while {1}
5 2:10 while [ 1 ]
6 2:13 pwd
7 2:13 cd
8 2:14 ls -a
9 2:14 vi .bash_history
10 2:14 ll .bash_history
11 2:16 env | grep HISTFILE
12 2:16 env
13 2:17 ls -a
14 2:18 vi .bash_history
15 2:18 history
16 2:18 vi .bash_
17 2:18 vi .bash_history
18 2:19 vi .bashrc
19 2:19 vi .viminfo
20 2:19 history
21 2:19 ll -a
22 2:19 cat .bash_history
23 2:20 history
===============

Could you please help me in this as to how still I am getting the history ?

Thanks.
# 7  
Old 01-20-2009
Thanks for the answer...

I got the file .. mine is in bash so I got the .bash_history file

I removed the contents of the file.

hyper20:~ 22> cat .bash_history
hyper20:~ 23>

but then when I agian type the command history :- it is still showing the history of commands executed

==========

hyper20:~ 23> history
1 1:53 showbl
2 2:05 cd
3 2:05 while [1]
4 2:10 while {1}
5 2:10 while [ 1 ]
6 2:13 pwd
7 2:13 cd
8 2:14 ls -a
9 2:14 vi .bash_history
10 2:14 ll .bash_history
11 2:16 env | grep HISTFILE
12 2:16 env
13 2:17 ls -a
14 2:18 vi .bash_history
15 2:18 history
16 2:18 vi .bash_
17 2:18 vi .bash_history
18 2:19 vi .bashrc
19 2:19 vi .viminfo
20 2:19 history
21 2:19 ll -a
22 2:19 cat .bash_history
23 2:20 history
===============


Could you please help me in this as to how still I am getting the history ?



Thanks.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 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. 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

3. Solaris

Command History for a user with IP details

Hi We are sharing our envoirnment with our component teams. the plateform is SunOS 5.8 Generic_117350-41 sun4u sparc SUNW,Sun-Fire-V490. All team logs in the domain with same user and perform activities. Now for the system auditing purpose can somebody guide me how can I get the details when... (6 Replies)
Discussion started by: sukhvinder_Tm
6 Replies

4. Shell Programming and Scripting

Create a script that executes when a user attempts to delete history logs

Hi, I have a linux redhat 9 server and I am concerned about the security on that server. I would like to be able to write a script that records all the commands that were typed at the command prompt before the user calls the 'history -c' command and deletes all the history. I was thinking about... (4 Replies)
Discussion started by: mishkamima
4 Replies

5. Shell Programming and Scripting

access user history as root

Hi, I need to access a user's command history. However, the dilemma is that he is logged in and so his current history is not yet flushed to .bash_history file which gets flushed when he logs out. Is there a way I can still access his most recent history? thank you, S (4 Replies)
Discussion started by: sardare
4 Replies

6. UNIX for Dummies Questions & Answers

User History

How do I pipe serveral commans that will list only the user ids, sort the output, and remove any duplice name entries for those that have logged in in the past month? Thanks! (1 Reply)
Discussion started by: CasperQuiet
1 Replies

7. UNIX for Advanced & Expert Users

How to access all user history file

Team , using fc command we can get details of our history file .. Is it possible to get the same result for different user from root.. Actually I need to collect all the stuff from select users history file for day to day basis. thanks in advance .. (2 Replies)
Discussion started by: rgpai9972
2 Replies

8. UNIX for Dummies Questions & Answers

User History and commnad log

Dear All I had a UNIX ( Sun solaris ) os. There are many user on that server. Now i want to find during last week who had log in to the sever and which commnad are executed by them? I also want to from which IP they had log in to the server. Is there any log file generated for user in... (5 Replies)
Discussion started by: jaydeep_sadaria
5 Replies
Login or Register to Ask a Question