Table of contents : Cover Title Page Copyright and Credits Dedication About Packt Contributors Table of Contents Preface Chapter 1: Getting Started with CentOS 7 Preparing to install CentOS 7 Getting the right hardware Getting the software Finalizing server setup details Performing manual installation Accessing the command line using the console Starting a Terminal Command-line syntax and structure Exiting the shell Introducing the Bash shell Bash shell and command execution Tab completion Command-line editing shortcuts The history command Command aliases Listing current aliases Setting an alias Removing an alias Summary Chapter 2: Command-Line and Filesystem Navigation Understanding the CentOS 7 filesystem hierarchy Using man pages and the help command Different types of documentation available in Linux Using the man command Using the GNU info command Using the help command and the --help option Other sources of documentation Managing filenames with path expansion File globbing Wildcard expansion Tilde expansion Brace expansion Command substitution Quoting and escaping File naming conventions Managing files using command-line tools Navigation commands File management commands Managing archives and compressed files Compression gzip and gunzip compression bzip2 and bunzip2 compression xz compression zip Archiving Archiving with tar Archiving and compression (.gzip) using tar Archiving, compression (.bzip2), and listing contents using tar Archiving and compression (.xz) using tar Summary Chapter 3: Managing Text Files Different methods to create a text file Create a text file using the cat command Create an empty text file using the touch command Create a text file using the redirection symbol (>) Create a text file using the echo or printf command Create a text file using the vi editor Editing files with the vi editor Working with files in vi editor Insert Mode Line Mode Determining line numbers in Line Mode of vi editor How to execute external commands in Line Mode Command Mode Using text file manipulation tools Different types of editor used to view file content less command more command cat command tac command head command tail command wc command file command Viewing compressed files cut command sort command uniq command paste command Redirecting output to files and programs Pipes tee command Using grep for text matching Text extraction using sed and awk sed awk Finding a file (locate and find commands) Locate Find Summary Chapter 4: User and Group Management Understanding users and groups in CentOS 7 Defining a user Identifying the current user Understanding groups in Linux Executing commands as superuser in CentOS 7 Switching users with the su command Disadvantages of using the su command to grant root access to a normal user Using sudo to run commands as the root user Creating, modifying, or deleting local user accounts Creating a user with the useradd command Modifying a user with the usermod command Deleting a user account with the userdel command Creating, modifying, or deleting local group accounts Creating supplementary groups with groupadd Modifying existing groups with the groupmod command Deleting a group with the groupdel command Managing user passwords and aging policies Setting a user password using the passwd command Understanding the shadow password file Understanding password aging parameters Restricting user access Fake shell or nologin shell Summary Chapter 5: Managing File Permissions Understanding Linux filesystem permissions Effect of permissions on files and directories Viewing applied permissions and ownership Managing file permissions Modifying file permissions with chmod using symbols Managing file permissions with chmod using numbers Managing file ownership Understanding default ownership Modifying user ownership with chown Modifying group ownership with chown Modifying both user and group ownership with chown Modifying group ownership with chgrp Special permissions Modifying special permissions for files Modifying special permission, for directories Using sticky bit Using setgid Managing default permissions Understanding umask Managing ACL on files Viewing ACL permissions Using getfacl ACL mask Modifying ACL permissions Using setfacl Removing an ACL Summary Chapter 6: Process Management Understanding processes Defining a process Process creation on a Linux system Processes types Interactive processes Batch processes Daemons Threads Kernel threads Process states Viewing current processes Listing running processes The ps command Displaying processes running from the current shell Displaying all processes by their user Displaying all processes in different formats Sorting processes based on different parameters Displaying processes by user Displaying process information by name Displaying process details by PID Displaying a process hierarchy in a tree style Displaying the child processes of a parent Displaying the thread of a process Displaying the pid of a process if the process name is known Using the pstree command Finding the PID of a running process Using the pgrep command pidof The ps command with grep Communicating with processes using signals Defining a signal and its types Sending signals to processes Sending signals to processes by PID using the kill command Sending signals to multiple processes by name killall pkill Monitoring processes and load averages Understanding load averages on Linux uptime w Real-time interactive process monitoring top Managing a processes' priority with nice and renice Understanding priority Modifying priority Viewing the priority of a process Modifying the priority of a new process (nice value) Modifying the priority of a running process (renice) Controlling jobs on the command line Understanding different terms related to job management Jobs management with its associated controlling Terminal Foreground processes or jobs Background processes or jobs Suspending a foreground process to the background Managing jobs in the background Summary Chapter 7: Managing Networking in CentOS Linux networking concepts Common terms used in Linux networking IP address IPv4 IPv6 Different classes of IP addressing Public classes Private classes Loopback address Link-local address or APIPA Netmask Gateway Hostname Nameserver NetworkManager Network interface naming conventions Using Linux networking commands Viewing IP address details Using the IP command Using ifconfig command Netstat Viewing the routing information Using the ip route command Using route command Using netstat command Gateway Viewing nameserver details Network troubleshooting utilities Using ethtool command Using ping command Using tracepath command Using traceroute command Using mtr command Verifying DNS connectivity Using nslookup command Using host command Using dig command Finding local ports and services information Using the ss command Using the netstat command Web utilities Graphical and non-graphical web browsers Command-line file downloader (wget) Command-line download and upload using curl Managing a network with nmcli Defining basic terms Device or interface Connection Displaying network information using nmcli Creating network connections using nmcli Modifying network interfaces using nmcli Editing network configuration files Configuring networking options in static and dynamic modes Configuring hostnames and name resolutions Displaying and modifying the hostname Modifying nameservers (DNS sever) Accessing remote logins with SSH Understanding OpenSSH Executing commands over SSH remotely Key-based SSH authentication Configuring ssh-keygen for password-less authentication Creating a SSH key pair Configuring and securing SSH logins Transferring files in Linux Secure file transfer using SCP Local to remote filesystem file transfer Remote to local filesystem file transfer Synchronizing files using rsync Synchronizing data locally from one folder to another for backup Synchronizing data from a local to remote host filesystem Synchronizing data from remote host to local filesystem Summary Chapter 8: Software Package Management Managing applications using RPM Anatomy of a RPM What happens when you update an application Using RPM to query options with RPM packages Verifying RPM package signatures Using RPM to install packages Using rpm to remove packages Using RPM to upgrade packages Using RPM to verify packages Importing a RPM GPG key Managing applications using YUM Understanding the YUM package manager Using the YUM command line Finding an application using yum Installing applications using YUM Displaying packages and their information with YUM Removing applications using yum Updating applications and the system using yum Managing groups of applications using YUM Using YUM history Managing application repositories using YUM Handling other miscellaneous options of yum Managing official and third-party repositories Official repositories of CentOS 7 Third-party repositories Creating custom repositories Summary Chapter 9: Overview of Essential Advance Utilities Understanding system logging Working with rsyslog Configuring rsyslogd sections Rsyslogd facilities and priorities Rsyslogd rules Log file rotation Analyzing syslog entries Monitoring live log file traffic using the tail command Using the logger command Working with systemd-journald Finding events with the journalctl command Configuring systemd-journald to store logs persistently Understanding how to control the system and services Defining essential terms What is a daemon? What is a socket? What is systemd? What are units? What is systemctl? Working with systemd and systemctl Viewing states of service with systemctl Viewing unit files with systemctl Unit dependencies and unit file structure Managing daemons using systemctl Masking services Controlling the boot process using systemd What are systemd targets? Switching your targets at runtime Changing the default target of the system Understanding SELinux concepts SELinux contexts Viewing SELinux context Working with SELinux Changing SELinux modes Using setenforce for runtime changes Setting default modes of SELinux Modifying file context Using restorecon for restoring the default context Using chon for context management Using semanage for context management Modifying port context Managing SELinux Booleans Managing SELinux troubleshooting Using sealert for troubleshooting Understanding firewall concepts in CentOS 7 Firewalld concepts Firewalld zones Firewalld services Managing firewalld Using the firewalld-cmd command-line tool Using the firewalld-config graphical tool Working with firewalld Summary Other Books You May Enjoy Index