Book Image

Command Line Fundamentals

By : Vivek Nagarajan
Book Image

Command Line Fundamentals

By: Vivek Nagarajan

Overview of this book

The most basic interface to a computer—the command line—remains the most flexible and powerful way of processing data and performing and automating various day-to-day tasks. Command Line Fundamentals begins by exploring the basics, and then focuses on the most common tool, the Bash shell (which is standard on all Linux and iOS systems). As you make your way through the book, you'll explore the traditional Unix command-line programs as implemented by the GNU project. You'll also learn to use redirection and pipelines to assemble these programs to solve complex problems. By the end of this book, you'll have explored the basics of shell scripting, allowing you to easily and quickly automate tasks.
Table of Contents (6 chapters)

Practical Case Study 1: Chess Game Extractor

In this section, we will incrementally develop a shell script to perform a data processing task. We have done some data crunching in the previous chapters using pipelines in a limited fashion. Here, we will attempt a more complex task. Depending on your taste, there are a number of editors available to write a script with. You may be familiar with GUI editors such as SublimeText or Notepad++, but there are several editors that work in the console itself without a GUI. A few are complex and very powerful ones such as emacs or vim, and some are simple editors such as gedit and nano. One of these is usually available on most systems. The editor can be launched right from the command line without needing to navigate the GUI Desktop with the mouse or trackpad, by just typing its name like any other command.

Understanding the Problem

The functionality of this script that we want to develop is that it can take a text file containing thousands...