Unix and Linux Fundamentals: A New User’s Guide

Operating Systems:

It is an interface Between User and Hardware

Unix Flavors

  1. Linux

  2. Mac OS

  3. AIX

  4. Solaris

  5. HP-UX

Why Choose Linux?

  1. Multi-User & Multi-Tasking: Supports multiple users and tasks simultaneously.

  2. Open Source: Freely available and modifiable by anyone.

  3. Security: Built with strong security features.

  4. Resource Efficiency: Requires fewer resources compared to other operating systems.

  1. RHEL (Red Hat Enterprise Linux)

  2. CentOS

  3. Ubuntu

  4. Amazon Linux

  5. Fedora

  6. Linux Mint

  7. OpenSUSE

Architecture of Linux

Certainly! Here are some important concepts and topics related to Linux that can enhance your blog:

1. Kernel vs. User Space

  • Kernel: The core component of Linux that manages hardware resources and system calls. It operates in privileged mode.

  • User Space: The area where user applications run. These applications interact with the kernel through system calls.

2. Linux Boot Process

  • The boot process includes several stages: BIOS/UEFI initialization, bootloader (GRUB), kernel loading, and initialization of user space (init system).

3. Init Systems

  • Systemd: The most common init system in modern distributions, providing parallel startup, on-demand services, and managing system resources.

  • SysVinit: The traditional init system, using scripts to manage services.

4. Package Management Systems

  • APT (Advanced Package Tool): Used in Debian-based distributions like Ubuntu for managing software packages.

  • DNF (Dandified YUM): The next-generation version of YUM used in Fedora and RHEL-based systems.

5. Linux File Permissions

  • The permission model (read, write, execute for user, group, and others) and use chmod, chown, and chgrp effectively.

6. Processes and Job Control

  • Processes: Instances of running programs, which can be managed using commands like ps, top, and kill.

  • Job Control: Background and foreground processes can be managed using bg, fg, and jobs.

7. Networking Basics

  • Networking key concepts, such as IP addressing, subnetting, DNS, and common tools like ping, traceroute, and netstat.

8. Shell Scripting

  • Basics of writing shell scripts, including shebang (#!/bin/bash), variables, control structures (if statements, loops), and functions.

9. System Monitoring and Logs

  • Using tools like top, htop, vmstat, and iostat for performance monitoring. log files located in /var/log , can be used for troubleshooting.

10. Security Practices

  • Important to keep the system updated, using firewalls (like iptables or firewalld), and understanding SELinux/AppArmor for enhanced security.

11. Virtualization and Containers

  • We can use virtualization technologies (KVM, VirtualBox) and containerization (Docker, Podman) for creating isolated environments.

12. Cloud Integration

  • Linux plays a crucial role in cloud environments (AWS, Azure) and the use of cloud-init for instance initialization.

13. Common Troubleshooting Commands

  • Tools and commands for diagnosing issues, such as dmesg, journalctl, strace, and lsof.

File System Hierarchy in Linux

  1. / - The root directory, top level of the filesystem.

  2. /root - Home directory for the root user.

  3. /home - Home directories for other users.

  4. /boot - Contains bootable files for Linux.

  5. /etc - Stores configuration files.

  6. /usr - Default location for installed software.

  7. /bin - Contains user commands.

  8. /sbin - Commands used by the root user.

Basic Linux Commands

  • File and Directory Operations:

    • cat - Create and append files.

    • touch - Create a blank file.

    • nano, vi/vim - Create and edit files.

    • ls - List directory contents (-a, -la for detailed listing).

    • cd - Change directory.

    • pwd - Print working directory.

    • mkdir - Create directory, including multiple directories with -p.

    • cp - Copy files and directories.

    • mv - Move or rename files and directories.

    • rm - Remove files; rm -rf to remove directories recursively.

    • tree - View directory structure in tree format.

    • find - Search for files and directories (-type f for files, -type d for directories).

  • Viewing and Filtering Files:

    • grep - Search and print matching lines in files.

    • less, more - View file content page by page.

    • head - Display the first 10 lines of a file.

    • tail - Display the last 10 lines of a file.

    • sort - Sort file content alphabetically or numerically.

  • User and Group Management:

    • useradd, usermod, userdel - Manage users.

    • groupadd, groupmod, groupdel - Manage groups.

    • gpasswd - Manage group membership (-a to add, -M for multiple users, -d to delete).

    • passwd - Change user password.

    • chown - Change file owner.

    • chgrp - Change file group.

    • chmod - Change file permissions.

  • Networking and System Information:

    • hostname - Display or set the system hostname.

    • ifconfig - Display or configure network interfaces.

    • cat /etc/*rele* - Display operating system version.

  • Package Management with YUM:

    • yum install <package> - Install a package.

    • yum update <package> - Update a package.

    • yum remove <package> - Uninstall a package.

    • yum list installed - List installed packages.

    • service <service> status - Check the status of a service.

    • service <service> start - Start a service.

    • service <service> restart - Restart a service.

    • chkconfig <service> on - Enable a service to start at boot.

    • chkconfig <service> off - Disable a service from starting at boot.

  • Miscellaneous Commands:

    • tar - Archive files (-cvf to create, -xvf to extract).

    • gzip, gunzip - Compress and decompress files.

    • wget - Download files from the web.

    • which - Locate a command.

    • sudo - Execute a command as the root user.

    • whoami - Display the current user.

    • du -h - Display disk usage in a human-readable format.

Key Shortcuts and Tips

  • cat: End input with Ctrl+D.

  • nano: Save and exit with Ctrl+X.

  • Creating Nested Directories: Use mkdir -p dir1/dir2.

  • Deleting Directories: Use rm -rf to remove directories recursively.

  • Usinggrep: Example: grep root /etc/passwd.

  • Viewing Files: Use less /etc/passwd, head -3 /etc/passwd.

  • Sorting Files: Use sort <filename>.

  • Creating Links: ln -s for soft links, ln for hard links.

  • Managing Tar Archives: tar -cvf to create, tar -xvf to extract.

  • Compressing Files: Use gzip to compress and gunzip to decompress.

This overview provides a solid foundation for understanding and working with Linux, emphasizing its flexibility, efficiency, and security.

further detailed tutorials for your better referance:

1] https://youtu.be/_tCY-c-sPZc?si=hXVQGssvs0GblPcG

2] https://youtu.be/mzmqwtR8w-Q?si=INu_eMqzd0rfNSRR

3] https://youtu.be/CTZfWmMAdoI?si=P5EkriId5qoznpnw

0
Subscribe to my newsletter

Read articles from Anushka Bhujang Pawar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Anushka Bhujang Pawar
Anushka Bhujang Pawar