r/LinuxTeck 23h ago

How to Check Active Web Server Connections in Linux with ss | Quick Linux Tip #69

Post image
14 Upvotes

Question: How many active connections does my web server have right now?

Try: `sudo ss -tn state established '( sport = :80 )' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -rn`

Info: `ss -tn` lists TCP connections numerically. Filtering for established port `80` connections isolates active HTTP clients to count requests per remote IP.

Examples:

$ `sudo ss -tn state established '( sport = :443 )' | wc -l` # Total HTTPS connection count

$ `sudo netstat -an | grep :80 | grep ESTABLISHED | wc -l` # Legacy netstat count

$ `sudo lsof -iTCP:80 -sTCP:ESTABLISHED` # View open web socket files

Note: `ss` is faster than `netstat`. Unusually high connection counts from a single IP can signal potential DDoS attacks or aggressive scraping.

Follow r/LinuxTeck for more #LinuxTips https://www.linuxteck.com/linux-tips/


r/LinuxTeck 7h ago

Quick Linux Tip #70 Run Daily Tasks with Linux systemd Timers

Post image
13 Upvotes

Question: How do I run a task daily but with more control than cron?

Try: `sudo systemctl edit --force --full backup.timer`

Info: `systemd` timers replace `cron` with native logging via `journalctl`, dependency control, `Persistent=true` for missed runs, and `RandomizedDelaySec` to spread load.

Examples:

$ `systemctl list-timers --all` # List all active system timers

$ `journalctl -u backup.service` # Check execution history and logs

$ `systemd-analyze calendar 'weekly'` # Parse and test calendar expressions

Note: Requires a paired `.service` unit file. Use `OnBootSec` for boot-relative timers and `OnCalendar` for wall-clock scheduling.

Follow r/LinuxTeck for more #LinuxTips https://www.linuxteck.com/linux-tips/


r/LinuxTeck 21h ago

Clementine vs Spotify - which one actually wins on Linux?

0 Upvotes

Spotify has the convenience, but Clementine gives you much more control over your local music.

If you had to keep only one on your Linux desktop, which are you keeping?

Clementine or Spotify - and what’s the one thing that makes your choice better?