...
Note that we selected the Linux port 8889 in the above command to connect to the notebook. If you don't specify the port, it will default to port 8888 but sometimes this port can be already in use either on the remote machine or the local one
(i.e., your laptop). If the port you selected is unavailable, you will get an error message, in which case you should just pick another one. It is best to keep it greater than 1024.
Consider starting with 8888 and increment by 1 if it fails, e.g., try 8888, 8889, 8890 and so on. If you are running on a different port then substitute your port number for 8889.
FAQ and Troubleshooting
To list the listening port
lsof -i tcp:<port>
e.g. lsof -i tcp:8889
lsof -i tcp:8889
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ssh 32099 .......................... localhost:ddi-tcp-2 (LISTEN)
ssh 32099 ......................... TCP localhost:ddi-tcp-2 (LISTEN)
To kill it:
kill -9 32099