LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-02-2008, 07:19 AM   #1
jeff80
LQ Newbie
 
Registered: Jan 2008
Posts: 12

Rep: Reputation: 0
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
 
Old 07-02-2008, 07:36 AM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
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).
 
Old 07-02-2008, 08:21 AM   #3
jeff80
LQ Newbie
 
Registered: Jan 2008
Posts: 12

Original Poster
Rep: Reputation: 0
Hello

Thanks a lot
 
Old 07-02-2008, 08:30 AM   #4
trist007
Senior Member
 
Registered: May 2008
Distribution: Slackware
Posts: 1,049

Rep: Reputation: 70
Go to your home directory and type this in terminal

echo > .bash_history
 
Old 07-02-2008, 06:11 PM   #5
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Quote:
Originally Posted by colucix View Post
... 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.
 
Old 07-02-2008, 06:15 PM   #6
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Thank you, Mr. C. for the detailed explanation. Something new to learn every day!
 
Old 07-02-2008, 06:22 PM   #7
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 63
Quote:
Originally Posted by trist007 View Post
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.

Last edited by Mr. C.; 07-02-2008 at 06:24 PM.
 
Old 08-01-2009, 02:30 AM   #8
BHABANIPRASADPATI
Member
 
Registered: Aug 2006
Location: ORISSA,INDIA
Distribution: Linux MINT
Posts: 34

Rep: Reputation: 15
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) .
 
Old 08-01-2009, 02:55 AM   #9
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by BHABANIPRASADPATI View Post
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.
 
Old 08-02-2009, 01:38 PM   #10
BHABANIPRASADPATI
Member
 
Registered: Aug 2006
Location: ORISSA,INDIA
Distribution: Linux MINT
Posts: 34

Rep: Reputation: 15
Thumbs up Thanks

Thanks Dude..
It worked.. I will kill these stray processes when my system will slow down. or lack resources...
 
Old 08-02-2009, 02:04 PM   #11
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198Reputation: 1198
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
clear history "last" command nistelrooy Linux - Newbie 10 11-03-2010 12:09 PM
How to clear history hi_msh Linux - Newbie 2 01-12-2006 05:40 AM
history clear command suguname Linux - Newbie 5 03-05-2005 09:32 AM
How do I clear all my RedHat 9 History? PionexUser Linux - General 1 11-20-2003 10:42 AM
Clear History Mystified Linux - Newbie 1 03-25-2002 09:27 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration