LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   explain this command please (https://www.linuxquestions.org/questions/linux-general-1/explain-this-command-please-341183/)

varunbihani 07-08-2005 02:32 AM

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 {}

chakkerz 07-08-2005 02:47 AM

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

Tinkster 07-08-2005 03:00 AM

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

frandalla 07-08-2005 03:08 AM

you're mean Tinkster =p

Tinkster 07-08-2005 03:19 AM

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

chakkerz 07-08-2005 03:31 AM

LOL ... yeah you are mean Tinkster

hee hee hee

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

varunbihani 07-08-2005 03:39 AM

I am sorry for that.. but I could not find that previous posting in the forum...

I am really sorry...

Tinkster 07-08-2005 03:46 AM

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

Tinkster 07-08-2005 03:47 AM

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

chakkerz 07-09-2005 02:48 AM

w00!


All times are GMT -5. The time now is 07:27 AM.