Linux Training Guide (Naresh Bhaisare)(Z-Library)
Author: Naresh Bhaisare
Linux
No Description
📄 File Format:
PDF
💾 File Size:
4.7 MB
11
Views
0
Downloads
0.00
Total Donations
📄 Text Preview (First 20 pages)
ℹ️
Registered users can read the full content for free
Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.
📄 Page
1
(This page has no text content)
📄 Page
2
(This page has no text content)
📄 Page
3
Linux Training Guide Quick reference guide to deal with Linux kernel based operating systems Naresh Bhaisare www.bpbonline.com
📄 Page
4
First Edition 2026 Copyright © BPB Publications, India ISBN: 978-93-65898-309 All Rights Reserved. No part of this publication may be reproduced, distributed or transmitted in any form or by any means or stored in a database or retrieval system, without the prior written permission of the publisher with the exception to the program listings which may be entered, stored and executed in a computer system, but they can not be reproduced by the means of publication, photocopy, recording, or by any electronic and mechanical means. LIMITS OF LIABILITY AND DISCLAIMER OF WARRANTY The information contained in this book is true and correct to the best of author’s and publisher’s knowledge. The author has made every effort to ensure the accuracy of these publications, but the publisher cannot be held responsible for any loss or damage arising from any information in this book. All trademarks referred to in the book are acknowledged as properties of their respective owners but BPB Publications cannot guarantee the accuracy of this information. www.bpbonline.com
📄 Page
5
Dedicated to My beloved wife: Sulbha and My daughter Ananya
📄 Page
6
About the Author Naresh Bhaisare is a seasoned system software engineer and Linux enthusiast with over 17 years of experience in system programming, embedded development, and cloud technologies. He holds master of technology in computer science from IIT Bombay and has worked extensively with Linux-based systems, kernel development, and open- source tools. Throughout his career, Naresh has contributed to large-scale software projects, developed custom Linux distributions, and optimized system performance for various enterprise solutions. His expertise spans programming languages such as C, C++, Python, and Bash scripting, along with a deep understanding of networking, security, and automation. Passionate about knowledge sharing, Naresh has mentored aspiring developers and conducted training sessions on Linux kernel internals and shell scripting. With this book, he aims to provide a practical, hands-on guide to mastering essential Linux commands and tools, making it accessible to both beginners and experienced users alike.
📄 Page
7
Acknowledgement I extend my deepest gratitude to my family and friends for their unwavering support and encouragement throughout the writing of this book—especially my wife, Sulbha, and my daughter, Ananya, whose patience and belief in me have been a constant source of strength. My heartfelt thanks go-to BPB Publications for their guidance, professionalism, and expertise in bringing this book to life. This journey involved countless revisions and refinements, made possible by the dedicated efforts of reviewers, technical experts, and editors who supported the vision of this work. I am equally grateful to my colleagues and coworkers from across my years in the tech industry. Their insights, collaboration, and constructive feedback have shaped my understanding and enriched the content of this book in meaningful ways. I would also like to express my sincere appreciation to my current employer, Sasken Technologies Limited, and to my managers for their support and encouragement. Their flexibility and understanding allowed me to devote a significant amount of time for writing this book. Finally, I extend my gratitude to you—the readers. Your interest, curiosity, and support are what make this effort worthwhile. Thank you for giving this book a place in your learning journey.
📄 Page
8
Preface Linux has long been known as the operating system that powers the backbone of modern computing—servers, supercomputers, embedded devices, and even the smartphone in your pocket. Yet for many beginners and even working professionals, Linux often feels intimidating, fragmented, or too terminal-heavy to approach with confidence. Linux in Your Pocket was written to change that. This book is designed as a practical, concise, and hands-on guide that takes you from the foundations of Linux to real-world usage across desktop, server, and Android environments. Whether you are a student exploring Linux for the first time, an engineer sharpening command-line skills, or an Android developer stepping into the Linux layer beneath the mobile OS, this book serves as your go-to quick reference. Across 179 pages, the book maintains a balance between foundational knowledge and practical execution. Commands are explained with real examples, concepts are broken down into digestible sections, and each chapter reinforces skills that apply directly to everyday development and system administration tasks. My hope is that Linux in Your Pocket becomes the book you keep open beside your terminal, the one you return to when you need clarity, and the one that helps you build confidence as you navigate the Linux ecosystem. Whether you are taking your first step or refining your expertise, this book aims to make Linux accessible, powerful, and—most importantly—yours. Welcome to the journey. Enjoy exploring Linux—one command at a time. Chapter 1: Introduction to Linux - This chapter lays the foundation for understanding Linux by exploring its rich history, evolution, and modern- day significance. It begins with a look back at the origins of Unix and how Linux emerged as a free, open-source alternative that has since become a
📄 Page
9
dominant force in the world of operating systems. The chapter introduces the philosophy of open-source software and highlights key milestones in Linux's development. It then explains the concept of distributions (distros), comparing major ones like Ubuntu, Fedora, Debian, and Arch Linux to help users choose the most suitable version for their needs. Readers will also learn how to install Linux in various ways—via a live USB, as a dual-boot system alongside Windows, or through a virtual machine for safer experimentation. Finally, the chapter covers the basic Linux file system structure, introducing essential directories such as /bin, /home, /etc, and the root /, along with an overview of file permissions. Chapter 2: Essential Linux Commands - This chapter introduces the core Linux commands that every user must know to navigate and operate effectively within the Linux environment. It begins with navigating the file system using commands like cd, pwd, and ls, while explaining the difference between absolute and relative paths. Readers then dive into essential file and directory operations, learning how to create, move, rename, and delete files and folders using commands such as mkdir, rmdir, touch, rm, mv, and cp. The chapter also covers methods for viewing and editing file contents using tools like cat, less, head, tail, and text editors such as nano, vim, and gedit. Finally, it provides a detailed explanation of Linux file permissions, including how to read permission symbols using ls - l, and how to modify them using chmod and chown. Chapter 3: Process and Task Management - This chapter focuses on managing and controlling processes in a Linux system, a crucial skill for maintaining system performance and stability. It begins with process monitoring, introducing tools like ps, top, and htop to view real-time system activity and identify running processes. Readers will learn how to terminate unresponsive or unwanted processes using commands such as kill, pkill, and killall. The chapter then explores job control, explaining how to run tasks in the background using & and nohup, and how to switch tasks between the foreground and background with fg, bg, and jobs. Finally, it covers task scheduling, demonstrating how to automate recurring jobs with cron and schedule one-time tasks with the at command. Chapter 4: File System Maintenance - This chapter provides a comprehensive guide to maintaining the Linux file system—ensuring system reliability, efficient storage use, and smooth user operations. It
📄 Page
10
begins by introducing different Linux-supported file system types (ext4, XFS, Btrfs) and how to identify them using tools like lsblk and blkid. It then explores directory and file management using essential commands like mkdir, rm, find, and locate. Readers will learn how to manage permissions and ownership with chmod, chown, and chgrp, which are crucial for system security and multi-user environments. The chapter continues with disk usage monitoring and mounting procedures, explaining how to work with partitions and file systems using tools such as mount, umount, df, du, fdisk, and mkfs. Lastly, it covers file system health checks and repairs using fsck, tune2fs, and e2label. Chapter 5: Networking and Remote Access - This chapter introduces the fundamentals of networking in Linux and guides users through accessing and managing remote systems. It starts with checking and understanding network configurations using tools like ifconfig, ip, ping, and netstat, enabling users to diagnose connectivity issues and monitor network interfaces. The chapter then delves into remote access using Secure Shell (SSH), covering how to set up and configure SSH servers and clients, use key-based authentication, and implement best practices for securing remote connections. Additionally, it explores efficient methods for transferring files between systems using scp and rsync, both of which are essential for remote administration and backups. Chapter 6: Shell Scripting Basics - This chapter introduces the power and flexibility of shell scripting in Linux, enabling users to automate tasks and streamline system operations. It begins with the basics of writing and running shell scripts—covering how to create script files, add the appropriate shebang (#!/bin/bash), make them executable, and execute them from the terminal. The chapter then explores essential programming constructs such as variables, loops (for, while), and conditional statements (if, case) to help build dynamic and responsive scripts. Through clear examples and hands-on practice, readers will learn how to write scripts that perform logical operations and respond to different conditions. Chapter 7: Text Processing and Data Manipulation - This chapter focuses on powerful command-line tools in Linux that are used to search, modify, and manipulate text data—essential skills for managing logs, configuration files, and large datasets. It begins with the use of grep, sed, and awk—versatile tools for searching patterns, performing in-place text
📄 Page
11
replacements, and extracting structured data from files. The chapter then dives into sorting and filtering text with commands like sort, uniq, cut, and paste, which help organize and restructure data efficiently. Additionally, it introduces diff for comparing files and identifying changes, a crucial tool for version control and troubleshooting. Chapter 8: User Management and System Monitoring - This chapter covers essential system administration tasks, focusing on managing users and monitoring overall system performance. It starts with user management —explaining how to create and delete user accounts, set passwords, and assign users to groups using tools like useradd, passwd, and usermod. The chapter then revisits file and process permissions, detailing how to control access using chmod, chown, and group ownership to ensure system security and data integrity. Finally, it explores system monitoring tools such as top, vmstat, and iotop, which help track CPU usage, memory performance, and disk activity in real-time. Additionally, it introduces journalctl for accessing system logs, aiding in diagnostics and troubleshooting. Chapter 9: Package Management and Software Installation - This chapter introduces the tools and techniques used to manage software on a Linux system through package managers. It begins with an overview of popular package managers such as apt (Debian/Ubuntu), yum and dnf (RHEL/CentOS/Fedora), and pacman (Arch Linux), explaining how each handles software installation and maintenance. Readers will learn how to search for, install, update, and remove software packages directly from the command-line, as well as how to deal with repositories and package sources. The chapter also covers system updates and how to resolve common issues like broken dependencies and version conflicts. By understanding package management, users can maintain a secure, efficient, and up-to-date Linux system. Chapter 10: Basic Security Practices - This chapter introduces fundamental security practices that help protect a Linux system from unauthorized access and potential threats. It begins by explaining user roles and permission structures, emphasizing the importance of assigning correct access rights and limiting privileges to minimize risk. The chapter then covers firewall configuration using tools like ufw and iptables, along with strategies for managing and securing open network ports. A significant portion is dedicated to securing SSH access—disabling root login,
📄 Page
12
implementing SSH key-based authentication, and hardening the SSH server through proper configuration. Lastly, it explores methods for encrypting sensitive files and directories using tools such as gpg, openssl, and ecryptfs. Chapter 11: Performance Monitoring and Optimization - This chapter focuses on keeping a Linux system running smoothly by monitoring resource usage and applying optimization techniques. It begins with tools like htop, vmstat, and iotop to monitor real-time CPU, memory, and disk usage, helping users quickly spot resource-heavy processes. The chapter then moves into optimizing system performance by cleaning up log files, uninstalling unused software, and managing swap space to improve memory efficiency. It also covers strategies for troubleshooting slow performance, including identifying system bottlenecks, analyzing system logs, and tuning kernel or application-level parameters. Chapter 12: Linux Commands for Android - This chapter bridges the gap between Linux and Android by introducing essential Linux-based commands and tools used in Android development and debugging. It explores how Android leverages the Linux kernel and provides command- line access through Android Debug Bridge (ADB). Readers will learn how to connect to Android devices, access the shell, manage files, inspect logs, and interact with system processes—all from a Linux terminal. The chapter also covers advanced usage like pushing and pulling files, granting permissions, installing/uninstalling APKs, and rebooting devices into recovery or bootloader mode. For Android developers, testers, and power users, this chapter provides a practical toolkit for controlling Android devices through Linux with speed and precision.
📄 Page
13
Code Bundle and Coloured Images Please follow the link to download the Code Bundle and the Coloured Images of the book: https://rebrand.ly/4a29c8 The code bundle for the book is also hosted on GitHub at https://github.com/bpbpublications/Linux-Training-Guide. In case there’s an update to the code, it will be updated on the existing GitHub repository. We have code bundles from our rich catalogue of books and videos available at https://github.com/bpbpublications. Check them out! Errata We take immense pride in our work at BPB Publications and follow best practices to ensure the accuracy of our content to provide with an indulging reading experience to our subscribers. Our readers are our mirrors, and we use their inputs to reflect and improve upon human errors, if any, that may have occurred during the publishing processes involved. To let us maintain the quality and help us reach out to any readers who might be having difficulties due to any unforeseen errors, please write to us at : errata@bpbonline.com Your support, suggestions and feedbacks are highly appreciated by the BPB Publications’ Family. At www.bpbonline.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 BPB books and eBooks. You can check our social media handles below:
📄 Page
14
Instagram Facebook Linkedin YouTube Get in touch with us at: business@bpbonline.com for more 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 business@bpbonline.com 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 www.bpbonline.com. We have worked with thousands of developers and tech professionals, just like you, to help them share their insights 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. Reviews 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 BPB can understand what you think about our products, and our authors can see your feedback on their book. Thank you! For more information about BPB, please visit www.bpbonline.com. Join our Discord space Join our Discord workspace for latest updates, offers, tech happenings around the world, new releases, and sessions with the authors: https://discord.bpbonline.com
📄 Page
15
Table of Contents 1. Introduction to Linux Introduction Structure Objectives History and evolution of Linux Understanding distributions Linux family tree Common distributions Choosing a distribution Installation methods Linux file system structure Key directories File permissions and ownership Conclusion 2. Essential Linux Commands Introduction Structure Objectives Overview of commands Commands required by general users ls: List directory contents cd: Change the current directory cp: Copy files and directories
📄 Page
16
mv: Move or rename files rm: Remove files or directories mkdir: Make directories chmod: Change file permissions chown: Change file owner and group touch: Create or update file timestamps find: Search for files in a directory hierarchy locate: Find files using a prebuilt index echo: Display a line of text cat: Concatenate and display file content head: Output the first part of the files tail: Output the last part of files more: View text one screen at a time less: Advanced file viewer pwd: Print working directory reboot: Restart the system shutdown: Power off or restart the system stat: Display detailed information about a file cut: Extract fields or columns from text uname: Display system information uptime: Show system uptime hostname: Display or set the system hostname free: Show memory usage whoami: Print effective username id: Display user and group IDs su: Switch user sudo: Execute command as another user man: Display manual pages date: Display or set the system date and time grep: Search for patterns in files zip: Package and compress files tar: Archive files
📄 Page
17
nano: Simple terminal-based text editor vim: Powerful modal text editor gedit: GNOME graphical text editor Conclusion 3. Process and Task Management Introduction Structure Objectives Process management commands Managing processes ps: Listing processes top: Real-time view of processes htop: Interactive process viewer nice: Start a process with a specified priority renice: Change priority of a process kill: Send a signal to a process killall: Kill all processes by name pkill: Send signal to processes by name Job control jobs: Display background jobs in the current shell fg: Bring the background job to foreground bg: Resume background job nohup: Run command immune to hangups &: Run a command in the background disown: Remove job from the shell job table strace: Trace system calls and signals lsof: List open files by processes watch: Run a command repeatedly pidof: Get PID of a process by name pmap: Show memory map of a process
📄 Page
18
taskset: Set or retrieve CPU affinity systemctl: Manage system services ionice: I/O priority management Scheduling tasks schedtool: Query/set scheduling policy crontab: Job in a recurring manner. at: Schedule one-time job at <TIME>: To schedule a job that needs to be executed only once in the future atq: To list the scheduled jobs atrm: To remove any scheduled job from the list Conclusion 4. File System Maintenance Introduction Structure Objectives Understanding file system types Identifying file system types Directory management Navigating the directory tree Viewing directory contents Creating and removing directories Viewing directory structures File operations Creating files Copying files Moving and renaming files Deleting files Locating files Quickly finding files
📄 Page
19
Permissions and ownership Understanding file permissions Changing permissions with chmod Changing ownership with chown Changing group owner with chgrp Disk partitioning and management Viewing block devices Creating partitions with fdisk Creating partitions with parted Creating file system image Using mkfs tools Create an ext4 filesystem image Optionally mount to populate Using genext2fs / mkfs.ext2/3/4 with a directory Using mksquashfs (for read-only compressed FS) Using dd for raw disk/partition images Create cpio (for initramfs) Mounting and unmounting file systems Managing disk usage and quotas Cleaning up and optimizing disk space Checking and repairing file systems Conclusion 5. Networking and Remote Access Introduction Structure Objectives Fundamentals of networking in Linux Accessing and managing remote systems Remote file editing via SSH FTP/SFTP
📄 Page
20
Checking network configurations Interface configurations Modern network interface tool Connectivity test Network statistics Using Secure Shell for remote access Installing and starting SSH server Connecting to a remote system Key-based authentication Securing SSH Remote file transfer Secure copy Remote synchronization Conclusion 6. Shell Scripting Basics Introduction Structure Objectives Understanding shell scripting Writing and running shell scripts Setting up your environment Checking your shell Creating a script file Shebang line Making the script executable Executing the script Basic scripting concepts Using variables Accepting user input Command substitution
The above is a preview of the first 20 pages. Register to read the complete e-book.
Recommended for You
Loading recommended books...
Failed to load, please try again later