Skip to content
List idle open sockets, and optionally close them
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A simple script to list idle open sockets for a process, and optionally close them.

It generates ss command lines to kill the processes. By default it shows them, and can also directly run them.

$ closesocks --help
usage: closesocks [-h] [--verbose] [--debug] [--pid pid] [--idle seconds]

List idle open sockets, and optionally close them

optional arguments:
  -h, --help         show this help message and exit
  --verbose, -v      verbose output
  --debug            debug output
  --pid pid, -p pid  pid to list
  --idle seconds     select connections idle for more than this amount of
                     seconds (default: 3600)
  --force, -f        run the commands instead of listing them
You can’t perform that action at this time.