Linux tip: `lsof -i :8080` shows which process is using port 8080. Essential when you get "port already in use" errors during development or when troubleshooting service conflicts. #Linux #SystemAdministration
@monospace `ss -lpn | grep :8080` is my goto personally. I find it much more robust and fast. ymmv.
#linux #sysadmin #networking

@mikebabcock @monospace as someone trying to learn `ss` command line syntax, couldn’t you just add `:8080` to the `ss` command line?

I thought one of `ss`’s claims to gain was I reheated filtering.

Maybe I’m wrong. I’m not at a terminal.

@drscriptt @monospace ss has a full query/filter language built-in but no as far as I know, you cannot just specify a port that easily. I always use grep.

That said ... this will do exactly what it looks like, and is a good example* of port specifications though:
# ss -o state established '( dport = :smtp or sport = :smtp )'

* Example stolen from https://www.cyberciti.biz/tips/linux-investigate-sockets-network-connections.html

#networking #linux

ss command: Display Linux TCP / UDP Network/Socket Information - nixCraft

Use ss command on Linux to dump socket statistics. It allows showing information similar to netstat. It can display more TCP and state information than other tools.

nixCraft

@mikebabcock @monospace okay, this motivated me to get up off my duff, walk to a terminal, unlock, and test things:

`ss -lnp src :8080 or dst :8080`

So it seems like `grep :8080` might be fewer keystrokes.

But you can do all sorts of logic with built in gamer in `ss`. Like when you want to look for specific sets of ports talking to each other -or- other sets of ports talking with each other. Nested conditionals that start to get quite tricky with things like grep.

@drscriptt @monospace its very handy when looking for specific connections, or frequently in my case, connections not coming from specific subnets:

```ss not src $LOCALNET/24 dport :587```

But those more 'interesting' commands I've just saved to mini ~/bin/ scripts so I don't have to type them and frequently forget the syntax.

#oldmanbrain #sysadmin #networking

@mikebabcock @monospace is “LOCALNET” a textual place holder? Or is it some sort of keyword that `ss` substitutes?

I’m inclined to guess place holder as I’d assume that `ss` would have an array of directly attached networks with proper netmask, thus alleviating the need for the `/24`.

@drscriptt @monospace I'm using it as a visual variable. Replace with 10.11.12.0 or 192.168.0.0 ... apologies for confusion

@mikebabcock @monospace 👍🏻

thank you for clarifying and confirming what I suspected to be the case.

@mikebabcock @monospace the more I mess with `ss`’s filter syntax, the more I like it.

It takes time, practice, unwelcomed surprised, and figuring out the surprises to commit some new filtering language to my grey matter.

@drscriptt @monospace for a good time, download the source:
https://github.com/iproute2/iproute2/blob/main/misc/ss.c

6313 lines of C doing wonders.

iproute2/misc/ss.c at main · iproute2/iproute2

Iproute2 Source Code Mirror - This is a publish-only repository. Please follow README.devel procedure for any changes. - iproute2/iproute2

GitHub

@mikebabcock @monospace no no nope no way.

I am not a programmer and I’ve got enough shiny things demanding brain cycles.

Discovering legacy email infrastructure in multiple acquisitions at work and XML / XSLT fun at home.

I am enjoying the XML. Go figure.

@drscriptt @monospace I got my workplace almost entirely converted to XML back when it was "fresh" and then JSON took over and we've mostly avoided the shift.
Explaining to people why I prefer XML over JSON when they're too young to understand the move from CSV is just hard.
#greybeard #sysadmin

@mikebabcock @monospace ${BAR_KEEP} next round is on me.

I actually asked about XML vs JSON recently*, expecting to be told JSON all the way. But to my surprise, most people were reluctantly saying XML.

Since the my hammer has been seeing XML shaped nails all over the place.

@mikebabcock @monospace I couldn’t find a reference toot from my phone.

Here’s the desires I posted to a mailing list and newsgroup

- Leverage (referenced) Extensible Stylesheet Language Transformations (XSLT) to render XML documents in web browsers that (still) support it; Firefox.

(Edit: I’ve since gotten XML+XSLT to work in Chrome and Safari. Turns out my Content-Security-Policy header was causing them to balk.)

- Leverage a different XSLT stylesheet to render the same source data to files used by server daemons; e.g. DNS zone file.

- Comments to leave notes to myself.

- Ability to easily query it from the command line using xpath command to use XPath expressions to query the data. E.g. for use in shell scripts.

- Ability to apply use xmllint et al. to validate the input data.