Book Image

Working with Linux ??? Quick Hacks for the Command Line

By : Bogdan Vaida, Petru I»ôfan
Book Image

Working with Linux ??? Quick Hacks for the Command Line

By: Bogdan Vaida, Petru I»ôfan

Overview of this book

Websites, online services, databases, and pretty much every other computer that offers public services runs on Linux. From small servers to clusters, Linux is anywhere and everywhere. With such a broad usage, the demand for Linux specialists is ever growing. For the engineers out there, this means being able to develop, interconnect, and maintain Linux environments. This book will help you increase your terminal productivity by using Terminator, Guake and other tools. It will start by installing Ubuntu and will explore tools and techniques that will help you to achieve more work with less effort. Next, it will then focus on Terminator, the ultimate terminal, and vim, one of the most intelligent console editors. Futhermore, the readers will see how they can increase their command line productivity by using sed, find, tmux, network, autoenv. The readers will also see how they can edit files without leaving the terminal and use the screen space efficiently and copy-paste like a pro. Towards the end, we focus on network settings, Git hacks, and creating portable environments for development and production using Docker. Through this book, you will improve your terminal productivity by seeing how to use different tools.
Table of Contents (13 chapters)

Network – Who's listening?

When working with network applications, it comes in handy to be able to see open ports and connections and to be able to interact with ports on different hosts for testing purposes. In this section, we will be looking at some basic commands for networking and in what situations they might come in handy.

The first command is netstat:

netstat -plnt

This will show all open ports on our host. You can see here that we only have one open port on a default Ubuntu desktop installation, which is port 53. We can look this up in the special file /etc/services. This file contains all basic port numbers for programs and protocols. We see here port 53 is the DNS server:

Just by analyzing the output, we cannot determine which program is listening on this port, because this process is not owned by our current user. That's why the PID/Program Name column is empty. If we run the same command again with sudo, we see that this process is named dnsmasq and, if we want more information...