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)

Tips and Tricks

Before we move on to the next case study, we will cover some material that is helpful, but was not covered in previous chapters. They fall into various categories and make some operations much easier. We will briefly describe some of them. Some of the information here will also be needed to solve the problems in Activity 10 in this chapter.

Suppressing Command Output

UNIX-like OSes provide a special file, called /dev/null, that can be used as a "black hole" for any data. Any writes to that file silently succeed and the data is discarded. This is useful when you need to suppress the output of commands. For instance, look at the following command:

ls >/dev/null

This runs ls and silently discards its output. Redirecting to /dev/null is usually helpful when suppressing error messages from commands that are run in a script.

Arithmetic Expansion

So far, we have used the $(( EXPR )) syntax for arithmetic expressions. However, there are some variations...