LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-08-2005, 02:32 AM   #1
varunbihani
Member
 
Registered: Jul 2003
Location: indore, india
Posts: 69

Rep: Reputation: 15
explain this command please


Please help me with this command..
How is it being used, what does it do... how is pipe being used here etc..

lsof | grep IPv | grep 3001 | awk '{print $2}' | xargs -l -i kill -9 {}
 
Old 07-08-2005, 02:47 AM   #2
chakkerz
Member
 
Registered: Dec 2002
Location: Brisbane, Australia
Distribution: a few...
Posts: 654

Rep: Reputation: 32
well first it runs lsof (lists open files)

then it extracts from the lsof output only the likes with IPv in them

then it extracts from those selected lines all the lines that contain 3001

then it uses these remaining lines are pattern scanned by awk, which extracts the second element from each line and pipes that to xargs

xargs then sends all of that to the kill command, which terminates the pid extracted with a -9

as far as what does it do well i'm guessing much the same as fuser for instance:

it determines what programs have certain resources open. In this case the resurces are IPv identified, and the 3001 (from shady memory of reading a book two weeks ago is a certain IPv6 address group, but i could be hella wrong about that).

finally it takes the information of what programs have stuff open and terminates the associated program.

Finally piping is used to filter out the resources we are interested in, then identify the program id and lastly kill it, so the pipes perpetuate data amongst programs
 
Old 07-08-2005, 03:00 AM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Re: explain this command please

Quote:
Originally posted by varunbihani
Please help me with this command..
How is it being used, what does it do... how is pipe being used here etc..

lsof | grep IPv | grep 3001 | awk '{print $2}' | xargs -l -i kill -9 {}
Ummm ... why don't you ask in the post where you got
that response? :P

http://www.linuxquestions.org/questi...hreadid=340825



Cheers,
Tink
 
Old 07-08-2005, 03:08 AM   #4
frandalla
Member
 
Registered: Oct 2003
Location: Tokyo - Japan
Distribution: Slackware
Posts: 348
Blog Entries: 1

Rep: Reputation: 37
you're mean Tinkster =p
 
Old 07-08-2005, 03:19 AM   #5
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally posted by frandalla
you're mean Tinkster =p
How's that? By pointing out to him that he should
stick to the rules and remain within the original thread
he created? That aside that's none of your business ;)


Cheers,
Tink
 
Old 07-08-2005, 03:31 AM   #6
chakkerz
Member
 
Registered: Dec 2002
Location: Brisbane, Australia
Distribution: a few...
Posts: 654

Rep: Reputation: 32
LOL ... yeah you are mean Tinkster

hee hee hee

so did i get that right anyways ? I don't really know awk...

Last edited by chakkerz; 07-08-2005 at 03:32 AM.
 
Old 07-08-2005, 03:39 AM   #7
varunbihani
Member
 
Registered: Jul 2003
Location: indore, india
Posts: 69

Original Poster
Rep: Reputation: 15
I am sorry for that.. but I could not find that previous posting in the forum...

I am really sorry...
 
Old 07-08-2005, 03:46 AM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
You could, for instance, use the search
and entered your username in the "Search by user name" field.

The search feature is actually very valuable ;)


Cheers,
Tink
 
Old 07-08-2005, 03:47 AM   #9
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Quote:
Originally posted by chakkerz
LOL ... yeah you are mean Tinkster

hee hee hee

so did i get that right anyways ? I don't really know awk...
And yeah, I did. Works well, and saves running fuser twice for
tcp and udp (he didn't mention which it was).



Cheers,
Tink
 
Old 07-09-2005, 02:48 AM   #10
chakkerz
Member
 
Registered: Dec 2002
Location: Brisbane, Australia
Distribution: a few...
Posts: 654

Rep: Reputation: 32
w00!
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
can someone explain this? SteveGodfrey Linux - Wireless Networking 1 05-28-2004 08:47 AM
can someone explain what the mail command does? ludwig W Linux - Software 10 05-17-2003 11:46 PM
Can anyone explain... GoboFraggle Programming 1 02-06-2003 02:33 AM
Can someone explain this ? beyond_2000 Linux - Hardware 6 10-08-2002 06:02 PM
Can someone please explain this trentk Linux - General 6 09-25-2002 12:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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