LinuxQuestions.org
Help answer threads with 0 replies.
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, 10: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, 11:20 AM   #2
custangro
Senior Member
 
Registered: Nov 2006
Location: California
Distribution: Fedora , CentOS , RHEL
Posts: 1,969
Blog Entries: 1

Rep: Reputation: 208Reputation: 208Reputation: 208
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, 11:39 AM   #3
albana
LQ Newbie
 
Registered: Jan 2014
Posts: 8

Original Poster
Rep: Reputation: Disabled
thank you
 
Old 01-13-2014, 11: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, 04:45 PM   #5
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Quote:
precisious ???
Can you perhaps re-phrase that sentence?
 
1 members found this post helpful.
Old 01-13-2014, 05: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, 07: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, 07:38 AM   #8
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian i686 (solaris)
Posts: 8,104

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

Rep: Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689Reputation: 3689
Duplicate of http://www.linuxquestions.org/questi...14#post5097814 Appears to be homework question.
 
Old 01-14-2014, 11: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


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


All times are GMT -5. The time now is 08:42 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration