DEV Community

Shubham Srivastava
Shubham Srivastava

Posted on • Edited on

Linux operating system and basic of shell scripting

Introduction

Image description

An operating system (OS) serves as the crucial bridge between your software applications and the underlying hardware of a computer. It manages and facilitates communication between various software programs and the hardware components, ensuring a seamless and efficient computing experience.

Ubuntu vs. Windows

When comparing Ubuntu and Windows, several factors make Ubuntu stand out:

  1. Free and Open Source: Ubuntu is freely available, open-source software. Users can download, use, and modify it without any cost, fostering a collaborative and supportive community.

  2. Security: Ubuntu's Linux-based architecture is inherently more secure than Windows. Its robust security features, combined with regular updates, help protect against vulnerabilities and threats.

  3. Distributions: Ubuntu offers various distributions tailored for different purposes, such as server deployments, desktop use, or specialized applications. This flexibility allows users to choose the version that best fits their needs.

  4. Speed: Ubuntu tends to be faster and more lightweight than Windows, making it a preferred choice for users seeking optimal performance, especially on older hardware.

OS Diagram Model

Image description

The OS diagram model encompasses several key components:

  1. Kernel: The core of the operating system that interfaces between software and hardware. It manages device and memory resources, processes, and handles system-related calls.

  2. System Libraries: Collections of pre-compiled routines and functions that facilitate communication between the kernel and software applications.

  3. Compilers: Tools that convert source code into machine-readable code, enabling the execution of user programs.

  4. User Process: The space where user applications and processes run, interacting with the kernel and system libraries.

Fundamentals of Shell Scripting

Shell scripting involves using commands to communicate with the operating system. It is especially valuable in server environments where graphical user interfaces (GUIs) may be impractical. Key points include:

  1. Shell Scripting Definition: The use of commands within a shell to automate tasks and interact with the operating system.

  2. Server Environments: Due to the resource-intensive nature of GUIs, servers often rely on shell scripting for efficiency and resource optimization.

  3. Common Commands:

    • cd: Change directory
    • pwd: Print working directory
    • ls: List files and directories
    • mkdir: Create a new directory
    • touch: Create an empty file
    • vi: Text editor; press i to insert text, :wq! to save, and exit
    • cat: Display file content
    • cd ..: Move up one directory level
    • clear: Clear the terminal screen
    • rm: Remove a file
    • rm -r: Remove a directory and its contents
  4. System Information:

    • df -h: Display disk space usage
    • nproc: Show the number of CPUs
    • top: Display system information, processes, and resource usage

By understanding these fundamental concepts, users can navigate and interact with the operating system efficiently, automate tasks through shell scripting, and make informed choices when selecting an operating system for their needs.

Getting started with Amazon Ec2 ➑️

Top comments (0)