Check SSH Status on Ubuntu | Generated by AI

Home 2026.02

Question: How can I check whether the SSH service is running/open on my Ubuntu system?

Answer:

Here are the most reliable and commonly used ways to check if SSH (usually OpenSSH server) is running and listening on your Ubuntu machine (2024–2026 editions):

  1. Check service status (most recommended)
sudo systemctl status ssh

or

systemctl status ssh

Look for these key lines:

Alias note: on Ubuntu the service is usually called ssh (not sshd)

  1. Even shorter – just check if it’s active
systemctl is-active ssh

Output:

  1. Check if SSH port is listening (very reliable)
# Most popular & clean way (recommended)
ss -tuln | grep :22

# Alternative commands (all work)
sudo netstat -tuln | grep :22
sudo lsof -i :22
sudo ss -tuln  | grep ':22.*LISTEN'

If you see output similar to this → SSH is listening:

tcp   LISTEN 0      128          0.0.0.0:22        0.0.0.0:*
# or
tcp   LISTEN 0      128             [::]:22           [::]:*

No output → SSH is not listening (either not installed or not running)

One-line “am I reachable via SSH right now?” checks

# Method A - very clear
sudo systemctl is-active --quiet ssh && echo "SSH is RUNNING" || echo "SSH is STOPPED"

# Method B - port check style
ss -tuln | grep -q ':22 ' && echo "Port 22 is OPEN" || echo "Port 22 is CLOSED"

Summary – fastest commands to remember

Command What it tells you Recommendation
systemctl is-active ssh Running or not ★★★ best daily check
ss -tuln \| grep :22 Actually listening on port 22 ★★★ very trustworthy
sudo systemctl status ssh Full status + recent logs Best when something is wrong

Bonus – If you want to see from outside

Run this from another computer:

# Replace 192.168.1.100 with your Ubuntu machine's IP
nc -zv 192.168.1.100 22

Output:

Pick whichever style you like most — most Ubuntu users just use:

systemctl is-active ssh && ss -tuln | grep -q :22 && echo "SSH looks good ✓" || echo "SSH has problem ✗"

References:


Back Donate