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)

Shell Scripts

Shell scripts are text files that contain shell commands. Such files can be executed as if they were programs. A script can be in any language for which an interpreter exists, for example, Python, PHP, Perl, and so on. Similar to how a Python or Perl interpreter loads a program file and executes it, the Bash shell can load and execute shell scripts. However, before we address shell scripts, we need to visit some concepts about how programs are executed.

Shell Command Categories

We will now learn about the various categories of shell commands and how scripts work like any other command. There are four types of commands that can be invoked by name from the shell. These are listed as follows:

  • Binary Executables: Also called executable files or binaries, these contain machine code, and provide most of the functionality of a system, for example, GUI programs such as a web browser, or CLI based programs such as grep. The Bash shell itself is an executable. The...