Applications in Linux


⚙️ Applications in Linux

🔹 How Applications Run

  • Every application, when executed, creates a process with:

    • A unique Process ID (PID)
    • Allocated CPU and RAM

🔸 Types of Applications:

1. Executables

  • Applications started manually from the command line
  • A process is created only when run
  • Example: Classroom software, command-line tools

2. Daemons / Services

  • Background processes that provide long-running services
  • Common for server applications (e.g., sshd, httpd, postgres)
  • Can be enabled to start automatically on boot

🔧 Managing Services (Daemons)

  • Use the systemctl command (available in all modern Linux distributions) to:

    • Start / Stop / Enable / Disable / Check status of daemons
    • Example:

      sudo systemctl start apache2
      sudo systemctl enable apache2
      sudo systemctl status apache2
      

📦 Installing Applications in Linux

1. Build from Source Code

  • Compile source code manually using tools like make, gcc
  • Example workflow:

    ./configure
    make
    sudo make install
    

2. Using Packages

a. Debian-Based:

  • Use .deb files
  • Tools: dpkg, apt

    • Example: sudo apt install tree

b. Red Hat-Based:

  • Use .rpm files
  • Tools: rpm, dnf

    • Example: sudo dnf install tree

3. Package Managers

  • Handle dependencies, repositories, and updates
  • Debian: apt
  • Red Hat: dnf (or yum in older versions)

🖥️ Linux Boot Process – What Happens When Linux Starts?

  1. BIOS/UEFI

    • Initializes hardware and checks components
  2. Bootloader (GRUB)

    • Loads the OS kernel into memory
  3. Kernel

    • Allocates memory and starts the first process
  4. Init System (e.g., systemd)

    • The first process (PID 1)
    • Responsible for starting all other system services and processes
  5. Daemons and User Sessions

    • Daemons like networking, logging, SSH, etc., are loaded
    • Eventually, user sessions (GUI or terminal) are made available

👤 Users and Groups in Linux

🔑 Special User Groups:

  • sudo group (Debian/Ubuntu):

    • Members can use sudo to run commands with elevated (root) privileges
  • wheel group (Red Hat/CentOS/Fedora):

    • Equivalent to sudo group, used for privilege escalation via sudo

🏠 Home Directory:

  • User's personal directory: /home/<username>
  • Users have read/write/execute permissions here
  • Example:

    cd /home/john
    

⚠️ Root User:

  • Has access to all files and commands
  • Home directory is /root

📂 Linux Folder Structure Overview

Directory Purpose
/ Root of the entire file system
/home Home directories for users
/root Home directory for the root user
/etc Configuration files
/bin Essential binary executables
/sbin System binaries (root/admin tools)
/usr User-installed applications and files
/var Variable files like logs, databases
/tmp Temporary files
/dev Device files
/proc Virtual filesystem with process info
/lib Shared libraries needed by binaries