For polynomial of degree $3$ you can use the following procedure. Assume that you guessed the solution $x_1=4$ (indeed $4^3-6\cdot 4^2-2\cdot 4+40 = 64 -96-8+40 =0)$. 

You can use Horner's method to get the polynomial $p(x)=p_2x^2+p_1x+p_0$ such that $(x-4)\cdot p(x) = x^3-6x^2-2x+40$. You want to do that because $p(x)$ will be a polynomial of degree $2$ and it is easy (see here ) to find the solutions of such polynomial. In your case you have (with Horner's method)

$$\begin{array}{|c|c|c|c|c|}\hline&amp;1&amp;-6&amp;-2&amp;40\\\hline 4&amp;0&amp;1\cdot 4=4&amp;-2\cdot 4=-8&amp;-10\cdot 4=-40\\\hline&amp;0+1=\color{blue}{\underbrace{1}_{:=p_2}}&amp;-6+4=\color{blue}{\underbrace{-2}_{:=p_1}}&amp;-2-8=\color{blue}{\underbrace{-10}_{:=p_0}}&amp;40-40=\color{red}0\\\hline\end{array}$$

So your polynomial becomes $p(x) = \color{blue}1\cdot x^2\color{blue}{-2}\cdot x\color{blue}{-10}= x^2-2x-10$. The remainder, as you can see, is $\color{red}0.$ The solutions to this polynomial are

$$x_{2,3}=\dfrac{2\pm2\sqrt{11}}{2}=1\pm11$$

The solutions are therefore $x_{1,2,3}=4,1+\sqrt{11},1-\sqrt{11}$.

Roots of this third degree polynomial
I always use netstat on ubuntu to check which processes are listening on specific ports. I use the following switches with netstat that work fine on ubuntu but on mac fail:

sudo netstat -tulpn
netstat: n: unknown or uninstrumented protocol

