For example, you can run lsof -i :3000 #portsearch

Then later you can run ctrl + r to open up a reverse search, and then type portsearch and this command will pop up.

This works because # is a comment delimiter in bash, so anything after the # isn’t processed as a bash command but is still in history so it’s searchable.