fbpx

How To – Get a grip on those network connections with pstree and lsof -i

As you know, you can string Linux commands together to achieve larger and more complicated tasks. Here we will look at locating processes that are connecting over the network. We will see how to locate established and listening endpoints.

We will also print process trees to understand how Apache2 forks processes to do load balancing of network connections.

First, let’s check all open files that are Internet addresses. All network connections will be identified by a network file (such as an Internet socket, which we are interested in here).

NailLinuxExam – Check those open network connections!

Bash: Automate enabling of Apache sites and modules

Want to automate the enabling and disabling of Apache sites and modules? Tired of running those a2enmod, a2dismod, a2ensite, and a2dissite commands? And then the cleanup involved with the same commands and the Apache2 daemon?

Check out this Bash wrapper for the Apache operations commands. It’s free to use and modify.

For the happy Linux and Bash experimenters out there, it’s a useful starting point to get started with Bash functions.