LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to clear the output of history command (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-clear-the-output-of-history-command-653059/)

jeff80 07-02-2008 07:19 AM

How to clear the output of history command
 
Hello

How can I clear the output of history command, ctrl+l clears the screen not the output of history command, so is there anyway that history command does not show the previously executed commands.

And also please let me know how I can kill Zoombie processes.

Thank you

Regards!
Jeff80

colucix 07-02-2008 07:36 AM

Code:

history -c
to clear all the history entries. Regarding the zombie processes, they are child processes whose parent does not receive notification about their fate anymore. The only way to kill them (without rebooting) is to quit or kill the parent process. To verify the hierarchy of the processes, you can try the command
Code:

ps -eO user -H
find the processes in a <defunct> status and quit or kill their parent (if possible).

jeff80 07-02-2008 08:21 AM

Hello

Thanks a lot

trist007 07-02-2008 08:30 AM

Go to your home directory and type this in terminal

echo > .bash_history

Mr. C. 07-02-2008 06:11 PM

Quote:

Originally Posted by colucix (Post 3201401)
... Regarding the zombie processes, they are child processes whose parent does not receive notification about their fate anymore. The only way to kill them (without rebooting) is to quit or kill the parent process. To verify the hierarchy of the processes, ..

Almost, but not quite. The parent is sent a SIGCHLD when the child dies/exits. The parent must perform a wait() system call to collect the child's status. The defunct zombie process contains essentially that status, but little more; resources have been freed. The signal is sent; the parent may or may not handle the signal, and may or may not reap the child's status. When a parent exits before handling its children via wait(), the init process inherits the child status and usually cleans up properly.

colucix 07-02-2008 06:15 PM

Thank you, Mr. C. for the detailed explanation. Something new to learn every day!

Mr. C. 07-02-2008 06:22 PM

Quote:

Originally Posted by trist007 (Post 3201457)
Go to your home directory and type this in terminal

echo > .bash_history

This will delete the history that will be loaded when the next shell starts, but exiting the current shell will place its current history list back into the file.

The key point is that there is both an in core history for each shell process, and on disk history loaded by newly started shells. Unsetting the HISTFILE shell variable will prevent saving to .bash_history. And preceding a command with a space will prevent that command from entering the history (if HISTCONTROL is set to ignorespace). See the variables in man bash that start with HIST.

BHABANIPRASADPATI 08-01-2009 02:30 AM

ps -eO user -H
 
I used the command in bash prompt as
bash#ps -eO root -H

illegal option --H

what's the mistake I m doing & was that alphabet "O" in caps or digit Zero (0) .

colucix 08-01-2009 02:55 AM

Quote:

Originally Posted by BHABANIPRASADPATI (Post 3627398)
I used the command in bash prompt as
bash#ps -eO root -H

illegal option --H

what's the mistake I m doing & was that alphabet "O" in caps or digit Zero (0) .

It is the alphabet o uppercase, but you can't use "root" as argument. Here "user" is a keyword. If in your version of ps the -H option is not valid, you can try -f instead.

BHABANIPRASADPATI 08-02-2009 01:38 PM

Thanks
 
Thanks Dude..
It worked.. I will kill these stray processes when my system will slow down. or lack resources...

catkin 08-02-2009 02:04 PM

Hello jeff80 :)

Best keep to one topic per thread, else we gets confuzzled.

What is "the history command" that you want o clear the output from? The answers you've been given tell you how to clear the file that records the history but I'm not sure that's what you were asking for.

If you get an old command on your screen, typically by using the up arrow, you can get rid of it by Ctrl+C.

Best

Charles


All times are GMT -5. The time now is 03:54 AM.