Book Image

Fundamentals of Linux

By : Oliver Pelz
Book Image

Fundamentals of Linux

By: Oliver Pelz

Overview of this book

Linux is a Unix-like operating system assembled under the model of free and open source software development and distribution. Fundamentals of Linux will help you learn all the essentials of the Linux command line required to get you started. The book will start by teaching you how to work with virtualization software and install CentOS 7 Linux as a VM. Then, you will get to grips with the workings of various command line operations, such as cursor movement, commands, options, and arguments. As you make your way through the chapters, the book will not only focus on the most essential Linux commands but also give an introduction to Bash shell scripting. Finally, you will explore advanced topics, such as networking and troubleshooting your system, and you will get familiar with the advanced file permissions: ACL, setuid, and setgid. Fundamentals of Linux includes real-world tasks, use cases, and problems that, as a system administrator, you might encounter in your day-to-day activities.
Table of Contents (7 chapters)

Introduction to Bash shell scripting

In this section, we will introduce you to the core concept of Bash shell scripting. Another very important feature of Bash shell scripts are functions. We use functions excessively in Bash shell scripts to make reoccurring tasks or commands reusable. Functions encapsulate a task to make it more modular. Functions usually take in data, process it, and return a result. Once a function is written, it can be used over and over again, but we can also work with functions on the command line.

Let's discuss the general syntax of a function by creating one:

$ say_hello90 {
>echo "My name is $1";

The first word is the function name followed by opening and closing brackets, which are used to define a function, followed by a curly opening bracket; all the commands belonging to a function are defined within the open and closing...