Search icon CANCEL
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
Free Trial
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (3 Ratings)
Paperback Jun 2018 234 pages 1st Edition
eBook
₱941.99 ₱1346.99
Paperback
₱1683.99
Subscription
Free Trial
Arrow left icon
Profile Icon Pelz Profile Icon Oliver Pelz
Arrow right icon
Free Trial
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3 (3 Ratings)
Paperback Jun 2018 234 pages 1st Edition
eBook
₱941.99 ₱1346.99
Paperback
₱1683.99
Subscription
Free Trial
eBook
₱941.99 ₱1346.99
Paperback
₱1683.99
Subscription
Free Trial

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781789530957
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Jun 30, 2018
Length: 234 pages
Edition : 1st
Language : English
ISBN-13 : 9781789530957
Languages :
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 ₱260 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 ₱260 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 6,991.97
Learning Linux Shell Scripting
₱2500.99
Hands-On System Programming with Linux
₱2806.99
Fundamentals of Linux
₱1683.99
Total 6,991.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%
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
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
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
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.