0% found this document useful (0 votes)
82 views41 pages

Ch4 OS Basics

The document discusses operating system basics, including: 1. An operating system manages computer hardware and software resources and provides common services for programs. 2. Key functions of an operating system include device management, memory management, process management, file management, user interface, and security. 3. Common operating systems include Microsoft Windows, Apple MacOS, Linux, and Unix-like systems such as HP-UX, AIX, and Linux distributions like Red Hat, Fedora, and Ubuntu.

Uploaded by

pimat40375
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
82 views41 pages

Ch4 OS Basics

The document discusses operating system basics, including: 1. An operating system manages computer hardware and software resources and provides common services for programs. 2. Key functions of an operating system include device management, memory management, process management, file management, user interface, and security. 3. Common operating systems include Microsoft Windows, Apple MacOS, Linux, and Unix-like systems such as HP-UX, AIX, and Linux distributions like Red Hat, Fedora, and Ubuntu.

Uploaded by

pimat40375
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 41

1

Chapter 4
Operating System Basics
ITP3901 OPERATING SYSTEMS FUNDAMENTALS
(AY 2019/20)
2
What is an Operating System?

 An operating system(OS) is system software that manages computer


hardware and software resources,
and provides common services for computer programs.
 50s - Mainframe Computers
 80s - Desktop Microcomputers became popular
 DOS, CP/M
 Windows NT, MacOS
 Linux

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


3
Key Functions of an Operating
System

 Device Management
 Memory Management
 Process Management
 File Management
 Providing User Interface
 Security

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


4
Types of Operating Systems

 Single Task Vs Multi-Task


 Single User Vs Multi-Users
 Embedded OS
 Designed for devices with a limited number of resources
 Real Time OS
 An OS that guarantees to process events or data by a specific moment in time

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


ITP3901 Operating Systems Fundamentals

5
Common Operating Systems

 Microsoft Windows
 first released in 1985, running on top of MS-DOS
 Windows 95, 98, ME, XP, 7, 8, 10
 Windows NT Server, Windows 2000, 2003, 2008, 2012, 2016, 2019 Server
 Apple Macintosh OS (Mac OS)
 MacOS 8, OS 9, OS X (OS 10), macOS Big Sur 11

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


ITP3901 Operating Systems Fundamentals

6
Common Operating Systems

 Unix and Unix-like operating systems


 Unix is a family of multitasking, multiuser computer operating
systems that derive from the original AT&T Unix, development starting in
the 1970s at the Bell Labs research center
 E.g. HP's HP-UX and IBM's AIX
 "UNIX-like" is commonly used to refer to the large set of operating systems which
resemble the original UNIX
 E.g. Linux (Red Hat, Fedora, Ubuntu, SuSE etc.)

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


7
The User Interface (UI)

 The user interface (UI) is the component of the OS for the user to interact
with the computer.
 In the old days, the command line interface (CLI) is used for user
interactions.
 Modern operating systems usually provide a graphical user interface (GUI)
in which users perform actions through direct manipulation of the graphical
elements.

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


8
Graphical User Interface ( GUI )

 A graphical user interface (GUI) allows the user to use graphics, along
with a keyboard and a mouse to manipulate software using visual objects
such as windows, pull-down menus, pointers, and icons.
 Advantages for using GUI:
 Appealing
 More user-friendly
 Easier to learn

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


Chapter 4: OS Basics
9
Command Line Interface ( CLI )

 A command line interface (CLI) is a user interface to a computer's


operating system or an application in which the user responds to a visual
prompt by typing in a command on a specified line
 Reasons for using CLI:
 A simple, low-overhead operating system
 Stable and reliable
 Users have more controls on the operating system and file system
 Allow administrator to administer the system by remote login

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


Chapter 4: OS Basics
10
Linux

 Linux is a family of open source Unix-like operating


systems based on the Linux kernel
 An operating system kernel first released on September 17, 1991
by Linus Torvalds.
 Linux is typically packaged in a Linux distribution
 Distributions include the Linux kernel and supporting system
software and libraries
 E.g. Debian, Fedora, Ubuntu, Red Hat Enterprise Linux, SUSE Linux Enterprise
