|
Home > Archive > Unix administration > September 2004 > How to clear history of commands in unix
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to clear history of commands in unix
|
|
| astrorail 2004-09-08, 5: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
| |
| Stephane CHAZELAS 2004-09-08, 5: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
| |
| astrorail 2004-09-08, 5: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
| |
| Dave Hinz 2004-09-08, 5: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?
| |
| Laurenz Albe 2004-09-09, 2: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
| |
| Stephane CHAZELAS 2004-09-09, 7:52 am |
| 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
|
|
|
|
|