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)

Chapter 1: Introduction to the Command Line

Activity 1: Navigating the Filesystem and Viewing Files

  1. Use the cd command to navigate to the appropriate folder and use less to read the relevant information:
    robin ~ $ cd Lesson1/data
    robin ~/Lesson1/data $ cd pinaceae/cedrus/deodara/
    robin ~/Lesson1/data/pinaceae/cedrus/deodara $ less data.txt
  2. Use the cd command to navigate the appropriate folder and view the file with less. Use the / command to search for the phrase "derives from" and read the rest of the sentence to get the answer:
    robin ~/Lesson1/data/pinaceae/cedrus/deodara $ cd ../../..
    robin ~/Lesson1/data $ cd pinaceae/abies/pindrow/
    robin ~/Lesson1/data/pinaceae/abies/pindrow $ less data.txt
  3. Navigate to the right folder and run the tree command, which reports the number of directories in it. Each directory is a species:
    robin ~/Lesson1/data/pinaceae/abies/pindrow $ cd ../../..
    robin ~/Lesson1/data $ cd taxaceae/taxus/
    robin ~/Lesson1/data/taxaceae/taxus ...