Linux Yourself: Concept and Programming

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Numerous people still believe that learning and acquiring expertise in Linux is not easy, that only a professional can understand how a Linux system works. Nowadays, Linux has gained much popularity both at home and at the workplace. Linux Yourself: Concept and Programming aims to help and guide people of all ages by offering a deep insight into the concept of Linux, its usage, programming, administration, and several other connected topics in an easy approach. This book can also be used as a textbook for undergraduate/postgraduate engineering students and others who have a passion to gain expertise in the field of computer science/information technology as a Linux developer or administrator.

The word "Yourself" in the title refers to the fact that the content of this book is designed to give a good foundation to understand the Linux concept and to guide yourself as a good Linux professional in various platforms. There are no prerequisites to understand the contents from this book, and a person with basic knowledge of C programming language will be able to grasp the concept with ease. With this mindset, all the topics are presented in such a way that it should be simple, clear, and straightforward with many examples and figures.

Linux is distinguished by its own power and flexibility, along with open-source accessibility and community as compared to other operating systems, such as Windows and macOS. It is the author’s sincere view that readers of all levels will find this book worthwhile and will be able to learn or sharpen their skills.

KEY FEATURES

  • Provides a deep conceptual learning and expertise in programming skill for any user about Linux, UNIX, and their features.
  • Elaborates GUI and CUI including Linux commands, various shells, and the vi editor
  • Details file management and file systems to understand Linux system architecture easily
  • Promotes hands-on practices of regular expressions and advanced filters, such as sed and awk through many helpful examples
  • Describes an insight view of shell scripting, process, thread, system calls, signal, inter-process communication, X Window System, and many more aspects to understand the system programming in the Linux environment
  • Gives a detailed description of Linux administration by elaborating LILO, GRUB, RPM-based package, and program installation and compilation that can be very helpful in managing the Linux system in a very efficient way
  • Reports some famous Linux distributions to understand the similarity among all popular available Linux and other features as case studies

Author(s): Sunil K. Singh
Publisher: CRC Press
Year: 2021

Language: English
Pages: 474
City: Boca Raton

