Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Fundamentals of Linux
Fundamentals of Linux

Fundamentals of Linux: Explore the essentials of the Linux command line

Arrow left icon
Profile Icon Pelz Profile Icon Oliver Pelz
Arrow right icon
$17.99 $25.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (3 Ratings)
eBook Jun 2018 234 pages 1st Edition
eBook
$17.99 $25.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Pelz Profile Icon Oliver Pelz
Arrow right icon
$17.99 $25.99
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (3 Ratings)
eBook Jun 2018 234 pages 1st Edition
eBook
$17.99 $25.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$17.99 $25.99
Paperback
$32.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Fundamentals of Linux

The Linux Command Line

In this chapter, we will introduce you to the most fundamental concepts when starting to work with the Linux command line. It is a very powerful and efficient tool with which you can execute the various actions that you'll generally require when using Linux. A plethora of shortcuts and tricks will help you to navigate the command line more efficiently.

In this chapter, we'll walk you through the following:

  • Shell globbing
  • Redirecting and piping
  • The grep, sed, and awk commands
  • Navigating files and folders in a Linux system

Introducing the command line

In this section, you'll learn how to run Linux command-line programs and what the basic structure of the command line is. You will also learn what program options and arguments are and why they are important for customizing your commands.

When we say the Linux command line, what we really mean is the shell. It's important to know that the shell is not the same as a terminal emulator. A Terminal is a screen or window that lets you access a Linux server's input and output. A shell is just a program that runs on the server as does any other command and which awaits, interprets, processes, executes, and responds to commands typed in by the user.

First, open up a new terminal emulator and log in to your CentOS 7 server by using SSH, as we learned in the Chapter 1, Introduction to Linux. Log in using your normal user account, which you set...

File globbing

In this section, you will learn how shell expansion works and how we can use file globbing to make our lives easier when using commands that deal with a lot of input files. We will discuss all existing and available shell globbing character classes and show you important use cases and examples for each of them. When working with commands that use file or directory names as arguments, such as the ls command, it is very helpful to learn about file and directory globbing. These are special characters typed in the shell that behave differently than regular characters. All globbing characters are going to be replaced by the shell with a list of files matching the characters' pattern right before any command can use them as parameters. It's a notation to simplify working with files, especially when dealing with a large number of files that you need to type and...

Quoting commands

As we learned in the previous section, the shell has a list of special characters that have a special meaning in the shell and trigger some functionality, such as using the wildcard character as filenames. But there are even more special characters than the ones we showed you before. If you want to work with such special characters, for example, using filenames that contain question mark symbols, which are valid filenames, you have a problem, as the shell always first tries to apply special actions to special characters, so they will not work as normal filename characters. The solution here is to disable all special meanings of such characters using various approaches, such as quoting, so that we can treat them as any other normal literal character. As you now know, in the Linux Bash shell, there are some special characters, such as * # [ ] . ~ ! $ { } < &gt...

Getting help

Before we can start teaching you how to get help using the various forms of documentation available for Linux commands, we first have to learn how to read the default command syntax documentation. Most of the provided standard shell commands in Linux follow a uniform format describing their usage. Afterward, we will show you how to get help.

When working with the Linux command line, getting help and looking up information and documentation is very important because the command line can be very complex and nobody knows and can remember everything. On every Linux system, there are several ways available to get help, depending on the kind of level of information you need to know. In this section, we will tap into the different sources of documentation.

In a previous section, you already learned the general structure of Bash shell commands and everything you need to know...

Working with the Linux shell

In this section, we will learn how to work in the shell efficiently. We will introduce some important practices and techniques that will improve your productivity and make you a faster shell command hacker. This can make you a happier person because, eventually, you will be able to advance to feeling very comfortable working in the shell. Please note, in this section, we will show you a lot of keyboard shortcuts. Learning keyboard shortcuts is like learning any other craft, you begin slowly and gradually, because learning too many new skills at once can leave you overwhelmed and make you forget more quickly than learning in smaller chunks. My tip is to start by learning the first three to four command editing shortcuts and then incorporate more from day to day or week to week. We will start with the command editing shortcuts. Now, if you don't...

Understanding standard streams

In this section, you will learn why every command can use three standard streams for accessing its input and output. Also, you will learn how to work with those input and output streams and how to use redirection. Finally, we will learn how to use pipes and why they are so important. One philosophy of the Linux operating system is that every command has exactly one functionality in the system, nothing more, and nothing less. For example, there's one command to list files, another to sort text, and one to print the file's content, and so on.

Now, one of the most important features of the shell is to connect different commands to create custom tailored solutions and tools for all kinds of problems and workflows. But before we can show you how to concatenate different commands together to build something powerful, we first need to know how...

Understanding regular expressions

