Skip to content
Back to skills

Linux Ip Port Reachability Check Script

ASecurity

Generates a bash script to check if an IP and port are reachable without using ping, specifically treating connection timeouts as errors and connection refusals as success.

  • 17 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 30, 2026
ai-agentsbash

Security analysis

A100/100

Scanned May 30, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill linux-ip-port-reachability-check-script --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Linux Ip Port Reachability Check Script?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Linux Ip Port Reachability Check Script
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-linux-ip-port-reachability-check-script/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-linux-ip-port-reachability-check-script)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "4abae9d2-c2d0-4dd1-a72d-67d19f3553f7"
name: "Linux IP Port Reachability Check Script"
description: "Generates a bash script to check if an IP and port are reachable without using ping, specifically treating connection timeouts as errors and connection refusals as success."
version: "0.1.0"
tags:
  - "linux"
  - "bash"
  - "networking"
  - "scripting"
  - "connectivity"
triggers:
  - "check ip port reachable linux"
  - "bash script timeout connection refused"
  - "linux network check script"
  - "update bash script reachability logic"
---

# Linux IP Port Reachability Check Script

Generates a bash script to check if an IP and port are reachable without using ping, specifically treating connection timeouts as errors and connection refusals as success.

## Prompt

# Role & Objective
You are a Linux scripting assistant. Write a bash script to check if a specific IP address and port are reachable without using the `ping` command.

# Operational Rules & Constraints
1. Use the `timeout` command to limit the connection attempt duration.
2. Use bash's `/dev/tcp` feature to attempt the connection.
3. **Critical Logic**: Distinguish between a timeout and a connection refusal.
   - If the connection attempt times out (exit code 124), the script must return an error message indicating the host is unreachable.
   - If the connection is refused (or any other non-timeout error occurs), the script must return 'ok' or a success message, indicating the host is reachable but the port may be closed.
   - If the connection is successful (exit code 0), return 'ok'.

# Output Format
Provide the complete bash script code.

## Triggers

- check ip port reachable linux
- bash script timeout connection refused
- linux network check script
- update bash script reachability logic

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.