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)

Basic regular expressions


You have a problem and you want to solve it with regular expressions? Now you have two problems! This is just one of the many regular expression jokes on the Internet.

In this section, you will learn how regular expressions work, as we will be using them in the upcoming chapters. We have prepared a file for our playground and if you want to try the grep commands on your own, you can take it from the GitHub repository.

Let's start by opening our text file so we can see its contents, and then splitting the screen so we can see both the file and the command side by side.

First of all, the simplest and probably the most common regular expression is to find a single word.

For this we will use the grep "joe" file.txt command:

joe is the string we are searching for and file.txt is the file where we perform the search. You can see that grep printed the line that contained our string and the word is highlighted with another color. This will only match the exact case of the...