How to clear history logs of all terminal sessions


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to clear history logs of all terminal sessions
# 1  
Old 09-04-2010
How to clear history logs of all terminal sessions

Hi,

I would normally clear off the history entries from a terminal by using the following commands:

Code:
> ~/.bash_history
history -c

But this will remove the entries of that particular session only. How to prune all the entries of all login sessions for a particular user in a system?

N.B: I do not want to delete ~/.bash_history file.
# 2  
Old 09-04-2010
open a session with Ctrl+Alt+F[1-9] and login as root.
mv /home/user/.bash_history /home/user/bash_history.org
or you could date it with
mv /home/user/.bash_history /home/user/bash_history.org-`date '+%l:%M:%S %p'` (lower case L)

and have the user logoff|on.
done.

HTH
# 3  
Old 09-05-2010
Quote:
Originally Posted by Habitual
open a session with Ctrl+Alt+F[1-9] and login as root.
mv /home/user/.bash_history /home/user/bash_history.org
or you could date it with
mv /home/user/.bash_history /home/user/bash_history.org-`date '+%l:%M:%S %p'` (lower case L)

and have the user logoff|on.
done.

HTH
Thank you for the tips. Hope the ~/.bash_history would be created again when I logged in to the system with the user's credentials
# 4  
Old 09-06-2010
It will get re-created.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Clear history in ksh

Hi Am using ksh shell I need to remove history of commands used.. I tried # rm .vi_history # touch .vi_history # chmod 600 .vi_history This didnt work.. I tried also # rm .sh_history # touch .sh_history # chmod 600 .sh_history (5 Replies)
Discussion started by: Priya Amaresh
5 Replies

2. Shell Programming and Scripting

how to clear history in ksh?

I want to clear the history so that no one should be able to see what commands I gave in the AIX OS level. I tried using history -c , ~/.sh_history, but they aren't working :wall: Please tell me the command in ksh which can clear all the previous history? (4 Replies)
Discussion started by: lg123
4 Replies

3. Shell Programming and Scripting

Command to clear logs for every 6 hours in solaris

Hi Folks, I need to remove log files for six hours on Solaris. before i used to do for every 24 hours below is the code for 1 day older log files, now i tried using -mmin +360 but it says command not found. Can someone please help me out!!! part of the code: LOG_FILE=`find /home/Logdir... (1 Reply)
Discussion started by: Sendhil.Kumaran
1 Replies

4. UNIX for Dummies Questions & Answers

How to clear history in Linux

Hello All, Good Morning. I am trying to erase history list in my linux box, but my below command is failing. What is the actual way to clear it? > history clear -bash: history: clear: numeric argument required Also when I run my commands in my command prompt, my team lead can see my... (7 Replies)
Discussion started by: NARESH1302
7 Replies

5. UNIX for Dummies Questions & Answers

Losing Command History from Prior Sessions

We are running AIX. Shell is ksh. I used to have the ability to recall commands from prior sessions using <exc> k. Now, suddenly, I only can recall commands run during the current session. When I start a session, I have no command history. Also, when I run the shell command from a current... (1 Reply)
Discussion started by: boylepeterj
1 Replies

6. Solaris

how to clear command history

hi Any one can help me. I am using Sun_Solaris. The command history set to 100 at .cshrc. I am unable to clear the command histoy. In Linux it is very easy by giving command history -c I could not find any such type command to clear the history. Is there any such type of command for solaris.... (3 Replies)
Discussion started by: prabir
3 Replies

7. UNIX for Dummies Questions & Answers

how to clear history

Hi... i have one doubt pls... 1)can we clear the command line history in UNIX for a paricular login(scadm/root)if so how?. 2) can we see the time at which command executed. history is showing like : 100 display 101 lock 102 exit (7 Replies)
Discussion started by: gincemathew
7 Replies

8. UNIX for Dummies Questions & Answers

terminal sessions and certs

Hello a few Q's that if anyone knows the answer to i would be grateful: :confused: when exiting a terminal session run through a windows environment i can either type exit or use ctrl +D. I was wondering if one way was a 'cleaner' method to exit then the other or whether it is executed the... (2 Replies)
Discussion started by: hu$h
2 Replies

9. UNIX for Advanced & Expert Users

clear passwd history without ...

how do I clear passwd history of a user without compromising the audit trail for security? in a nutshell, user abc wants to re-use his passwd ( he is not savvy with computers ) (4 Replies)
Discussion started by: A Stewart
4 Replies

10. UNIX Desktop Questions & Answers

Clear logs in unix sco 5.0.4

hi my name es juan i have sco open server 5.0.4 release i need clear the log files as wtmp thanks you very much (1 Reply)
Discussion started by: jtapia
1 Replies
Login or Register to Ask a Question