Linux Tools, Utilities, and Other Services

This document provides basic tools and algorithms for use with data science and machine learning tasks in Python

Andrew L. Mackey


The following information is useful for various tasks to be performed in a Linux environment.


SSH Tunneling and Port Forwarding

It is generally preferred to have data encrypted when traveling across networks. One method for accomplishing this task is to tunnel traffic through an SSH connection between the client and some SSH server that has access to the destination server. The SSH server may also be the destination server.

Let’s consider an example. The client represents your personal computer, so it will have the IP address of (localhost). The destination is some web server running on port 80 behind a firewall at address Your computer cannot access this server directly. However, your computer can access IP address running SSH on port 22, which has direct access to the destination web server ( Our goal is to connect to the SSH server ( and tunnel a connection between the client ( and destination (

First, we start by picking some port we want to use on the client so that when we connect to that port locally, it will map that port to the destination. We will simply pick port 3000. This suggests we will map to We specify the -L option to denote local port forwarding.

ssh  -L  [localaddr]:[localport]:[destaddr]:[destport]  [user]@[sshserveraddr] -p [sshport]

For our example, we will use the following command:

ssh  -L  someuser@ -p 22