Lec 7_8Intro.toOS
Lec 7_8Intro.toOS
to OS
Instructor: Mehwish Ghafoor
[email protected]
Definition of Operating System (OS)
• Definition of an Operating System (OS):
• An operating system is a software that acts as an
intermediary between users and the computer
hardware.
• It provides a user-friendly environment for
executing programs, managing hardware
resources, and interacting with various system
components.
2
Importance of OS
4
Role of OS in managing Software and
Hardware
5
How to boot OS
Bootloader Stage:
• After POST, the computer looks for a bootloader,
which is a small program that helps load the
operating system.
• The bootloader is typically stored in the Master
Boot Record (MBR) of the bootable storage
device (like a hard drive).
7
How to boot OS
Init Process:
• Once the kernel is loaded, the init process
(or its modern equivalents) is started. Init
is the first user-level process and serves
as the parent process for all other
processes.
9
How to boot OS
12
VirtualBox
● VirtualBox is a
virtualization software
that allows running
multiple operating
systems as virtual
machines within a host
OS.
● It's used for creating isolated environments without the need for separate
partitions.
13
Windows OS
Software
Security Updates
Compatibility
15
Graphical User Interface
Visual
User-Friendly
Representation
WYSIWYG
Point-and-Click (What You See
Interaction Is What You
Get)
16
● User-Friendly: GUIs are intuitive and easy to learn, making them
accessible to a wide range of users.
Graphical User ● Visual Representation: Icons and images help users identify and
understand functions.
Interface ● Point-and-Click Interaction: Users can perform actions by clicking
on icons and buttons.
● WYSIWYG (What You See Is What You Get): GUIs provide a direct
preview of how content will appear.
17
Graphical User Interface:
Key Components
● Windows: Separate areas where applications
and content are displayed.
● Icons: Pictorial representations of files, folders,
or applications.
● Menus: Dropdown lists of commands and
options.
● Buttons: Interactive elements that initiate
actions.
● Dialog Boxes: Windows that prompt users for
input or confirmations.
● Scrollbars: Allow users to navigate through
content that doesn't fit on the screen.
18
Graphical User Interface: Examples
WINDOWS OS: KNOWN FOR ITS START MACOS: FEATURES A DOCK, MENU BAR, LINUX GUIS: VARIOUS DESKTOP
MENU, TASKBAR, AND WINDOW-BASED AND FINDER FOR FILE MANAGEMENT. ENVIRONMENTS LIKE GNOME, KDE,
INTERFACE. AND XFCE.
19
Graphical User Interface: Ubuntu
20
Command Line Interface: CLI
• An interface to get work done by commands
• NO GUI ALLOWED
• More flexibility and greater number of options
• Lesser Resources, Higher Speed
• Scripting
21
Directory Structure
22
Current
directory, ~
Hostname shows home
User Name
dir.
Terminal
23
Command: PWD
• Pwd: present working directory
24
Directory/Folder
Image file
Executable File
Command: ls
Directory/Folder
25
Size Count of files and directory
Command: ls -l
Size
26
Command: Man [cmd_name]used to display the user
manual of any command that we can run on the terminal
man ls
27
Command mkdir [dir_name]
28
Command cd [path]
29
Hidden Folder . And ..
30
Command Clear
31
Create Files and Edit: Vim [file_name]
1
• To Write press i 2
• To Quit: press ESC then :q!
• To save and quit: press ESC then :wq!
32
Command: cat [file_name]: Display content of file
33
Command Vim – f2.txt
34
Command: Less [file_name], More [file_name]
• The cat command is all well and good for small files. But, if the file is large, the
contents will zoom past and we’ll only see the last screen worth of content.
• Less command is a Linux utility that can be used to read the contents of a text file
one page (one screen) at a time.
• The more command displays the contents of the file one screen at a time for
large files. If the contents of the file fit a single screen, the output will be the
same as the cat command.
• The less command is similar to the more command but provides extensive
features. One important one is that it allows backward as well as forward
movement in the file
35
Less:
36
More:
37
Change Dir: cd
38
Remove Dir or File: rm [file_name]
39
Remove Multiple File or Dir: rm [file_name]
Remove
file/s with
same
extension, *
shows
filename
starts with
any number
of
characters, it
should end
with .txt
40
Remove Multiple File or Dir: rm [file_name]
41
Command copy: cp [ source ] [destination]
• Copy content of file1.txt to file2.txt
• cp file1.txt file2.txt ; this command copy contents of file1.txt to file2.txt, if file2.txt
doesn’t exist, it will create file then copy content else re-write file2.txt
42
Absolute Path and Relative Path
44
Absolute Path using cp command
45
Move Command: mv [file_name]
46
Change File or Dir. Permission for types of
Users: chmod
• Chmod
• Two modes to set permission
• Symbolic mode
• Octal mode
47
Chmod: Symbolic Mode
Operators Function
48
Chmod: Symbolic Mode
Operators Function
Letters Function
u Owner
`-` Remove permissions
g Group
Set the permissions to the specified
`=` o Others
values
All
a
Letters Function (owner,groups,others)
52
Chmod: Symbolic Mode
Remove read permissions to group and others:
chmod go-r [file_name]
53
Chmod: Symbolic Mode
Add read,write for owner and add execute-only for group and others:
chmod u+rw, go+x [file_name]
54
Chmod: Symbolic Mode
Add read,write for group for dir:
chmod g+rw [dir_name]
55
Chmod: Octal Mode
• First digit specify the permission for Owner.
• Second digit specify the permission for Group.
• Third digit specify the permission for Others. The digits
Value Permission
4 Read Permission
2 Write Permission
1 Execute Permission
56
Chmod: Octal Mode
• First digit specify the permission for Owner.
• Second digit specify the permission for Group.
• Third digit specify the permission for Others. The digits
57
Chmod: Octal Mode
Add no permission for owner,[read,write,execute] for group and read for others:
chmod 074 [file_name]
58
Chmod: Octal Mode
Add all permission for owner and group, Read for others:
chmod 774 [dir_name]
59
Class Task
• What is chmod 777, chmod 755, and chmod a+x?
• What is chmod 671, chmod 515, and chmod a-x?
60