Cover
Half Title
Title Page
Copyright Page
Dedication
Table of Contents
Preface
Acknowledgments
Author
Section I: Linux Concept
1. Getting Started
1.1 Getting Started with OS
1.2 A Brief Overview of Unix and Linux
1.3 Unix/Linux History
1.4 The GNU Project
1.4.1 Open-Source Software
1.5 Features and Advantages of Linux
1.5.1 Advantages
1.6 Linux Distributions
1.7 Installation Procedure and Issues
1.7.1 Linux Installation
1.7.2 Key Issues to Install Linux
1.7.3 Key Steps of Linux Installation
1.8 Linux Architecture
1.9 Shell and Its Features
1.10 An Overview of Kernels
1.10.1 Kernel Module
1.10.2 Linux Versions
1.11 The GNOME and KDE Desktops
1.11.1 The Window Manager for GUI
1.11.2 GNOME Desktop
1.11.3 KDE Desktop
1.12 Boot Loaders
1.12.1 BIOS
1.13 Linux Interface: GUI and CUI
1.14 Login and Logout
1.14.1 Login
1.14.2 Logout
1.14.3 Switching Users
1.14.4 Shutdown
1.15 Start-Up Scripts and Run Levels
1.15.1 Start-Up Script
1.15.2 Run Levels (init, inittab, and rc Files)
1.16 Summary
1.17 Review Exercises
References
2. Linux Commands
2.1 Command Syntax, Options, and Arguments
2.2 Internal and External Commands
2.3 Command Location and User Commands
2.3.1 User Commands
2.3.2 Universal Commands
2.3.3 System Commands
2.4 Communication and Other Commands
2.7 Summary
2.8 Review Exercises
References
3. The Shell
3.1 What is a Shell?
3.2 Why Use a Shell in Linux?
3.3 The Login Shell (Shell Prompt)
3.4 Command Line Structure of Shells
3.5 sh Command
3.6 Basics and Interpretive Cycle of Shells
3.7 Starting a Terminal Shell
3.8 Shell Variables: User-Defined and Predefined
3.8.1 Global Variables
3.8.2 Local Variables
3.8.2.1 Variable “Type”
3.8.2.2 Creating and Setting User-Defined Variables: =, $, set(export), unset
3.8.2.3 How to Set a Local variable into a Global Environment Variable
3.8.2.4 How to Unset a Local Variable from a Global Environment Variable
3.8.2.5 How to Set the PATH Environment Variable
3.9 Various Shell Types
3.9.1 Bourne Shell (sh)
3.9.2 Bourne Again Shell (bash)
3.10 Command Execution
3.10.1 Sequence Commands
3.10.2 Grouped Commands
3.10.3 Chained Commands
3.10.4 Condition Commands
3.11 Standard Input/Output Redirection
3.12 Pipes
3.13 tee Command
3.14 xargs Command
3.15 Backslash (\) and Quotes
3.16 Building Shell Commands
3.17 Shell Scripts
3.18 Summary
3.19 Review Exercises
References
4. vi Editor
4.1 Introduction
4.1.1 Invoke vi
4.2 Modes in vi Editor
4.3 Start, Edit, and Close Files
4.3.1 Editing
4.3.2 Saving Your Work and Quitting
4.3.3 Open and Recover File from a Crash (:recover and -r)
4.4 Various vi Commands
4.4.1 Moving the Cursor
4.4.2 Inserting or Appending Text
4.4.3 Replacing Text
4.4.4 Undoing Mistakes
4.4.5 Screen Navigation
4.4.6 Deleting Text
4.4.7 Cutting, Pasting, and Copying Text
4.5 Global Replacement
4.6 Command Combinations
4.7 vi Programming
4.8 vim (vi Improved) and nvi (New vi)
4.9 GNOME Editor: gedit
4.9.1 Key Features of gedit
4.10 Emacs Editor and Commands
4.10.1 Starting and Quitting emacs
4.11 Summary
4.12 Review Exercises
References
5. Regular Expressions and Filters
5.1 Regular Expressions
5.1.1 What’s the Variance between BRE and ERE?
5.1.2 Meaning of Various Characters and Metacharacters in Regular Expressions
5.2 grep Family
5.2.1 grep Associated with Exit Status
5.3 Other Regular Filters (with Examples)
5.3.1 cat: Concatenate Files and Display the File Contents
5.3.2 The comm Command: to Compare Two Sorted Files Line by Line
5.3.3 The cut Command: Remove Sections from Each Line of Files
5.3.4 The expand Command: to Convert Tabs into Spaces
5.3.5 The compress Command: to Compress Data
5.3.6 The fold Command: to Break Each Line of Input Text to Fit in Specified Line Width
5.3.7 The head Command: to Display the Starting Part of File
5.3.8 The more Command: File Checking Filter for Control Viewing
5.3.9 The less Command: to Scroll and View Text
5.3.10 The nl Command: to Number the Lines in a File
5.3.11 Perl: Practical Extraction and Report Language
5.3.12 The pr Command: Formatting Text Files for Printing
5.3.13 The split Command: to Break a File into Parts
5.3.14 The strings Command: to Print the Strings of Printable Characters in Files
5.3.15 The tail Command: to Display the Ending Part of a File
5.3.16 The tac Command: to Concatenate and Print Files in Reverse
5.3.17 The tee Command: to Duplicate Standard Input
5.3.18 The tr Command: to Translate Characters
5.3.19 The uniq Command: to Report or Omit Repeated Lines
5.3.20 The sort Command: to Sort Lines of a Text File
5.3.21 The wc Command: to Count Lines, Words, and Characters
5.3.22 The zcat Command: to Display Contents of Compressed Files
5.4 Summary
5.5 Review Exercises
References
6. Advanced Filters: sed
6.1 Pattern-Matching Programming Language
6.2 sed Overview
6.3 Basic Syntax and Addressing of sed
6.4 Writing sed Scripts
6.5 Basic sed Commands
6.5.1 Substitute Patterns
6.5.2 Replacement Characters
6.5.3 Append, Insert, and Change
6.5.4 The Delete Command and the Use of the Exclamation Sign (!)
6.5.5 The Transform Command
6.5.6 Pattern and Hold Spaces
6.5.7 Quit
6.6 Advanced sed Commands
6.7 sed Advantages
6.8 sed Drawbacks
6.9 Summary
6.10 Review Exercises
References
7. Advanced Filters: awk
7.1 Awk Introduction and Concept
7.2 Awk Features over Sed
7.3 Structure of an AWK Program
7.4 Writing and Executing AWK Program
7.4.1 To Make Executable awk Programs
7.4.2 Standard Options with awk
7.5 Awk Patterns and Actions
7.5.1 Pattern
7.5.2 Actions
7.6 BEGIN and END Patterns
7.7 Awk Variables
7.8 Records and Fields
7.9 Simple Output from AWK
7.9.1 The print Statement
7.10 Fancier Output
7.10.1 Output into Files
7.11 Arithmetic and Variables
7.11.1 Constant
7.11.2 Variable
7.12 Computing with AWK
7.13 Handling Text
7.14 String Manipulation
7.15 Array and Operators
7.15.1 Multidimensional Arrays
7.15.2 Operators in awk
7.16 Built-in Functions
7.17 Summary
7.18 Review Exercises
References
8. Shell Scripting
8.1 Shell Script
8.2 Creating a Script
8.3 Making a Script Executable: chmod
8.3.1 Path of Script File
8.4 Interactive Script: Read
8.5 Shell Variable
8.5.1 Positional Parameter Variable: Command-Line Arguments
8.5.2 Environment Variable
8.6 Shell Arithmetic
8.6.1 Arithmetic Operator
8.6.2 Logical Operator
8.6.3 Conditional Operator
8.7 Control Structure
8.7.1 if Statement
8.7.2 if then else Statement
8.7.3 while Statement
8.7.4 do-while Statement
8.7.5 Loop (for) Statement
8.7.6 switch/case Statement
8.8 String Operators
8.9 Functions
8.10 Advanced Shell Scripting
8.10.1 Array
8.10.2 Test command
8.11 Examples of Shell Scripting Program
8.12 Summary
8.13 Review Exercises
References
9. Linux System Administration
9.1 Checking Space
9.2 Disk Usage Limit
9.3 Kernel Administration
9.3.1 Listing Kernel Modules with lsmod
9.4 Compiling and Installing
9.5 Modifying
9.6 LILO and GRUB
9.6.1 LInux LOader
9.6.2 GRand Unified Boot loader
9.7 Root User (add sudo)
9.8 Additional Packages
9.8.1 Red Hat Package Manager
9.8.2 Installation and Uninstallation
9.9 GNOME and KDE
9.10 Installing and Managing Software on RPM-Based Systems
9.11 Installing Programs from Source Code
9.12 Network Management: telnet, rlogin, and rdesktop Commands
9.12.1 Connect Windows desktop from Linux system
9.13 Summary
9.14 Review Exercises
References
Section II: Linux Programming
10. File Management
10.1 Filename and Type
10.1.1 Hidden Filenames
10.1.2 File Type
10.2 Linux File System Architecture
10.3 File and Directory Structure
10.3.1 Root (/) Directory
10.3.2 Home Directories
10.3.3 Pathnames
10.3.4 System Directories
10.4 Inodes
10.5 File Operation
10.5.1 Creating files: touch, cat
10.5.2 Listing Files: ls:
10.5.3 Displaying Files: cat, more, head, and less:
10.5.4 Printing Files: lpr, lpq, and lprm
10.5.5 Searching and Linking File: find, ln
10.6 Directories
10.6.1 Special Directories
10.6.2 Paths and Pathnames: Absolute, Relative
10.6.3 Creating and Deleting Directories mkdir, rmdir
10.6.4 Displaying Directory Contents: ls
10.6.5 Moving through Directories cd
10.6.6 Locate Directory: pwd
10.6.7 Scanning Directories: opendir, readdir, telldir, seekdir, and closedir
10.7 Archiving and Compressing Files
10.7.1 Archiving and Compressing Files with File Roller
10.7.2 Archive Files and Devices: tar
10.7.3 File Compression: gzip, bzip2, and zip
10.8 File and Directory Attributes: ls –l, ls –d
10.9 File Permissions: chmod, chown, chdir, getcwd, unlink, link, symlink
10.10 Summary
10.11 Review Exercises
References
11. Linux File Systems
11.1 Introduction
11.2 Disk Partitioning
11.3 Disk Partition into File System
11.4 File System Layout
11.5 Managing File System
11.5.1 File system Types
11.6 Mounting File Systems
11.6.1 Automounting Devices
11.6.2 Creating File System
11.6.3 Checking and Repairing File systems: fsck
11.7 Errors: strerror, perror
11.8 The /proc File System
11.9 The Linux File System: ext, ext2, ext3, ext4, Journaling
11.10 Logical Volume Management (LVM)
11.11 Virtual File System (VFS)
11.12 File System Conversion
11.12.1 Converting ext2 to ext3
11.12.2 Converting ext2 to ext4
11.12.3 Converting ext3 to ext4
11.13 Summary
11.14 Review Exercise
References
12. Linux System Programming
12.1 Getting Started
12.1.1 Editing with vim
12.1.2 Program Compilation with gcc/g++ Compiler
12.1.3 Automate Program Execution with GNU Make Utility
12.1.4 GNU Debugger (GDB)
12.2 File I/O
12.3 Processes
12.3.1 Listing Processes, PID, PPID
12.3.2 Process State
12.3.3 Process Context
12.3.4 Creation of New Process: fork(), vfork(), execv(), system()
12.3.5 Terminating Process
12.3.6 Process Priorities
12.3.7 Zombie and Daemon Process
12.4 Threads
12.4.1 Thread Creation
12.4.2 Thread Kill or Termination
12.4.3 Thread Data Structure
12.4.4 Synchronization, Critical Section, and Semaphore
12.4.5 Demarcation between Process and Thread
12.5 Device File
12.6 Signals
12.7 Various System Calls
12.8 POSIX
12.9 Summary
12.10 Review Exercise
References
13. Linux Inter-Process Communications
13.1 Basic Concept
13.2 Shared Memory
13.2.1 System V Shared Memory API
13.2.2 POSIX Shared Memory APIs
13.3 Message Queue
13.3.1 System V Message Queues
13.3.2 POSIX Message Queues
13.4 Pipes: Named and Unnamed
13.4.1 Creating pipes in C
13.4.2 named pipes : FIFO
13.5 Sockets
13.6 Summary
13.7 Review Exercises
References
14. X Window System Overview and Programming
14.1 X window System and Its Customization
14.1.1 X Client, X Server, and X-Protocol
14.1.2 Xlib
14.2 X Toolkits
14.2.1 Window Manager: Motif
14.3 Creating and Managing A Window
14.3.1 Basic Window Concept
14.3.2 Window Operation
14.4 Starting and Stopping X
14.5 X Architecture and Application
14.5.1 Client and Server Architecture
14.6 The X Programming Model
14.6.1 Xlib Overview
14.6.2 Xlib Usage
14.6.3 Event-Driven Applications
14.7 Desktop Environment
14.7.1 KDE
14.7.2 GNOME
14.8 Upgrading X Window Tools
14.9 Summary
14.10 Review Exercise
References
Section III: Case Studies
15. Linux Distributions (Linux Distro)
15.1 Getting Started with Various Linux Distributions
15.1.1 Why So Many Distros?
15.2 Red Hat Enterprise Linux /Fedora
15.3 Debian GNU/Linux:
15.4 Ubuntu Linux:
15.5 Ethical a spects of using Linux:
References
Index