In this section, we will introduce the wonderful art of regular expressions. You will learn what they are and why they are so powerful. There are a lot of different regular expression characters available, and here we will introduce the most important ones. Afterward, you will learn how to apply regular expressions with the grep command to find, extract, and filter useful information out of text files. Regular expressions, or regexps for short, are a very powerful concept used to search through text using special patterns, describing the structure of the search term instead of a constant string of characters, which is also called literal text search in this context. Using regular expressions can save you a lot of time, by not doing repetitive work, and Linux system administrators use them quite heavily in their everyday work.

In the File globbing...

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...

Working with awk

In this section, we will show you what the command awk is all about and why it can be important for us. We will also show you how to use it for text file manipulation and processing. awk is another very important tool for text processing and manipulation. It can be used as a complete scripting language to work on text files or streams. It contains some very powerful programming constructs, including variables: if...else, while, do while and for loops; arrays; functions; and mathematical operations. awk also works on a line-by-line basis, as sed does. One of the key features of awk and the main difference to sed is that it splits input lines into fields automatically. But how does it work and why is it so helpful?

awk enables you to create rule and action pairs, and, for each record that matches this rule or condition, the action will fire. The rules are also called...

Navigating the Linux filesystem

In this section, you will learn how to navigate the Linux filesystem. You will also learn how the Linux filesystem is structured. If we print out the folder structure of the top-level directories beneath the root directory by executing the tree -d -L 1 / command, you will see a list of strange-sounding directory names. These directory names are the same on any Linux distribution and they follow a standard called the filesystem hierarchy standard (FHS). Each of these standard directories in the Linux filesystem has a specific purpose, and the user can expect certain files in certain locations, and it also means that a program can predict where the files are located, and it also means that any program working with those system directories can predict where the files are located. The following are the directories:

  • The / slash is the primary hierarchy...

Summary

In this chapter, we started off with an introduction to the command line, file globbing, and quoting commands. We progressed towards practical execution by working with the shell, standard streams, and regular expressions. We also covered functionalities of sed, awk, and the Linux filesystem.

In the next chapter, we'll cover concepts pertaining to files.

Left arrow icon Right arrow icon

Key benefits

  • Delve into the fundamentals of Linux
  • Explore and work with virtualization, command lines, and Bash shell scripts
  • Use special file permission flags such as setuid and setgid

Description

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.

Who is this book for?

Fundamentals of Linux is for individuals looking to work as a Linux system administrator.

What you will learn

  • Explore basic and advanced command-line concepts
  • Install Linux, work with VirtualBox, and install CentOS 7 in VirtualBox
  • Work with the command line efficiently and learn how to navigate through the Linux filesystem
  • Create file and user group permissions and edit files
  • Use Sticky bit to secure your Linux filesystem
  • Define and remove ACL from Linux files

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jun 30, 2018
Length: 234 pages
Edition : 1st
Language : English
ISBN-13 : 9781789537529
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want

Product Details

Publication date : Jun 30, 2018
Length: 234 pages
Edition : 1st
Language : English
ISBN-13 : 9781789537529
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 136.97
Learning Linux Shell Scripting
$48.99
Hands-On System Programming with Linux
$54.99
Fundamentals of Linux
$32.99
Total $ 136.97 Stars icon

Table of Contents

6 Chapters
Introduction to Linux Chevron down icon Chevron up icon
The Linux Command Line Chevron down icon Chevron up icon
The Linux Filesystem Chevron down icon Chevron up icon
Working with the Command Line Chevron down icon Chevron up icon
More Advanced Command Lines and Concepts Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
(3 Ratings)
5 star 33.3%
4 star 0%
3 star 0%
2 star 66.7%
1 star 0%
Chin-Fah Jun 08, 2019
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
There are a few glaring mistakes which make the content less credible.For example on page 43 of the physical book, we would type 'n' for the next keyword when using the man pages. Instead, 'n' was mentioned as 'End'. On page 21, the command 'ssh -p space 2222 root@127.0.0.1'. Instead it should be <space> that denotes a tap on the space bar instead of the word 'space' in the command. This is quite laughable.I have yet to finish the book, and find more and more mistakes as I go through the chapters.
Amazon Verified review Amazon
Charles Hill Dec 28, 2018
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
There are examples where the concepts that are being explained do not match the syntax, which makes it really hard to follow this book especially if you've never used Linux before.Example from page 61 of the eBook (purchased off of Packts website):If the list in the brackets begins with the caret symbol, it matches any single-character not from the rest of this list. Normal brackets can be used to save a reference ofthe match within it. To back reference, we use /number of the bracket expression so that theregular expression matches all the lines starting with the first letter, for example, egrep't(ac)1*s' /etc/services. The pipe symbol stands for or, so the next expressionmatches all the lines containing either domain or gopher.Note that theegrep 't(ac)1*s' /etc/servicescommand does not fit the context of the containing instructions. There are multiple examples of this occurring.The other issue is that the pace of this text is too quick, and does not go in depth on concepts that are foundational to the rest of the book.
Amazon Verified review Amazon
STHAMMA Sep 25, 2018
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Concepts are crispy, neat and not deviated with unnecessary contents. Even a NON - IT back ground people can understand easily. For Linux Beginners worth to spend time.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.