24,99 €
Master the concepts and techniques that will help you gain the LX0-103 and LX0-104 certifications on your first attempt
Key FeaturesGet a clear understanding of how to achieve the Linux+ certificationExplore system architecture, shell scripts, data management, and Linux securityWork through practice and mock tests to pass both LX0-103 and LX0-104 examsBook Description
Linux+ certification demonstrates technical competency and provides a broad awareness of Linux operating systems. Professionals who have achieved the Linux+ certification exhibit all-important knowledge of installation, operation, administration, and troubleshooting services.
The CompTIA Linux+ Certification Guide is an overview of the certification that gives you insights into the system architecture. You’ll understand how to install and uninstall Linux distributions, followed by working with various package managers. Once you’ve grasped all this, you’ll move on to manipulating files and processes at command-line interface (CLI) and creating, monitoring, killing, restarting, and modifying processes.
As you progress, you’ll be equipped to work with display managers and learn how to create, modify, and remove user accounts and groups, as well as understand how to automate tasks. The last set of chapters helps you configure dates and set up local and remote system logging. In addition to this, you’ll explore different internet protocols, along with discovering network configuration, security administration, Shell scripting, and SQL management.
By the end of this book, you’ll not only have got to grips with all the modules using practice questions and mock exams, but you’ll also be well prepared to pass the LX0-103 and LX0-104 certification exams.
What you will learnUnderstand the Linux system architecture Install, upgrade, and manage Linux system packagesConfigure devices and maintain the Linux filesystemManage the Shell environment, write scripts, and manage dataSet user interfaces and desktops in the Linux operating systemAutomate system admin tasks and manage essential system servicesManage SQL server on Linux and log locally and remotely with rsyslogdAdminister network and local securityWho this book is for
The CompTIA Linux+ Certification Guide is for you if you want to gain the CompTIA Linux+ certificate. This guide is also for system administrators and rookie Linux professionals interested in enhancing their Linux and Shell scripting skills. No prior knowledge of Linux is needed, although some understanding of Shell scripting would be helpful.
Philip Inshanally has been in the IT industry for over 17 years. He has extensively worked in various platforms. Philip has his own consulting firm which provides local and remote support around the world; focusing towards designing, planning, implementing and documenting to name a few. As an industry professional, he has the competitive edge due to his ongoing development. He has acquired excellent skills, and this has helped him in dealing with individuals both locally and internationally. He is a father of one; Matthew Zach Inshanally. He has experience in routing, switching, OTT, and various Linux distributions. Also, other vendor-specific technologies such as Cisco, Extreme, Juniper, Microsoft, Sandvine, Zhone, and so on.
Sie lesen das E-Book in den Legimi-Apps auf:
Seitenzahl: 538
Veröffentlichungsjahr: 2018
Copyright © 2018 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
Commissioning Editor: Vijin BorichaAcquisition Editor: Rohit RajkumarContent Development Editor: Ronn KurienTechnical Editor: Prachi SawantCopy Editor: Safis EditingProject Coordinator: Jagdish PrabhuProofreader: Safis EditingIndexer: Pratik ShirodkarGraphics: Tom ScariaProduction Coordinator: Jagdish Prabhu
First published: September 2018
Production reference: 1240918
Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.
ISBN 978-1-78934-449-3
www.packtpub.com
Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.
Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
Get a free eBook or video every month
Mapt is fully searchable
Copy and paste, print, and bookmark content
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.packt.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.
Philip Inshanally has been in the IT industry for over 17 years. He has extensively worked in various platforms. Philip has his own consulting firm which provides local and remote support around the world; focusing towards designing, planning, implementing and documenting to name a few. As an industry professional, he has the competitive edge due to his ongoing development. He has acquired excellent skills, and this has helped him in dealing with individuals both locally and internationally. He is a father of one; Matthew Zach Inshanally.
He has experience in routing, switching, OTT, and various Linux distributions. Also, other vendor-specific technologies such as Cisco, Extreme, Juniper, Microsoft, Sandvine, Zhone, and so on.
Sreecharan Gaddam has finished bachelors in computer science from the University of Sathyabama, Chennai, India. He started working on cloud technologies in various platforms also he completed the masters of science from the University northwestern polytechnic with major in computer science. He was an intern in Viotalk and moved to the senior positions as a developer. He is exploring Continuous delivery and Continuous deployment tools areas like Jenkins, Chef, and puppet. He has four years of experience in Linux environment. He worked on SSL, Encrypting the links, Virtual Private Cloud, Route 53, NAT Gateways, and subnets. He also worked on languages like Python, Ruby, Go and Java for scripting and developing the applications.
If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.
Title Page
Copyright and Credits
CompTIA Linux+ Certification Guide
Packt Upsell
Why subscribe?
Packt.com
Contributors
About the author
About the reviewer
Packt is searching for authors like you
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the color images
Conventions used
Get in touch
Reviews
Configuring the Hardware Settings
Viewing CPU, RAM, and swap info
Interrupts and devices
Modules
Summary
Questions
Further reading
Booting the System
The boot process explained
DMESG
GRUB and GRUB2
GRUB
GRUB2
Working with GRUB
Working with GRUB2
Summary
Questions
Further reading
Changing Runlevels and Boot Targets
Introduction to runlevels
Introduction to boot targets
Working with runlevels
Working with boot targets
Summary
Questions
Further reading
Designing a Hard Disk Layout
Using the fdisk utility
Using the parted utility
Steps to format a hard disk
Mounting and unmounting a partition
The mount command
The unmount command
Summary
Questions
Further reading
Installing a Linux Distribution
Understanding the use of the LiveCD
Installing a Linux distribution as a fresh installation
Installing a Linux distribution side by side with a Windows OS
Installing Linux side by side with another flavor of Linux
Summary
Questions
Further reading
Using Debian Package Management
The dpkg command
The apt-get command
The autoremove option
The purge option
The aptitude command
The search option
The synaptic utility
Summary
Questions
Further reading
Using YUM Package Management
YUM
DNF
RPM
yumex
Summary
Questions
Further reading
Performing File Management
Viewing and moving files and directories in the CLI
Creating, copying, moving, renaming, and removing files
Creating and removing directories
Finding files and directories
Pipes and redirects
Summary
Questions
Further reading
Creating, Monitoring, Killing, and Restarting Processes
The ps command
The kill command
The pstree command
The pgrep command
The pkill command
Viewing and managing processes using the top command
Managing process(es) with the service command
Managing process(es) with the systemctl command
Summary
Questions
Further reading
Modifying Process Execution
The nice command
The renice command
Foreground processes versus background processes
Summary
Questions
Further reading
Display Managers
Working with the XDM
Working with the KDM
Working with the GDM
Working with the Lightdm
Summary
Questions
Further reading
Managing User and Group Accounts
Directory used when creating a new user
The .bash_logout
The .bashrc
The .profile
The .bash_history
Managing user accounts
The chage command
The usermod command
The w command
The who command
The last command
The whoami command
Managing groups
Summary
Questions
Further reading
Automating Tasks
Managing automation using the at, atq, and atrm commands
The at command
The atq command
The atrm command
Managing automation using cron, crontab, and anacron
Cron
Crontab
Anacron
Permissions for tasks using configuration files
Summary
Questions
Further reading
Maintaining System Time and Logging
Date configuration
The tzselect command
The tzconfig command
The hwclock command
Setting up local system logging
Configure remote logging
Summary
Questions
Further reading
Fundamentals of Internet Protocol
IPv4 addressing
Class A
Class B
Class C
Class D
Class E
Subnet masks
Subnetting
IPv6 addressing
Unicast
Multicast
Anycast
Removing leading zeros
Removing consecutive zeros
Well-known protocols
TCP
HTTP
HTTPS
FTP
UDP
DNS
TFTP
ICMP
Summary
Questions
Further reading
Network Configuration and Troubleshooting
IPv4 configuration
The ifconfig command
The ifup command
The ifdown command
The ip command
Configuring IPv4 routing
IPv6 configuration
Configuring IPv6 routing
Client-side DNS
Network troubleshooting
The ping command
The ping6 command
The traceroute command
The traceroute6 command
The netstat command
The tracepath command
The tracepath -6 command
The nmap command
The dig command
The whois command
The hostname command
Summary
Questions
Further reading
Performing Administrative Security Tasks
Host security
The su command
The sudo command
TCP wrappers
SSH
Encryption
Summary
Questions
Further reading
Shell Scripting and SQL Data Management
Shell scripting
The basics of shell scripting
Writing scripts using for loops
Writing scripts using the while loop
Writing scripts using if statements
SQL data management
The insert command
The select command
The update command
The delete command
The from option
The where condition
The group by option
The order by option
The join option
Summary
Questions
Further reading
Mock Exam - 1
Questions
Answers
Mock Exam - 2
Questions
Answers
Assessment
Chapter 1: Configuring the Hardware Settings
Chapter 2: Booting the System
Chapter 3: Changing Runlevels and Boot Targets
Chapter 4: Designing a Hard Disk Layout
Chapter 5: Installing a Linux Distribution
Chapter 6: Using Debian Package Management
Chapter 7: Using YUM Package Management
Chapter 8: Performing File Management
Chapter 9: Creating, Monitoring, Killing, and Restarting Processes
Chapter 10: Modifying Process Execution
Chapter 11: Displaying Managers
Chapter 12: Managing User and Group Accounts
Chapter 13: Automating Tasks
Chapter 14: Maintaining System Time and Logging
Chapter 15: Fundamentals of Internet Protocol
Chapter 16: Network Configuration and Troubleshooting
Chapter 17: Performing Administrative Security Tasks
Chapter 18: Shell Scripting and SQL Data Management
Other Books You May Enjoy
Leave a review - let other readers know what you think
Linux+ certification demonstrates technical competency and provides a broad awareness of Linux operating systems. Professionals who have achieved the Linux+ certification exhibit all-important knowledge of installation, operation, administration, and troubleshooting services.
The CompTIA Linux+ Certification Guide is an overview of the certification that gives you insights into the system architecture. You'll understand how to install and uninstall Linux distribution, followed by working with various package managers. Once you've grasped all this, you'll move on to manipulating files and processes at command-line interface (CLI) and creating, monitoring, killing, restarting, and modifying processes. As you progress, you'll be equipped to work with display managers and learn how to create, modify, and remove user accounts and groups, as well as understand how to automate tasks. The last set of chapters helps you configure dates and set up local and remote system logging. In addition to this, you'll explore different internet protocols, along with discovering network configuration, security administration, Shell scripting and SQL management.
By the end of this book, you'll not only have gotten to grips with all the modules using practice questions and mock exams, but you'll also be well prepared to achieve the LX0-103 and LX0-104 certification exams.
The CompTIA Linux+ Certification Guide is for you if you want to gain the CompTIA Linux+ certificate. This guide is also for system administrators and rookie Linux professionals interested in enhancing their Linux and Shell scripting skills. No prior knowledge of Linux is needed, although some understanding of Shell scripting would be helpful.
Chapter 1, Configuring the Hardware Settings, this chapter focuses on viewing interrupts, looking at /proc/interrupts, CPU info viewing the /proc/cpuinfo, raid status viewing /proc/mdstat, the devices directory /dev, the /proc virtual directory, the lsmod command and usage, the modprobe command and usage, the lspci command command and usage.
Chapter 2, Booting the System, this chapter focuses on the process of booting the system, looking at the GRUB and GRUB2 configuration file, focusing on the timer, default boot entry, passing argument at the GRUB/GRUB2 boot menu, the chkconfig command, the systemctl, the dmesg command, the various start/stop scripts0.
Chapter 3, Changing Runlevels and Boot Targets, this chapter focuses on the introduction of runlevels and boot targets, the types of runlevels and boot targets available in the LINUX distributions, the differences between runlevels and boot targets, working with runlevels at the CLI, also working with boot targets at the CLI.
Chapter 4, Designing a Hard Disk Layout, this chapter focuses on creating partitions/segmenting a physical hard disk at the CLI, emphasis on the usage of the fdisk utility, the parted utility, the steps to create, remove, define the partition type, format the hard disk with the various mkfs commands.
Chapter 5, Installing a Linux Distribution, this chapter focuses on installing a Linux Distribution, particularly the Red Hat flavour of CentOS and the Debian flavour of Ubuntu, the reader will be exposed to installing a Linux distro using a well-known method of a Live CD.
Chapter 6, Using Debian Package Management, in Linux, software is added, removed in a number of ways. Here the focus is on the way we add software in a Debian distribution, particularly using the dpkg, apt-get, aptitude commands from the CLI, synaptic from a GUI, and the reader learns how to add, remove, update, erase a software in a Debian distribution listed.
Chapter 7, Using YUM Package Management, in this chapter, we focus on adding software in a Red Hat distribution, particularly using the yum, dnf, rpm commands from the CLI, yumex from a GUI, the reader learn to add, remove, update, and erase software in a Red Hat environment.
Chapter 8, Performing File Management, in this chapter, the reader learns about the various commands that Linux provides which are common distributions to manipulate files, process(s), at the CLI. These commands can be classified into several categories: file system navigation, file manipulation, directory manipulation, and file location, and file examination, CPU hardware identity, process priority, manipulating CPU priority for process.
Chapter 9, Creating, Monitoring, Killing, and Restarting Processes, in Linux, a process is more or less synonymous with a running program. init / systemd, the first process run by the kernel when it boots. This chapter focuses on how we create a process, monitor hardware usages for existing processes, terminate / kill a process or restart a process at the CLI.
Chapter 10, Modifying Process Execution, there may be times when you'll want to give priority to important programs over other programs, also, sending some programs to the background allowing the user to continue using the shell or bring some programs to the foreground. This chapter focuses on the methods of accomplishing just that, using the nice and renice, fg, bg commands.
Chapter 11, Display Managers, this chapter focuses on the various display managers available in Linux distros, such as X Display Manager (XDM), KDE Display Manager (KDM), Gnome Display Manager (GDM), Light Display Manager (LightDM) which is used To handle GUI logins, they all use the XDMCP - X Display Manager Control Protocol which starts the local computer's X server.
Chapter 12, Managing User and Group Accounts, this chapter focuses on user and group management, covering from user account creation, modifying existing user account(s), removing user account(s), group creation, modifying groups of users, removing group(s), as well as best practices to consider when managing users and groups. Focus is placed on using commands such as useradd, usermod, userdel, groupadd, groupmod, groupdel, who, w, change, passwd, last, whoami, configuration files such as /etc/passwd, /etc/shadow, /etc/group, /etc/skel file.
Chapter 13, Automating Tasks, this chapter focuses on automating common administration task(s) in a Linux environment as well as commonly used methods to consider when setting up automation for a given task. Focus is placed on using commands such as crontab, at, atq, atrm, anacron, configuration files such as /etc/at.deny, /etc/at.allow, /etc/cron. {daily,hourly,monthly,weekly}, /etc/cron.allow, /etc/anacrontab.
Chapter 14, Maintaining System Time and Logging, this chapter focuses on configuring the date and time along with the setting the time zone. Also, the steps to set to logging locally using rsyslog, logrotate in a Linux distribution and configuring logging to be sent to a remote syslog server for management. Commands covered includes the tzselect, tzconfig, date, journalctl, directories include the / etc/timezone, /etc/localtime, /usr/share/zoneinfo, /etc/logrotate.conf, /etc/logrotate.d/, /etc/systemd/journald.conf, / var/log/, /var/log/journal/, /etc/rsyslog.conf.
Chapter 15, Fundamentals of Internet Protocol, this chapter focuses on the basic principles surrounding how a network such as the Internet works, by breaking down how two computers communicate with each other, we delve into Internet Protocol (IP) addressing, particularly IPv4, the various classes of IPv4 such as the ClassA, ClassB, ClassC, CIDR notation, then we look at subnetting. Next we take a look at IPv6, the format of an IPv6 address, the well-known IPv6 address, ways to cut down on the lengthy IPv6 address.
Finally, we look at the differences between some well-known protocols such as UDP, TCP and ICMP and their port numbers
Chapter 16, Network configuration and troubleshooting, this chapter focuses on the basic network configuration in a Linux environment, looking at configuring an IPv4 address, subnet mask, default gateway. Next we look at configuring an IPv6 address, default gateway, Then we focus on configuring client side DNS, Finally we focus on network troubleshooting. Commands such as ifup, ifdown, ifconfig, ip, ip link, ip route, route, ping, ping6, netstat, traceroute, traceroute6, tracepath, tracepath6, dig, host, hostname.
Chapter 17, Performing Security Administrative Tasks, this chapter focuses on the performing security administrative tasks in a Linux environment, focusing on setting up host security, granting user(s) special permissions with sudoers, date encryption. Commands covered are the sudo, ssh-keygen, ssh-agent, ssh-add, gpg, configuration files covered includes /etc/sudoers, /etc/hosts.allow, /etc/hosts.deny, ~/.ssh/id_rsa, ~/.ssh/id_rsa.pub, /etc/ssh/ssh_host_rsa_key, ~/.ssh/authorized_keys, /etc/ssh_known_hosts.
Chapter 18, Shell Scripting and SQL Data Management, this chapter focuses on introducing Shell scripting and SQL data management in a Linux environment. First we look at the basic format when writing scripts, identifying the interpreter for the script, configuring the script to be executable, using for, while loop, if statements. Then we focus our attention to SQL data management, we cover basic SQL commands such as insert, update, select, delete, from, where, group by, order by, join.
Chapter 19, Mock Exam - 1, this mock exam will compile of realistic exam questions and answers. You'll gain the insight of examples drawn from real-world scenarios, with detailed guidance and authoritative coverage of key topics. Realistic exam questions from recent tests to bring you the best method of preparing for the CompTIA LX0-103/LX0-104 exam.
Chapter 20, Mock Exam - 2, this mock exam will compile of realistic exam questions and answers. You'll gain the insight of examples drawn from real-world scenarios, with detailed guidance and authoritative coverage of key topics. Realistic exam questions from recent tests to bring you the best method of preparing for the CompTIA LX0-103/LX0-104 exam.
It is assumed that some readers may have limited or no knowledge about Linux operating systems. It is also assumed that some readers are Linux users but may need a bit of a refresher on interfacing with a Linux environment.
The key to reinforcing each chapter to memory is by grabbing copies of various Linux distributions; namely CentOS, Fedora, and Ubuntu. Then install the various Operating Systems in a virtual environment such as VMware or VirtualBox. Next, follow along each chapters (the chapters are independent of each other so you can choose any given chapter to study/practice) by practicing inside the various Linux distributions in order to better grasp each chapter. After practicing the various chapters, you will become more productive within a Linux environment; this will empower you to be better equipped in mixed environments where there are both Windows and Linux Operating Systems.
You can follow the along the tutorials presented in Chapter 5, Installing a Linux Distribution of this book for getting started with installation.
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/9781789344493_ColorImages.pdf.
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "To see the runlevel at the shell in real time, we can use the runlevel command."
A block of code is set as follows:
while <condition>do <command1> <command2
Any command-line input or output is written as follows:
$
[philip@localhost Desktop]$ who -r
run-level 5 2018-06-20 08:20 last=S
[philip@localhost Desktop]$
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Select System info from the Administration panel."
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packt.com.
This chapter covers viewing interrupts. It focuses on /proc/interrupts, CPU info viewing (/proc/cpuinfo), and viewing the physical memory installed. It also looks at /proc/meminfo, the free command, viewing swap memory, and adding and removing additional swap memory using the dd, mkswap, swapon, and swapoff commands. The raid status (viewing/proc/mdstat) is outlined, as is the devices directory /dev, the /proc virtual directory, the lsmod command and usage, the modprobe command and its usage, and the lspci command and usage. The /proc directory is a virtual filesystem that is created upon boot up which stores various items of hardware information about a system.
First, let's get all of the smokescreens out of the picture. Navigating through the various directories and using these commands is very informative, and allows you to retrieve hardware information in a Linux environment.
We will cover the following topics in this chapter:
Viewing CPU, RAM, and swap info
Interrupts and devices
Modules
Now let's switch gears and look at the Interrupt Requests (IRQs) and devices that are available in our Linux system. You can think of an interrupt as a service hotline that we would use whenever we need a particular item. We would ring a service hotline. The theory remains the same for devices within a Linux system; whenever it requires the CPU's attention, it sends out signals via interrupts. Traditional 32-bit architectures support up to 16 interrupts: 0–15. Newer architectures support far more than 16 interrupts.
Let's take a look at the /proc directory once again, homing in on /proc/interrupts:
More interrupts are shown in the following screenshot:
Some more interrupts are shown in the following screenshot:
From the preceding output, we can see that there are far more interrupts available. The output is read from left to right, where left represents the interrupt number, and moving to the right indicates the devices or services that are using the interrupts. We can see that the timer is using interrupt 0.
Now, let's turn our attention to devices. When we work with devices in a Linux system, the devices are represented by files. This enables us to communicate with the actual hardware in the system. There are some commonly used devices, such as hard disk, DVDs, and USBs, to name a few. Hard disks are represented as sd(n); for example: /dev/sda, /dev/sdb, /dev/sdc, and so on. Hard disk partitions are represented in the form of sd(n); for example: /dev/sda1, /dev/sda2, /dev/sdb1, and so on. Similarly, floppy disks are represented as fd. There are some special use-case files, such as /dev/null, /dev/zero, and /dev/tty*. You would use /dev/null when you want to send output from another command and the output is not needed. This is known as redirecting. /dev/zero is used in conjunction with the dd command that we covered earlier, for creating blank files. /dev/tty* is used for remote logins. Let's take a look at how devices are shown in the Linux environment.
We will take a look at /proc/devices using our test Linux system:
From the preceding output, the hard disk and partition are represented in the format of /dev/sdXY, where X represents the hard disk and Y represents the partition. We can tell the ls command to filter the output to only the hard disk and partition information:
root@trainer-virtual-machine:~# ls /dev/sd*
/dev/sda /dev/sda1 /dev/sda2 /dev/sda3 /dev/sda4
root@trainer-virtual-machine:~#
Have you ever wondered what happened to the term drivers in a Linux environment? Well, wonder no more. Most people coming from a Microsoft Windows background are accustomed to interacting with hardware through the use of drivers. Well, in Linux, we refer to drivers as modules. It's not as scary as it sounds. We load and unload modules whenever we are working with a piece of hardware. For example, when we plug in a USB drive, a module is loaded into the backend and is unloaded automatically when we remove the USB drive. It's that flexible.
Let's take a look at how we can view the modules that are installed in the Linux system, using the lsmod command:
More modules that are available for use are shown in the following screenshot:
From the preceding output, we can see that a number of modules are available for use in this Linux system. We read the output from left to right, where we see a 0 value under the Used by column. It means that the module is not currently in use.
Now let's look at the process to remove a module using the rmmod command. We will remove the usbhid module, since it's not currently in use. We can quickly verify this is not in use by using lsmod | grep usbhid:
root@trainer-virtual-machine:~# lsmod | grep usbhidusbhid 49152 0
Great! Let's go ahead and remove that module using the rmmod command:
root@trainer-virtual-machine:~# rmmod usbhid
root@trainer-virtual-machine:~#
root@trainer-virtual-machine:~# lsmod | grep usbhid
root@trainer-virtual-machine:~#
There we go; the usbhid module is no longer loaded in the Linux system. It still, however, resides there because it was compiled in the kernel. There are only a few options to pass with rmmod. Here, they are on an Ubuntu distro:
Similarly, here are the options to pass with the rmmod on a CentOS 7 distro:
In order for us to reinstall this usbhid module, we will use another popular command, insmod. Let's see how insmod works at the shell:
root@trainer-virtual-machine:~# insmod usbhid
insmod: ERROR: could not load module usbhid: No such file or directory
root@trainer-virtual-machine:~#
Now, based on the preceding output, it may seem to be contradictory that the insmod command is unable to find the usbhid module. Don't worry, this module is compiled in the kernel. That being said, we can use yet another helpful command, modprobe. This by far, is more popular than insmod, as modprobe actually calls insmod in the backend whenever we add a module using modprobe. Interestingly enough, modprobe can be used to remove module(s) too. It does this by calling rmmod in the backend.
So, let's use modprobe to install the usbhid module at the shell.
root@trainer-virtual-machine:~# modprobe -v usbhid
insmod /lib/modules/4.4.0-24-generic/kernel/drivers/hid/usbhid/usbhid.ko
root@trainer-virtual-machine:~#
We used the (-v) option with modprobe because, by default, it will not show what is happening in the background. As you can see, modprobe is indeed calling insmod in the backend. Now we can remove this usbhid module using modprobe, and we will see that it is indeed calling rmmod in the backend:
root@trainer-virtual-machine:~# modprobe -r -v usbhid
rmmod usbhid
root@trainer-virtual-machine:~#
From the preceding output, it is evident that modprobe is indeed calling rmmod to remove a module.
Here are some options that can be used with the modprobe command on an Ubuntu distro:
More options that can be passed with the modprobe command are shown in the following screenshot:
Some more options that can be passed with the modprobe command are shown in the following screenshot:
And here are some options that can be used with the modprobe command on a CentOS 7 distro:
Some more options that can be passed with the modprobe command are shown in the following screenshot:
More options that can be passed with the modprobe command are shown in the following screenshot:
In this chapter, we focused on hardware settings, looking at the CPU, RAM, and swap information in the various directories. We used a variety of commands. Also, we touched on IRQs and the various interrupts available in a Linux system. We then looked at devices, in the context of files. Finally, we worked with modules. We saw the various modules currently available in a Linux system, and learned the steps to install and remove a module.
In the next chapter, we will focus on the process of booting the system. Moreover, the various boot managers will be covered. This is another critical aspect for every Linux engineer to get to grips with. Simply put, without a boot manager, the system won't be able to boot unless we boot off some form of media. Gaining the knowledge will put you, as a Linux engineer, ahead of other so-called engineers. You will be at a greater advantage regarding certification after completing the next chapter. I hope to see you soon.
Which directory is created as a virtual file system?
A. /dev B. /lib C. /procD. None of the above
What is the command to view the CPU info?
A. less /proc B. more /proc C. cat /proc D. cat /proc/cpuinfo
What is the command to view RAM inside the
/proc
directory?
A. tail /proc/free B. less /proc/free C. cat /proc/meminfo D. cat /proc/RAM
Which option with the
free
command displays the memory info in a friendly format?
A. free -F B. free -L C. free -h D. free –free
What command is used to tell the system that a file is a
swap
file?
A. doswap B. format swap C. mkswap D. swap
What command is used to activate a
swap
file?
A. Swap B. onSwap C. swap D. swapon
What command is used to display the swap partition info?
A. mkswap B. swapon C. swap D. swapoff
Which devices file can redirect messages to be sent for discard?
A. /dev/discard B. /dev/null C. /dev/redirect D. None of the above
What command is used to display currently available modules in a Linux system?
A. insmod B. depmod C. rmmod D. lsmod
What command is used to install a module without having to specify the absolute path?
A. rmmod B. modules C. modrm D. modprobe
This website will give you all of the necessary information about the current CompTIA Linux+ certification:
https://www.comptia.org/
This website will give you details relating to LPI exams, specifically the LPIC - Level 1 that you earn by passing both CompTIA Linux+ exams:
http://www.lpi.org/
This last website gives you details about the various Linux kernels available:
https://www.kernel.org/
In the previous chapter, we covered the common hardware settings we manage on a daily basis. We touched on some commands that can be used to identify the hardware within a Linux system. This chapter continues from there and takes a further step, this time focusing on the process of booting the system. It looks at the GRUB and GRUB2 configuration files, focusing on the timer, default boot entry, and passing arguments to the GRUB/GRUB2 boot menu. It also covers the chkconfig, pstree, ps, systemctl, and dmeg commands, and the various start/stop scripts.
We will cover the following topics in this chapter:
The boot process explained
Understanding GRUB and GRUB2
Working with GRUB
Working with GRUB2
In Linux, during boot up, the looks for the boot sector on the hard disk. Once it finds the boot sector, it then searches for a boot loader. The boot loader in turn loads the boot manager. In Linux, this will usually be either GRUB or GRUB2. After this stage, the user is presented with a boot menu. Finally, the user is given the opportunity to either select an operating system to load or edit an existing entry. The options available are usually going to be different versions of the Linux kernel. Sometimes, it might may an entirely different Linux distribution. However, in mixed environments, you may be come into contact with another operating system, such as Microsoft Windows.
After the user selects a Linux kernel, depending on the Linux distribution release, a single process is started, known as init, which stands for initialization. init is often referred to as System V init or SysV, because System V was the first commercial Unix operating system. Most early Linux distributions were identical to the System V operating system. The other daemon used to manage a Linux distribution is known as systemd, which stands for System Management Daemon. The following is a simple flow of the process that we just discussed:
Boot Sector > Boot Loader > Boot Menu => OS loads
Before we go deeper, let's keep in mind one of the biggest differences between init and systemd: init starts scripts one at a time, whereas systemd starts multiple scripts parallel to each other. That being said, here is the output from the pstree command on a CentOS 5 system that uses init:
From the preceding output, we can see all of the processes originating from init; hence, they are considered child processes.
Another command we can leverage to see the actual process number being used by init is the ps command in our CentOS 5 system:
[philip@localhost Desktop]$ ps -aux
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.3 0.1 19364 1524 ? Ss 05:48 0:01 /sbin/init
root 2 0.0 0.0 0 0 ? S 05:48 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S 05:48 0:00 [migration/0]
root 4 0.0 0.0 0 0 ? S 05:48 0:00 [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S 05:48 0:00 [migration/0]
root 6 0.0 0.0 0 0 ? S 05:48 0:00 [watchdog/0]
root 7 0.2 0.0 0 0 ? S 05:48 0:00 [events/0]
root 8 0.0 0.0 0 0 ? S 05:48 0:00 [cgroup]
root 9 0.0 0.0 0 0 ? S 05:48 0:00 [khelper]
root 10 0.0 0.0 0 0 ? S 05:48 0:00 [netns]
root 11 0.0 0.0 0 0 ? S 05:48 0:00 [async/mgr]
root 12 0.0 0.0 0 0 ? S 05:48 0:00 [pm]
root 13 0.0 0.0 0 0 ? S 05:48 0:00 [sync_supers]
root 14 0.0 0.0 0 0 ? S 05:48 0:00 [bdi-default]
root 15 0.0 0.0 0 0 ? S 05:48 0:00 [kintegrityd/]
root 16 0.5 0.0 0 0 ? S 05:48 0:01 [kblockd/0]
From the preceding output, we can see that the first process started is PID 1, and it is indeed the init process.
Here are some options that we can use with the ps command:
[philip@localhost Desktop]$ ps --help
********* simple selection ********* ********* selection by list *********
-A all processes -C by command name
-N negate selection -G by real group ID (supports names)
-a all w/ tty except session leaders -U by real user ID (supports names)
-d all except session leaders -g by session OR by effective group name
-e all processes -p by process ID
T all processes on this terminal -s processes in the sessions given
a all w/ tty, including other users -t by tty
g OBSOLETE -- DO NOT USE -u by effective user ID (supports names)
r only running processes U processes for specified users
x processes w/o controlling ttys t by tty
*********** output format ********** *********** long options ***********
-o,o user-defined -f full --Group --User --pid --cols --ppid
-j,j job control s signal --group --user --sid --rows --info
-O,O preloaded -o v virtual memory --cumulative --format --deselect
-l,l long u user-oriented --sort --tty --forest --version
-F extra full X registers --heading --no-heading --context
********* misc options *********
-V,V show version L list format codes f ASCII art forest
-m,m,-L,-T,H threads S children in sum -y change -l format
-M,Z security data c true command name -c scheduling class
-w,w wide output n numeric WCHAN,UID -H process hierarchy
[philip@localhost Desktop]$
Now, let's turn our attention to systemd. We will run the pstree command on our Linux system:
From the preceding output, we can see all other processes being spawned by the system. These are known as child processes.
We can also run the pstree command on the CentOS 7 distro, and see similar results:
[philip@localhost ~]$ pstree
systemd─┬─ModemManager───2*[{ModemManager}]
├─NetworkManager─┬─dhclient
│ └─3*[{NetworkManager}]
├─VGAuthService
├─abrt-watch-log
├─abrtd
├─accounts-daemon───2*[{accounts-daemon}]
├─alsactl
├─anacron
├─at-spi-bus-laun─┬─dbus-daemon───{dbus-daemon}
│ └─3*[{at-spi-bus-laun}]
├─at-spi2-registr───2*[{at-spi2-registr}]
├─atd
├─auditd─┬─audispd─┬─sedispatch
│ │ └─{audispd}
│ └─{auditd}
├─avahi-daemon───avahi-daemon
├─chronyd
├─colord───2*[{colord}]
├─crond
├─cupsd
├─2*[dbus-daemon───{dbus-daemon}]
├─dbus-launch
├─dconf-service───2*[{dconf-service}]
├─dnsmasq───dnsmasq
Now, let's check which process number systemd is using on the Linux system by using the ps command:
root@ubuntu:/home/philip# ps -aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.5 185620 4996 ? Ss Jun19 0:05 /lib/systemd/systemd --system --d
root 2 0.0 0.0 0 0 ? S Jun19 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S Jun19 0:06 [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S< Jun19 0:00 [kworker/0:0H]
root 7 0.0 0.0 0 0 ? S Jun19 0:06 [rcu_sched]
root 8 0.0 0.0 0 0 ? S Jun19 0:00 [rcu_bh]
root 9 0.0 0.0 0 0 ? S Jun19 0:00 [migration/0]
root 10 0.0 0.0 0 0 ? S Jun19 0:00 [watchdog/0]
root 11 0.0 0.0 0 0 ? S Jun19 0:00 [kdevtmpfs]
root 12 0.0 0.0 0 0 ? S< Jun19 0:00 [netns]
root 13 0.0 0.0 0 0 ? S< Jun19 0:00 [perf]
root 14 0.0 0.0 0 0 ? S Jun19 0:00 [khungtaskd]
root 15 0.0 0.0 0 0 ? S< Jun19 0:00 [writeback]
root 16 0.0 0.0 0 0 ? SN Jun19 0:00 [ksmd]
root 17 0.0 0.0 0 0 ? SN Jun19 0:01 [khugepaged]
root 18 0.0 0.0 0 0 ? S< Jun19 0:00 [crypto]
root 19 0.0 0.0 0 0 ? S< Jun19 0:00 [kintegrityd]
root 20 0.0 0.0 0 0 ? S< Jun19 0:00 [bioset]
root 21 0.0 0.0 0 0 ? S< Jun19 0:00 [kblockd]
root 22 0.0 0.0 0 0 ? S< Jun19 0:00 [ata_sff]
root 23 0.0 0.0 0 0 ? S< Jun19 0:00 [md]
root 24 0.0 0.0 0 0 ? S< Jun19 0:00 [devfreq_wq]Some output is omitted for the sake of brevity.
From the preceding output, we can clearly see that the system is indeed listed as the first process started.
Now, in order for us to see the processes that have been started on the Linux distribution, we can run the chkconfig command on our CentOS 7 distribution:
[philip@localhost Desktop]$ chkconfig
NetworkManager 0:off 1:off 2:on 3:on 4:on 5:on 6:off
abrt-ccpp 0:off 1:off 2:off 3:on 4:off 5:on 6:off
abrtd 0:off 1:off 2:off 3:on 4:off 5:on 6:off
acpid 0:off 1:off 2:on 3:on 4:on 5:on 6:off
atd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
auditd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
blk-availability 0:off 1:on 2:on 3:on 4:on 5:on 6:off
bluetooth 0:off 1:off 2:off 3:on 4:on 5:on 6:off
cpuspeed 0:off 1:on 2:on 3:on 4:on 5:on 6:off
crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
cups 0:off 1:off 2:on 3:on 4:on 5:on 6:off
dnsmasq 0:off 1:off 2:off 3:off 4:off 5:off 6:off
firstboot 0:off 1:off 2:off 3:on 4:off 5:on 6:off
haldaemon 0:off 1:off 2:off 3:on 4:on 5:on 6:off
htcacheclean 0:off 1:off 2:off 3:off 4:off 5:off 6:off
httpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
ip6tables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
irqbalance 0:off 1:off 2:off 3:on 4:on 5:on 6:off
kdump 0:off 1:off 2:off 3:on 4:on 5:on 6:off
lvm2-monitor 0:off 1:on 2:on 3:on 4:on 5:on 6:off
mdmonitor 0:off 1:off 2:on 3:on 4:on 5:on 6:off
messagebus 0:off 1:off 2:on 3:on 4:on 5:on 6:off
netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
netfs 0:off 1:off 2:off 3:on 4:on 5:on 6:off
network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
In the preceding output, we are only shown daemons that use init. This is useful on systems running native init, such as earlier Linux distributions.
Here are the most commonly used options that can be passed with the chkconfig command for older Linux distributions that use init:
--level levels
Specifies the runlevels an operation should pertain to. It is given as a string of numbers from 0 to 6.
For example, --level 35 specifies runlevels 3 and 5.
--add name
This option adds a new service for management by chkconfig. When a new service is added, chkconfig.
ensures that the service has either a start or a kill entry in every runlevel. If any runlevel is missing such an entry, chkconfig creates the appropriate entry as specified by the default values in the init script. Note that default entries in LSB-delimited INIT INFO sections take precedence over the default runlevels in the initscript; if any required-start or required-stop entries are present, the start and stop priorities of the script will be adjusted to account for these dependencies.
--del name
The service is removed from chkconfig management, and any symbolic links in /etc/rc[0-6].d which pertain to it are removed.
Note that future package installs for this service may run chkconfig --add, that will re-add such links. To disable a service, run chkconfig name off.
--override name
If the service name is configured exactly as it would be if the --add option had been specified with no override file in /etc/chkconfig.d/name, and if /etc/chkconfig.d/name now exists and is specified differently from the base initscript, this changes the configuration for the service name to follow the overrides instead of the base configuration.
--list name
This option lists all of the services that chkconfig knows about, and whether they are stopped or started in each runlevel. If a name is specified, information is only displayed about the service name.
For us to see the daemons started in newer Linux distributions, we will use the systemctl command:
[philip@localhost ~]$ systemctl
add-requires hybrid-sleep reload-or-restart
add-wants is-active reload-or-try-restart
cancel is-enabled rescue
cat is-failed reset-failed
condreload isolate restart
condrestart is-system-running set-default
condstop kexec set-environment
daemon-reexec kill set-property
daemon-reload link show
default list-dependencies show-environment
delete list-jobs snapshot
disable list-sockets start
edit list-timers status
emergency list-unit-files stop
enable list-units suspend
exit mask switch-root
force-reload poweroff try-restart
get-default preset unmask
halt reboot unset-environment
help reenable
hibernate reload
[philip@localhost ~]$
From the preceding output, we can see a variety of options that can be passed with the systemctl command; we will use the list-unit-files option with systemctl:
[philip@localhost ~]$ systemctl list-unit-files
UNIT FILE STATE
proc-sys-fs-binfmt_misc.automount static
dev-hugepages.mount static
dev-mqueue.mount static
proc-fs-nfsd.mount static
proc-sys-fs-binfmt_misc.mount static
sys-fs-fuse-connections.mount static
sys-kernel-config.mount static
sys-kernel-debug.mount static
tmp.mount disabled
var-lib-nfs-rpc_pipefs.mount static
brandbot.path disabled
cups.path enabled
systemd-ask-password-console.path static
systemd-ask-password-plymouth.path static
systemd-ask-password-wall.path static
Some output is omitted for the sake of brevity:
umount.target static
virt-guest-shutdown.target static
[email protected] disabled
fstrim.timer disabled
[email protected] static
systemd-readahead-done.timer indirect
systemd-tmpfiles-clean.timer static
392 unit files listed.
From the preceding output, we can see 392 units are listed. We can be more specific and look for only the services that are enabled/running:
[philip@localhost ~]$ systemctl list-unit-files | grep enabled
cups.path enabled
abrt-ccpp.service enabled
abrt-oops.service enabled
abrt-vmcore.service enabled
abrt-xorg.service enabled
abrtd.service enabled
accounts-daemon.service enabled
atd.service enabled
auditd.service enabled
[email protected] enabled
avahi-daemon.service enabled
bluetooth.service enabled
chronyd.service enabled
crond.service enabled
cups.service enabled
dbus-org.bluez.service enabled
dbus-org.fedoraproject.FirewallD1.service enabled
dbus-org.freedesktop.Avahi.service enabled
dbus-org.freedesktop.ModemManager1.service enabled
dbus-org.freedesktop.NetworkManager.service enabled
dbus-org.freedesktop.nm-dispatcher.service enabled
display-manager.service enabled
dmraid-activation.service enabled
firewalld.service enabled
We can also see the status, the directory from where the daemon is being executed along with the Process ID (PID) for a daemon with the systemctl command. We will use the status option:
[philip@localhost ~]$ systemctl status sshd.service
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2018-06-20 09:35:31 PDT; 1h 43min ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 1072 (sshd)
CGroup: /system.slice/sshd.service
└─1072 /usr/sbin/sshd -D
[philip@localhost ~]$
We can also stop, start, restart, enable, and disable a daemon with the systemctl command. Let's say we want to stop the ssd service using the systemctl command. We would simply do this:
[philip@localhost ~]$ systemctl stop sshd
Now, as soon as we press Enter on the CentOS 7 system, we will get an authentication prompt because we are attempting to stop the sshd service as a standard user:
Now we'll enter the root password:
And now the sshd service has been stopped:
[philip@localhost ~]$ systemctl stop sshd
[philip@localhost ~]$
Now let's recheck the status of the sshd service to confirm it has indeed stopped, using the systemctl command:
[philip@localhost ~]$ systemctl status sshd.service
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: inactive (dead) since Wed 2018-06-20 11:20:16 PDT; 21min ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 1072 (code=exited, status=0/SUCCESS)
[philip@localhost ~]$
From the preceding code, we can conclude that the sshd service has been stopped.
Now, when the system is booting, there are a number of messages relating to various aspects of our system, ranging from hardware to services, that fly across the screen quickly. It would be useful to be able to view those messages while troubleshooting. It's always useful to gather as much information as possible to aid troubleshooting.
We can leverage yet another powerful command, the dmesg command:
philip@ubuntu:~$ dmesg
[ 0.000000] Initializing cgroup subsys cpuset
[ 0.000000] Initializing cgroup subsys cpu
[ 0.000000] Initializing cgroup subsys cpuacct
[ 0.000000] Linux version 4.4.0-128-generic (buildd@lcy01-amd64-019) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9) ) #154-Ubuntu SMP Fri May 25 14:15:18 UTC 2018 (Ubuntu 4.4.0-128.154-generic 4.4.131)
[ 0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.4.0-128-generic root=UUID=adb5d090-3400-4411-aee2-dd871c39db38 ro find_preseed=/preseed.cfg auto noprompt priority=critical locale=en_US quiet
Some of the following output is omitted for the sake of brevity:
[ 13.001702] audit: type=1400 audit(1529517046.911:8): apparmor="STATUS" operation="profile_load" profile="unconfined" name="/usr/bin/evince" pid=645 comm="apparmor_parser"
[ 19.155619] e1000: ens33 NIC Link is Up 1000 Mbps Full Duplex, Flow Control: None
[ 19.156584] IPv6: ADDRCONF(NETDEV_CHANGE): ens33: link becomes ready
[ 105.095992] do_trap: 33 callbacks suppressed
[ 105.095996] traps: pool[2056] trap int3 ip:7f778e83c9eb sp:7f776b1eb6f0 error:0
philip@ubuntu:~$
From the preceding output, we can see various pieces of information, including CPU detection, PCI drivers, and Ethernet, to name a few.
Now, we'll switch gears and discuss the boot managers whose jobs are to present the boot menu, from which the user has the options to select which operating system/Linux kernel to load or edit. First, we will focus on GRUB and then move on to GRUB2.
GRUB stands for Grand Unified Bootloader. GRUB is primarily used for booting Linux distributions. However, GRUB can work with other boot loaders. A common use-case scenario is for dual booting with a Microsoft operating system, it does this by doing a hand-off to the Windows bootloader for Microsoft operating systems.
GRUB uses the /boot/grub/grub.conf file. Sometimes you will see /boot/grub/menu.lst, but this file, is simply a symbolic link to /boot/grub/grub.conf. Using the CentOS 6.5 distro, run the following command:
[root@localhost ~]# ls -l /boot/grub
total 274
-rw-r--r--. 1 root root 63 Jun 20 01:47 device.map
-rw-r--r--. 1 root root 13380 Jun 20 01:47 e2fs_stage1_5
-rw-r--r--. 1 root root 12620 Jun 20 01:47 fat_stage1_5
-rw-r--r--. 1 root root 11748 Jun 20 01:47 ffs_stage1_5
-rw-------. 1 root root 769 Jun 20 01:48 grub.conf
-rw-r--r--. 1 root root 11756 Jun 20 01:47 iso9660_stage1_5
-rw-r--r--. 1 root root 13268 Jun 20 01:47 jfs_stage1_5
lrwxrwxrwx. 1 root root 11 Jun 20 01:47 menu.lst -> ./grub.conf
-rw-r--r--. 1 root root 11956 Jun 20 01:47 minix_stage1_5
-rw-r--r--. 1 root root 14412 Jun 20 01:47 reiserfs_stage1_5
-rw-r--r--. 1 root root 1341 Nov 14 2010 splash.xpm.gz
-rw-r--r--. 1 root root 512 Jun 20 01:47 stage1
-rw-r--r--. 1 root root 126100 Jun 20 01:47 stage2
-rw-r--r--. 1 root root 12024 Jun 20 01:47 ufs2_stage1_5
-rw-r--r--. 1 root root 11364 Jun 20 01:47 vstafs_stage1_5
-rw-r--r--. 1 root root 13964 Jun 20 01:47 xfs_stage1_5
[root@localhost ~]#
From the preceding output, we can see /boot/grub/grub.conf and also the symbolic link /boot/grub/menu.lst.
We can view the actual /boot/grub/grub.conf file:
[root@localhost ~]# cat /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
# all kernel and initrd paths are relative to /boot/, eg.
# root (hd0,0)
# kernel /vmlinuz-version ro root=/dev/sda2
# initrd /initrd-[generic-]version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.32-431.el6.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.32-431.el6.x86_64 ro root=UUID=05527d71-25b6-4931-a3bb-8fe505f3fa64 rd_NO_LUKS rd_NO_LVM LANG=en_US.UTF-8 rd_NO_MD SYSFONT=latarcyrheb-sun16 crashkernel=auto KEYBOARDTYPE=pc KEYTABLE=us rd_NO_DM rhgb quiet
initrd /initramfs-2.6.32-431.el6.x86_64.img
[root@localhost ~]#
From the preceding output, the common options would be the following. default=0