Server

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


11
The Kernel

 Kernel is the most common term for the core of the operating system.
 It is a small piece of code that is loaded into memory when the
computer boots.
 This computer code contains instructions that allow the kernel to
manage hardware devices, memory allocation, system processes, and
other programs.

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


12
The File System

 A file system (or filesystem) is used to control how data is stored and


retrieved. 
 In a hierarchical file system, files are placed in logical containers that
are arranged in an upside-down tree structure.
 The file system starts at the root of the tree.
 UNIX and Linux call these containers ″directory″ and ″subdirectory″.
 Windows and Macintosh OSs use the term ″folder″ and ″subfolder″.

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


13
The File System

 One common type of file system is File Allocation Table (FAT)


 New Technology File System ( NTFS )
 FAT, NTFS, exFAT – used in Windows OS
 ext is extended file system. A second version of this system is called
ext2
 ext2, ext3, ext4 – used in Linux

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


14

Basic
Administration
In Linux

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


15
Linux Distribution Selection

 Fedora
 Red Hat Enterprise
 CentOS
 Mandriva
 Debian
 Ubuntu
 openSuSE
 CentOS
 Chinese Version
 Red Flag

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


16
Linux File System

 File system defines how the hard disk store and organize data
physically
 Some popular filesystems in linux are
 ext2, stable and high performance but no journaling. File system
start up checking (like Scan disk in MS Windows) can be slow,
especially un-clean shutdown (i.e. Shutdown improperly)
 ext3, a journaled version, the most popular
 ext4, latest Linux file system which supports file size up to 16
TB (1024GB) and used in ″ / ″ of Fedora11
 ResiserFS, B-tree based, good performance when dealing with
small files (<4K), 10-15 times faster then ext3

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


17
Filesystem supported by Linux

 NTFS
 FAT32, exFAT
 ext2 / ext3 /ext4
 HPFS

Support means you may use Linux tool to create partition for that particular
type of filesystem (of course, you can read the data from it).

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


18
Directory Layout

 / – root, highest of the hierarchy


 /etc – local configuration files
 /bin – executables files
 /sbin – system utilities files (Administrator only)
 /lib – system library
 /dev – interface to device
 /usr – User application

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


19
Linux Files

 File Types
 Normal (e.g. text file, image file …)
 Directory (container of other directories/files)
 Linux treats everything as file, even your network card, sound card ….
(device files)

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


20
Linux Process

 All running application must have at least one process (you may simply
consider it as a running program)
 Every process have an Process ID (PID)
 Required when you want to kill or check the specified process
 ″init″
 Traditional System V init process
 the first process run on Linux has PID, 1 and all other process are child
process of init
 “Systemd”
 Aimed to replace the traditional Linux init system
 Systemd is the first daemon to start (during booting) and the last daemon to terminate
(during shutdown).

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


21
Super User (root)

 Default username of administrator – root (case sensitive)


 Control all services
 Access to all files on the system
 Not restricted by file permission
 Can move or delete any file/directory in the system
 Can shutdown/stop any process / service
 Only login as root when required
 In order to reduce the change of the system accidentally (e.g.
running malicious application)

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


22
Logging On

 You must have an account (username and password) in order to login to the
system
 After you successfully log in to the Linux system (CLI mode), a shell
prompt such as the $ character for normal user, will appear on the screen (#
character for superuser). The shell prompt is simply a message from the
computer telling you that it is ready to accept typed input on the command
line.
 Reminder – Linux is case sensitive

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


23
Introduction to Console / Terminal Environment

 Why do we need to work under console / terminal?


 There are some reasons to use console / terminal mode for system
administration
 As system resource is limited, many server have no GUI interface installed (i.e.
you must input command)
 In work place, many Linux servers may not equip with a keyboard or mouse. You
must use remote access method like Telnet or SSH.
 SSH is much more efficient than the GUI remote connection tool

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


24
Linux Commands (Basic)

 pwd touch
 ls cat, less, more
 cd grep, find
 mkdir shutdown, reboot
 rmdir |
 cp man
 mv clear

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


25
man – get help!

 Use to open the supporting manual for a command. You can find the
