An open API service indexing awesome lists of open source software.

https://github.com/isaka-james/closeport

A Linux Tool that forcefully turn off PORTS on your PC.
https://github.com/isaka-james/closeport

close-port closing-ports forcefully linux ports server-administration

Last synced: 7 months ago
JSON representation

A Linux Tool that forcefully turn off PORTS on your PC.

Awesome Lists containing this project

README

          

# Close Port Tool


since 04 Sep,2024

A simple Bash script to identify processes using a specified port, retrieve their process IDs (PIDs), and terminate them. This script requires superuser (sudo) permissions to run.

## Overview

The `closeport.sh` script is designed to help system administrators and users easily manage network ports by terminating any processes that are currently using a specified port.

## Features

- Takes a port number as an argument.
- Identifies if any processes are using the specified port.
- Retrieves the process IDs (PIDs) of these processes.
- Terminates the processes using the specified port.
- Provides feedback on whether any processes were found and terminated or if the port was unused.

## Requirements

- Bash shell
- `sudo` privileges

## Usage

1. **Clone the Repository**

```bash
git clone https://github.com/isaka-james/closeport.git
```

2. **Navigate to the Repository**

```bash
cd closeport
```

3. **Make the Script Executable**

```bash
chmod +x closeport.sh
```

4. **Run the Script**

```bash
sudo ./closeport.sh
```

Replace `` with the port number you want to check and close. For example:

```bash
sudo ./closeport.sh 8080
```

## Example

If the script is run with port `8080` and there is a process using this port, you might see output like:

```
Process with PID 1234 is using port 8080 and has been terminated.
```

If no process is found using the specified port:

```
No process is using port 8080.
```

## Nerd Installation
```bash
sudo chmod +x closeport.sh && sudo mv closeport closeport && sudo mv closeport /usr/bin && echo "Installed successfully!"
```
So now you can type `sudo closeport 8080` to forcefully stop PORT 8080 in your MACHINE.

If you ever feel to uninstall it then type `sudo rm -rf /usr/bin/closeport`

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Author

Isaka James