LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 01-13-2014, 09:47 AM   #1
albana
LQ Newbie
 
Registered: Jan 2014
Posts: 8

Rep: Reputation: Disabled
how to clean a command


i have showed the history of shell commands $history how can i delete all comands who arent in /bin
 
Old 01-13-2014, 10:20 AM   #2
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,979
Blog Entries: 1

Rep: Reputation: 209Reputation: 209Reputation: 209
Something like this...(you may have to play around with this command as I'm doing it on the top of my head)

Code:
for hist in $(history | grep -v "/bin" | awk '{print $1}'); do history -d ${hist}; done
 
1 members found this post helpful.
Old 01-13-2014, 10:39 AM   #3
albana
LQ Newbie
 
Registered: Jan 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
thank you
 
Old 01-13-2014, 10:42 AM   #4
albana
LQ Newbie
 
Registered: Jan 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Unhappy

i am just a begginer in linux can u please be more precisious
 
Old 01-13-2014, 03:45 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Quote:
precisious ???
Can you perhaps re-phrase that sentence?
 
1 members found this post helpful.
Old 01-13-2014, 04:21 PM   #6
albana
LQ Newbie
 
Registered: Jan 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
Unhappy never mind about that

Can u please tell me how can I show in the screen the list with the remaining commands?(sorry for my english)
 
Old 01-14-2014, 06:08 AM   #7
albana
LQ Newbie
 
Registered: Jan 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
if there are no commands in the list

and it requires to show in the screen an appropriate message?
 
Old 01-14-2014, 06:38 AM   #8
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,830

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
have you tried the command history?
 
1 members found this post helpful.
Old 01-14-2014, 09:38 AM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,633

Rep: Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965Reputation: 7965
Duplicate of http://www.linuxquestions.org/questi...14#post5097814 Appears to be homework question.
 
Old 01-14-2014, 10:17 AM   #10
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Originally Posted by albana View Post
i have showed the history of shell commands $history how can i delete all comands who arent in /bin
Simpy use, history -c command.
Code:
~$ history -c
 
  


Reply



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
Command to clean tmp at shutdown rng Slackware 43 08-02-2013 06:00 AM
The sound stops working after the make clean command turf Fedora 1 12-17-2009 12:54 PM
Clean up Run Command (ALT + F2) jacatone Linux - Newbie 6 05-11-2009 08:19 PM
clean command line history basilogics Linux - Newbie 9 11-04-2005 04:25 AM

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

All times are GMT -5. The time now is 10:17 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