How to clear history of commands in unix
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix administration > How to clear history of commands in unix




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    How to clear history of commands in unix  
astrorail


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-08-04 10:55 PM

Hi users,

I would like to clear the history of commands I typed in the shell. I
did some research and concluded that the history of commands are in
the .sh_history file.

So I removed the file .sh_history. But still when I type h, i see a
history of commands.

Could anyone tell me what to do to clear the history of commands.

Second question is how can I find out which unix shell I am working
on?

Thanks
astrorail





[ Post a follow-up to this message ]



    Re: How to clear history of commands in unix  
Stephane CHAZELAS


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-08-04 10:55 PM

2004-09-8, 09:10(-07), astrorail:
> I would like to clear the history of commands I typed in the shell. I
> did some research and concluded that the history of commands are in
> the .sh_history file.
>
> So I removed the file .sh_history. But still when I type h, i see a
> history of commands.
>
> Could anyone tell me what to do to clear the history of commands.

If your shell is zsh,
HISTSIZE=0

Or, just restart your shell:

exec "$0"
(after having removed your history file).

> Second question is how can I find out which unix shell I am working
> on?
[...]

ps
or
printf '%s\n' "$0"

should give an indication.

--
Stephane





[ Post a follow-up to this message ]



    Re: How to clear history of commands in unix  
astrorail


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-08-04 10:55 PM

Hi stephane,

my shell is tcsh.
i restarted the shell but the h command still shows the history
commands. May be I am not deleting the proper history file.

I have deleted the .sh_history file.

exec "$0" returns with a message
-tcsh: Command not found.

help,

astrorail






[ Post a follow-up to this message ]



    Re: How to clear history of commands in unix  
Dave Hinz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-08-04 10:55 PM

On 8 Sep 2004 09:10:30 -0700, astrorail <srinee@gmail.com> wrote:
> Hi users,
>
> Could anyone tell me what to do to clear the history of commands.

Why would you want to do that?  If it's your system, there's nothing
in there that you would want to hide, and if it's not your system,
why are you doing things you'd want to hide?

> Second question is how can I find out which unix shell I am working
> on?

echo $SHELL works on some, most, or all unixes.  Are you using any
particular one?







[ Post a follow-up to this message ]



    Re: How to clear history of commands in unix  
Laurenz Albe


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-09-04 07:48 AM

astrorail <srinee@gmail.com> wrote:
> exec "$0" returns with a message
> -tcsh: Command not found.

grep $LOGNAME /etc/passwd|awk -F: '{ print $7 }'

This will tell you how to invoke your shell.

> my shell is tcsh.
> i restarted the shell but the h command still shows the history
> commands. May be I am not deleting the proper history file.

Look at the man page of your shell to find out about command history.

Yours,
Laurenz Albe





[ Post a follow-up to this message ]



    Re: How to clear history of commands in unix  
Stephane CHAZELAS


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
09-09-04 12:52 PM

2004-09-8, 10:51(-07), astrorail:
> my shell is tcsh.
> i restarted the shell but the h command still shows the history
> commands. May be I am not deleting the proper history file.
>
> I have deleted the .sh_history file.
>
> exec "$0" returns with a message
> -tcsh: Command not found.
[...]

Yes, $0 is -tcsh because it's a login shell.

Use

exec tcsh

(note that I doubt tcsh history file is named .sh_<something>.
Check your tcsh man page. Note you'll often find recommended to
switch to a Bourne like shell, and zsh is a best choice then,
especially when you're a former (t)csh user).

--
Stephane





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 10:03 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register