0% found this document useful (0 votes)
1 views

Module I

Module I provides an introduction to Operating Systems (OS) and Linux, covering basic elements, functions, types, and security. It details the core components of an OS, such as the kernel, shell, and file system, and explains Linux features, commands, and file manipulation techniques. The module also discusses process management, user management, and file security within Linux, emphasizing its open-source nature and versatility.

Uploaded by

yashingole20031
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views

Module I

Module I provides an introduction to Operating Systems (OS) and Linux, covering basic elements, functions, types, and security. It details the core components of an OS, such as the kernel, shell, and file system, and explains Linux features, commands, and file manipulation techniques. The module also discusses process management, user management, and file security within Linux, emphasizing its open-source nature and versatility.

Uploaded by

yashingole20031
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 44

Module I: Introduction to Operating System and Linux

Module I: Introduction to Operating


System and Linux

Basic Elements of OS, OS Functions, Types of
OS, OS Terminologies,
Linux Command Line, Linux Features, Basic
Navigation, Files and Directories, Manual
Pages, File Manipulation, Wildcards,
Permissions, File Hierarchy, Filters, Grep and
Regular Expressions, Piping and Redirection,
Process Management, User Management, File
Security, Shell Scripting,
Security in Operating Systems.
Basic Elements of OS
Definition of an Operating System:
An Operating System (OS) is software that
manages computer hardware and software
resources, and provides common services for
computer programs.
It acts as an intermediary between users and
the computer hardware, making it easier to run
applications and perform tasks.
Core Components:
Kernel:
Shell:
File System:
User Interface:
Kernel:
The core of the OS that manages system
resources, including CPU, memory, and I/O
devices.
It controls everything in the system, ensuring
that hardware and software interact effectively.
Shell:
The user interface that allows users to interact
with the OS.
It interprets commands entered by the user and
translates them into actions that the OS can
execute.
File System:
Manages how data is stored and retrieved on
storage devices.
It organizes data into files and directories,
making it easy for users to locate and manipulate
information.
User Interface:
Provides a way for users to interact with the
computer, either through a Command-Line
Interface (CLI) or a Graphical User Interface
(GUI).
OS Functions
Process Management
 Memory Management
Storage Management
Process Management:
 Process: A process is a program in execution. The OS manages
processes by allocating resources like CPU time, memory, and
I/O devices, ensuring that multiple processes can run
simultaneously without interfering with each other.
 Multitasking: The ability of an OS to execute multiple
processes at the same time. The OS switches between processes
rapidly, giving the illusion of simultaneous execution.
 Process Scheduling: The OS determines which process runs at
any given time based on various scheduling algorithms, such as
First-Come, First-Served (FCFS), Shortest Job Next (SJN), and
Round-Robin (RR).
Inter-Process Communication (IPC): Mechanisms that
allow processes to communicate and synchronize their
actions, such as through pipes, message queues, shared
memory, and semaphores
Memory Management:
Memory Allocation: The OS allocates memory
to processes and ensures that each process has
enough memory to execute. It also tracks
which parts of memory are in use and by which
processes.
Paging and Segmentation: Techniques used
by the OS to manage memory efficiently.
Paging divides memory into fixed-sized pages,
while segmentation divides memory into
variable-sized segments. Both techniques help
in handling large data and programs efficiently.
Storage Management:
File Systems: The OS provides a way to store,
organize, and access data on storage devices
through file systems like NTFS(New
Technology File System), FAT(File Allocation
Table ), EXT(Extended File System)4, etc.
Disk Management: Involves managing disk
partitions, file allocation, and ensuring efficient
storage and retrieval of data.
Types of OS
Batch Operating System:
Time-Sharing Operating System
Distributed Operating System:
Embedded Operating System:
Real-Time Operating System (RTOS):
Batch Operating System:
Executes a series of jobs without manual
intervention. Jobs are collected and
processed in batches.

Time-Sharing Operating System:
Allows multiple users to share system
resources simultaneously, providing each
user with a time slice of CPU.

Distributed Operating System:
Manages a group of independent computers
and makes them appear to be a single
computer. It enables resource sharing and
communication between systems.

Embedded Operating System:
Designed to run on embedded systems like
routers, smart appliances, and industrial
machines, with a focus on efficiency and
reliability.

Real-Time Operating System (RTOS):
Provides immediate processing and response
to input, critical for applications requiring
consistent timing (e.g., medical devices,
robotics).
Linux
Linux is an open-source operating system
(OS) that serves as a foundation for managing
hardware and software resources on a
computer.
It is widely known for its stability, security,
and versatility, making it popular for servers,
desktops, embedded systems, and mobile
devices.

