SaveSnippets
Community
Pricing
Sign In
Get Started
Community
Public Snippets
2
Code shared by the SaveSnippets community — browse, copy, and get inspired.
All Languages
Bash
Go
HTML
Java
JavaScript
Kotlin
PHP
Python
Rust
SQL
TypeScript
#port
Clear
Tags
#php
#kotlin
#bash
#go
#sql
#rust
#typescript
#html
#java
#python
#files
#utils
#strings
#http
#concurrency
#async
#json
#arrays
#security
#types
#crypto
#database
#dates
#format
Bash
Check If Port Is Open
Several ways to probe a remote port: nc (most portable), bash's /dev/tcp pseudo-device (zero deps), or curl. Pick by what's available.
#bash
#network
#port
#tcp
#health-check
Bash
Kill Process by Port
When a port is "already in use" — find the offending process and (carefully) kill it. `lsof` is the gold standard; `ss` is the lighter modern alternative.
#bash
#processes
#kill
#port
#lsof