Show HN: Get answers for shell commands from GPT3 from your terminal
Bash / Shell is one of the last things I would trust a typical AI considering how much bad shell code/examples exist out there. (it always surprise me how many unquoted variables exist in most shell scripts; quoting fixes many problems, doesn't hurt and still developers are often to lazy to do it)<p>The example in the project readme is imo already a bad example.<p><pre><code>  $ ai ask "Check process running on port"
</code></pre>
Answer<p><pre><code>  Command is `lsof -i tcp:8000`
</code></pre>
Apart from the facts that<p>- I would say the chances that lsof is installed are significant smaller than ss or netstat<p>- is lsof notably slower than ss<p>it is also inferior for the requested task because<p>- it returns any process connecting to this port not only the listening one. Which process is running on port 443 on my desktop? None. How many processes does 'lsof -i tcp:443` return? 20.<p>- it does not work if the listening process is from another user (if lsof is not run by root). In this case lsof -i returns nothing while ss -nltp returns the information that the port is listened and only cannot tell by which process because of missing permissions.<p>My answer to "which process uses port x"<p><pre><code>  ss -nltp sport = x</code></pre>