Linux Features:
Open Source: Linux is open-source software,
meaning its source code is freely available for
modification and distribution.
Security: Linux is known for its robust
security features, including user permissions,
encryption, and firewall settings.
Portability: Linux can run on a variety of
hardware platforms, making it highly versatile.
Multiuser and Multitasking: Linux supports
multiple users working simultaneously and can
handle multiple tasks at once.
 1. ls - List Directory Contents
 Command: ls
 Example: ls -l
 Description: Lists files and directories in the current directory in long format,
showing details like permissions, ownership, and file size.
 2. cd - Change Directory
 Command: cd [directory_path]
 Example: cd /home/user/Documents
 Description: Changes the current directory to the specified path.
 3. pwd - Print Working Directory
 Command: pwd
 Example: pwd
 Description: Displays the current working directory path.
 4. mkdir - Make Directory
 Command: mkdir [directory_name]
 Example: mkdir new_folder
 Description: Creates a new directory with the specified name.
 5. rmdir - Remove Directory
 Command: rmdir [directory_name]
 Example: rmdir old_folder
 Description: Removes an empty directory.
 6. cp - Copy Files or Directories
 Command: cp [source] [destination]
 Example: cp file1.txt /home/user/Documents/
 Description: Copies a file or directory from the source to the destination.
 7. mv - Move or Rename Files or Directories
 Command: mv [source] [destination]
 Example: mv old_name.txt new_name.txt
 Description: Moves a file or directory or renames it.
 8. rm - Remove Files or Directories
 Command: rm [file_name]
 Example: rm file1.txt
 Description: Removes a file. Use rm -r [directory_name] to remove a directory
and its contents recursively.
 9. touch - Create an Empty File
 Command: touch [file_name]
 Example: touch newfile.txt
 Description: Creates a new empty file with the specified name.
 10. cat - Concatenate and Display File Contents
 Command: cat [file_name]
 Example: cat file1.txt
 Description: Displays the content of the specified file.
 11. nano or vi - Text Editors
 Command: nano [file_name] or vi [file_name]
 Example: nano notes.txt
 Description: Opens a file in the nano or vi text editor for editing.
 12. grep - Search Text Using Patterns
 Command: grep [pattern] [file_name]
 Example: grep 'search_term' file1.txt
 Description: Searches for the specified pattern within the file and displays
matching lines.
 13. chmod - Change File Permissions
 Command: chmod [permissions] [file_name]
 Example: chmod 755 script.sh
 Description: Changes the file permissions. For example, 755 gives the owner full
permissions, and others read and execute permissions.
 14. chown - Change File Ownership
 Command: chown [owner] [file_name]
 Example: chown user:group file1.txt
 Description: Changes the ownership of a file to a specified user and group.
 15. find - Search for Files
 Command: find [directory] -name [file_name]
 Example: find /home/user/ -name "*.txt"
 Description: Searches for files by name within the specified directory.
 16. df - Disk Space Usage
 Command: df -h
 Example: df -h
 Description: Displays the disk space usage of file systems in a human-readable
format.
 17. du - Disk Usage
 Command: du [options] [directory_name]
 Example: du -sh /home/user/
 Description: Shows the disk usage of a directory and its contents.
 18. ps - Display Process Status
 Command: ps aux
 Example: ps aux | grep bash
 Description: Displays a list of running processes and their details. Use with grep to
filter specific processes.
 19. kill - Terminate Processes
 Command: kill [process_id]
 Example: kill 1234
 Description: Terminates a process with the specified process ID.
 20. sudo - Execute Command as Superuser
 Command: sudo [command]
 Example: sudo apt-get update
 Description: Executes a command with superuser privileges, often used for
administrative tasks.
 Linux Features
 Linux is a versatile and powerful operating system known for its
open-source nature, security, stability, and multitasking
capabilities. It supports multiple users and a wide range of
hardware platforms. Some key features include:
 Multi-user capability: Multiple users can use the system
simultaneously without affecting each other.
 Multitasking: Linux can handle multiple tasks at the same time.
 Portability: Runs on various hardware platforms without
modification.
 Security: Provides strong security features, including file
permissions, encryption, and firewall configurations.
 Open-source: The source code is freely available and can be
modified by anyone.
Basic Navigation
Navigation in Linux involves moving around the
filesystem to access files and directories.
 pwd: Print Working Directory - Displays the current

directory path.
 Example: pwd
 cd [directory] : Change Directory - Moves to a specified