following information of a command
 Syntax
 Function
 Argument
 etc. …

e.g. man pwd

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


26
pwd

 To see the current working directory


e.g. $ pwd
It is the home directory of user “lily”
$ /home/lily

Remark:
~ means the home directory of the login user

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


27
cd

 ″cd″ is used to change to other directory.


 e.g. assume we are current in ″ / ″, input ″cd home″ will go to the
directory “home”
 ″ .. ″ mean parent directory (or simply one upper level)
 e.g. assume we are currently in ″/home/john″, input ″cd ..″ will go
to one upper level that is ″home″.
 User can input command ″cd″ or ″cd ~″ to go back his/her own home
directory

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


28
Understand . , .. and ~

 ″.″ is another special directory. It means the current directory.


 Often used to execute program (i.e. the system will search the required
file in this directory first)
 ″..″ means parent directory e.g. the parent directory of
/home/lily is /home
 “~” means home directory of the user

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


29
Absolute Path and Relative Path

 Absolute path indicates the full path of a file or directory


 By input absolute path, you can locate the exact position of the file or directory
 Absolute path must start from /
 e.g. /home/john/osf_notes.txt
 Relative path depends on the current directory. You need to know
where you are.
 If you are in /home/student and execute the command
[student@osa ~]$cat osf_notes.txt
osf_notes.txt may not be found.

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


30
ls

 ls lists the content of a directory


 ″ls –a″ lists all files, including hidden files.
 ″ls –l″ lists all files with detail information
 You may have several
parameters (order of the
parameters is not important)
e.g. ″ls –al″ or ″ls
–la″ or
″ls -l –a″

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


31
cat , less, more
cp, mv
 ″cat″ displays the content of a file (it should be an ASCII file)
e.g. $cat myfile
 $less myfile
 $more myfile
 ″cp″ copies a file from one directory to another directory.
e.g. $cp /home/john/note.doc /home/student1/note.doc
 ″mv″
 moves a file from one directory to anther directory (i.e. copy and then delete the source
file)
e.g. $mv /home/john/note.doc /home/student/note.doc
 renames a file in a directory
 e.g. $mv /home/john/note.doc /home/student/note.doc

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


32
touch

 ″touch″ is used to update the time stamp of the file.


 If the file is not exist, it creates the file.
 e.g. $touch myfile

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


33
rm

 ″rm″ command is used to remove a file or directory


 Console will prompt for confirmation before the file is really deleted.
$ rm myfile
 ″rm″ parameters
 ″rm –f″, no confirmation
 ″rm –rf″, it removes the directory even it is not empty

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


34
Using wildcards *

 Assume we want to delete all files (1000 or more) in a directory


 We can use ″rm *″
 * will match any characters and any length of filename
 Assume we have the following 6 files in a directory
 file1, file2, file3, file4, file, fileABC.
 We can delete all 6 files by ″ rm file* ″
 We can delete fileABC by ″ rm fileA* ″
 The * can match any number of characters or even no character.

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


35
Shutdown and Reboot

 Shutdown the machine


 %shutdown –h now
 Reboot the machine
 %shutdown –r now
 %reboot

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


36
Switch user

 su
 change user ID or become superuser
 su -l user01
 su user01

 su -l
Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals
37
Executing Command with root
privilege

 sudo
 execute a command as another user
 $sudo shutdown –h now

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


38
Search text in a file

 grep
 print lines matching a pattern
 grep texttosearch file01

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


ITP3901 Operating Systems Fundamentals

39
find command

 A very powerful and flexible searching command


 find [path] –[argument] [criteria]
 e.g. ″find / -name john″
 This command start the search of the file ″john″ from ″/″
 e.g. ″find /home –name john.*″ means the search
started from directory ″/home″, targeted filename ″john″ with
any extension

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


ITP3901 Operating Systems Fundamentals

40
pipe |

 | can pass the output of one command to another command.


 e.g. ″ls –l | more ″
 the output of ls –l will be passed to more, which will display
the output one page at a time.

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals


41
Clear the terminal screen

 $clear

Chapter 4 - OS Basics ITP3901 Operating Systems Fundamentals

You might also like