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)

Working with sed

In this section, we will learn about the sed command, the powerful stream editor. We will give you a brief introduction on how sed works and we'll be showing you the substitution mode for automatically replacing text and files, which is one of the most important modes available. Next, we will learn about the sed command. Let's first examine its syntax:

sed [OPTION] 'pattern rule' FILE  

sed stands for stream editor and this command can edit files automatically without any user interaction. It processes input files on a line-by-line basis. Oftentimes, sed is used in shell scripts to transform any command's output to a desired form for further processing. Most everyday use cases for sed follow a similar pattern, which, in its most simple form, is first used with a regular expression or other pattern to define which lines to change in an...