directory.
Example: cd /home/user/Documents
 ls : List Directory Contents - Lists files and directories.
 Example: ls -l
 Files and Directories
 In Linux, everything is treated as a file, including directories.
 touch [file_name] : Creates an empty file.
Example: touch newfile.txt
 mkdir [directory_name] : Creates a new directory.
Example: mkdir new_folder
 cp [source] [destination] : Copies files or directories.
Example: cp file1.txt /home/user/
 mv [source] [destination] : Moves or renames files or directories.
Example: mv old_name.txt new_name.txt
 rm [file_name] : Removes files or directories.
Example: rm file1.txt
 Manual Pages
 Manual pages (man pages) provide detailed documentation on Linux
commands.
 man [command] : Displays the manual page for a specific command.
 Example: man ls

 File Manipulation
 Manipulating files includes operations like creating, editing, and
deleting files.
 cat [file_name]: Concatenates and displays file content.

Example: cat file1.txt


 nano [file_name] : Opens a file in the Nano text editor.
Example: nano file1.txt
 rm [file_name] : Deletes a file.
Example: rm file1.txt
Wildcards
Wildcards allow you to match multiple files with
patterns.
 *: Matches any number of characters.

 Example: ls *.txt (Lists all .txt files)


 ? : Matches a single character.
Example: ls file?.txt (Matches file1.txt, file2.txt,
etc.)
 [] : Matches any one character inside the brackets.
Example: ls file[12].txt (Matches file1.txt and
file2.txt)
 Permissions
 Linux uses a permission model to control access to files and
directories.
 ls -l: Lists files with permissions.
 Example: ls -l

 chmod [permissions] [file_name]: Changes file


permissions.
Example: chmod 755 script.sh
 chown [owner]:[group] [file_name]: Changes file
ownership.
Example: chown user:group file1.txt
File Hierarchy
Linux has a hierarchical file structure, with /
(root) at the top.
 /bin: Essential command binaries.

 /home: User home directories.

 /etc: Configuration files.

 /var: Variable files like logs.

 /usr: User binaries and programs.


Filters
Filters process data in a pipeline, modifying
output.
 grep [pattern] [file_name] : Searches for a pattern in a
file.
Example: grep "error" logfile.txt
 sort [file_name] : Sorts the lines of a file.
Example: sort names.txt
 wc [file_name] : Counts lines, words, and characters.
Example: wc -l file1.txt
Grep and Regular Expressions
searches text using patterns defined by
 grep

regular expressions.
grep [pattern] [file_name]: Searches for
a pattern.
 Example: grep '^Hello' file1.txt (Matches lines starting with
"Hello")
Regular Expressions: Used for pattern
matching, e.g., ^, $, *, ..
 Example: (Matches lines containing "a"
grep 'a.*b' file1.txt
followed by any characters and "b")
Piping and Redirection
Pipes and redirection allow combining
commands and controlling input/output.
Piping (|): Passes the output of one
command as input to another.
Example: cat file1.txt | grep "error"
Redirection (> and >>): Redirects output to
a file.
Example: (Writes output to a file)
ls > file_list.txt
Example: echo "New line" >> file1.txt (Appends to a file)
Process Management
Linux allows you to view and manage
running processes.
 ps aux: Lists all running processes.

Example: ps aux | grep bash


 top : Displays real-time process information.
 kill [PID]: Terminates a process by its

Process ID (PID).
Example: kill 1234
User Management
Linux supports multiple users with different
permissions.
 adduser [username] : Creates a new user.
Example: adduser rakhi
 passwd [username] : Changes a user’s password.
Example: passwd rakhi
usermod -aG [groupname] [username]: Adds a
user to a group.
Example: usermod -aG sudo rakhi
File Security
Security features protect files from
unauthorized access.
Permissions: Control read, write, and
execute access.
Example: (Owner can read and
chmod 600 file1.txt
write; others have no access)
Encryption: Tools like gpg encrypt files.
Example: gpg -c file1.txt (Encrypts the file)
Shell Scripting
Shell scripts automate tasks by running multiple
commands.
Shebang (#!/bin/bash): Indicates the script interpreter.
 Example:
bash
Copy code
#!/bin/bash
echo "Hello, World!"
Executing Scripts: Make the script executable with
chmod +x script.sh and run it with ./script.sh.
Security in Operating Systems
Security in Linux involves implementing
measures to protect the system.
Firewall: Configure with iptables or ufw.

Example: sudo ufw enable


SELinux/AppArmor: Enhanced security
modules.
Example: getenforce (Checks if SELinux is
enforcing)

You might also like