Rate this page del.icio.us  Digg slashdot StumbleUpon

Video tip from RHCEs: Closing TCP sockets without reboot

by the editorial team

Download this video: [Ogg Theora]

Video by Colby Hoke. Produced by Jim Haverkamp.

We bring the advice of experts straight from San Diego to your desktop.

Red Hat Summit 2007 collected hundreds of Linux users all in one place–many of them experienced Red Hat Certified Engineers® (RHCE). And somewhere between all those smart people walking around–and our video crew shooting footage–the idea for some video tips was born.

This first tip is from Chad Lucas. Look for more in the coming weeks.

The information provided in this article is for your information only. The origin of this information may be internal or external to Red Hat. While Red Hat attempts to verify the validity of this information before it is posted, Red Hat makes no express or implied claims to its validity.

6 responses to “Video tip from RHCEs: Closing TCP sockets without reboot”

  1. Smitty says:

    lsof - old school ??, what other tool would one use to list open files. I think Chad should re-read the lsof man page. He would discover that lsof can filter the file type for socket connections (and even a particular socket type and port) and can provide the pid (or ppid).

    The output of this can then be sent to kill by way of backquotes (as in the example in the lsof man page.

    In short Chad has made a simple problem complicated.

  2. Olivier says:

    You can also add -p to netstat (eg. “netstat -nap”).

  3. John Call says:

    Smitty:

    maybe you could provide us an example of your simplified process. You know, for us K-12 schoolers that are still RHCTs.

    Thanks!
    John

  4. Smitty says:

    John - as a trivial example:

    imagine you want to kill anything listening on TCP port 80

    kill -HUP `lsof -t -i TCP:80`

    I won’t be wiping your nose for you, though.

    RTFMP

  5. David Michaels says:

    Nice tip… I rebooted last time… I didn’t think of lsof off the top of my head… live and learn…

    Thanks,
    dm

  6. Sami Ben Younes says:

    A great command with many features .

    [root@homepc ~]# ss -h
    Display the listening sockets including process and its PID in numeric format :
    [root@homepc ~]# ss -n -p -l
    Then use kill -HUP [PID] to stop the service .

    Regards

Leave a reply