Tổng hợp bài giảng môn Kiến thức máy tính_Hệ điều hành Linux_Thầy Trần Quang Đức| Bài giảng môn Kiến thức máy tính| Trường Đại học Bách Khoa Hà Nội

Tổng hợp bài giảng môn Kiến thức máy tính_Hệ điều hành Linux_Thầy Trần Quang Đức| Bài giảng môn Kiến thức máy tính| Trường Đại học Bách Khoa Hà Nội. Tài liệu gồm 124 trang giúp bạn tham khảo, ôn tập và đạt kết quả cao trong kỳ thi sắp tới. Mời bạn đọc đón xem.

1
Software
Collection of instructions and data that tell a computer how to work
Contrast to physical hardware, from which the system is built and performs
the work
Related data
To automatically solve a specific problem
The software performs the functions
Sending instructions directly to hardware
Providing data to serve other programs/software
Hardware is required to use software
2
2
Activities on software
Creating
Installing
Using
Personal, corporate, commercial, educational, research
Modify and upgrade software
Reverse engineering
Distributing
Execute code/source code
Original/upgraded/changed
Managing
Allow/Deny operations on software
3
Software License
Defines what a user can do with a software
Proprietary software
Freeware
Shareware
Proprietary software license
Free open-source software
Free software
Open-source software
4
3
Proprietary software
Ensure the rights of software creators: Copyright
Strict on software distribution and management
rights
Restrict the right
To change and imporve software
To reverse analysis of code
For example
MS Excel EULA
MathWork Matlab
5
Free open-source software
Provide maximum rights on software for the
majority of users
Users can make change, upgrade, redistribution,
obtain the source code
Free open-source software has license?
COPYLEFT: Copyleft is a general method for making
a program (or other work) free (in the sense of
freedom, not “zero price”), and requiring all modified
and extended versions of the program to be free as well.
6
4
Copyleft
Reason
Respect the software creators
Unlicensed software can be used to turn into proprietary
software not free
Definition
One kind of license
Requires software redistribution preserves the original
license
Make sure the recipient from the distributor has the same
rights as the distributor
Make sure the software and its modifications are free
7
Free open-source software
Freely distributed
Always include source code
Allow to modify software
Copyright is not allowed to be changed
There may be constraints on
Source code integration
Version name
No distinction between different individuals/groups
No restrictions on the purpose of use
8
5
Comparison
Proprietary software Free open-source software
Fee Free
Copyright Copyleft
Maintenance by software creator Maintenance by user
Closed box Open box
User contributions are not
allowed
User contributions are allowed
9
What is an Operating System?
Operating System
Software that
manages (allocates and de-allocates) system resources in an
efficient and secure manner
System resources include:
CPU
Memory: RAM
Storage: Hard disk
Peripheral devices: Printer, Keyboard, Monitor, Mouse ...
Network communication.
Provides interfaces for users to use system resources
Desktop Environment
Shell command line.
10
6
The roles of operating system
System
Resources
Hardware Software
System
Software
Application
Software
11
COMPONENTS
User
Application
(
shells
, compilers, utilities
,…
)
Programming libraries
(open, close, read, write, ...)
OS kernel
(managing file system
, memory, peripheric
)
Hardware
Interface
12
7
UNIX
Invented by Ken Thompson at AT&T in 1969
First version written in assembly language
single user system, no network capability
Thompson, Dennis Ritchie, Brian Kernighan
rewrote Unix in C: processor/architecture independent
Unix evolution:
Bell Labs, USL, Novell, SCO
BSD, FreeBSD, Mach, OS X
AIX (IBM), Ultrix, Irix, Solaris (Sun), …
13
Unix (Cont.)
Multi-user, Multi-process operating system
Reliable, flexible
Widely used
High modularity
Support application development environment
$$$$$
14
8
History of Linux
1950-1960: Software is freely distributed to use hardware
Late 1960s: software value increases → software prices start
to be included in the hardware that installs it.
198x: The software industry begins to provide only the
executable code of the program, preventing users from
modifying the software.
1980: Copyright law extended to computer programs
1983: Richard Stallman, a programming enthusiast at MIT,
launches the GNU Project, with the goal of building a
completely free, Unix-like GNU operating system.
1984: The GNU project gives a list of software to be
developed for the GNU operating system → software that is
gradually built
15
History of Linux
GNU project: objective to create an UNIX-like operating
system
GNU project lists all the GNU OS components: kernel,
utilities, applications...
In 1990, components (except kernel) were developed
independently and could run well
Kernel were not received enough development investigation
1991: Linus Torvalds released a completely free and editable
Linux kernel
1992: The Linux kernel uses the GNU GPL license
GNU/Linux OS.
1998: Open-source Initiative (OSI) was born
9
GNU Project
FSF-Richard Stallman
GNU GPL
Compilators
System tools
GNU Hurd (Stalled)
17
GNU/LINUX
The combination of the LINUX kernel and the
GNU utilities has resulted in a complete, powerful,
and free GNU/LINUX operating system for a wide
variety of computers.
Intel x86, Alpha, ARM, Power PC (Macintosh), PDA
Attention
The name LINUX is still commonly used for both
operating systems including the Linux kernel and its
associated utilities
18
10
Linux kernel
The basic components to be able to exploit the computer's
hardware resources
1994: 1.0
1999: 2.2.0
2001: 2.4
2011: 2.6.39.4
2015: 3.19.8
2019: 4.20.17
2021: 5.12.4
First number: main version
Next number: minor version
Odd numbers: trial version
Even numbers: stable versions
19
Linux license
LINUX is copyright protected under the GPL (General
Public License)
Belongs to the author, freely distributed and free to use
Can be used for profit, but not allowed to change the terms of
the copyright
Changes to the source code are allowed but must then be
distributed under the same GPL
GPL <> GNU
a GNU program owned by everyone
Open-source software <> Shareware
The source code must be open to everyone
Note: an open-source software does not have to be under the
GPL
20
11
Linux components
OS kernel
Drivers
System software
Application software
X Windows
Application software with
graphical interface
21
Linux GUI
X Windows: the basic framework for building GUI
environments
Draw, move windows, interact with display devices,
mouse, keyboard
Desktop environment
Windows manager: create, manage windows
File manager: manage files on a graphical interface
Desktop widgets
22
12
Features of Linux
Open source
Supports multiple hardware
Different distributions
Inheriting Unix Features
Portability
Multi-user, multitasking
Single file system
Shell
Network Features
23
Linux distribution
24
Linux = Kernel (OS Basic Part)
Kernel
Software Packages
Installation tools
SW management tools
User interface
Distributor
Distribution
Developers
13
Linux distribution (cont.)
A distribution is the complete set of OS programs that
include
System settings and configuration tools
User applications
Version of the distribution <> version of the kernel
Distribution
Redhat (Fedora Core)
Mandrake
Debian
Ubuntu
CentOS
25
Linux Operating system
Compatible with POSIX, System V and BSD standards
Support terminal emulation
Support virtual consoles
Can be installed with other OS (using LILO, GNUB)
Read data on many storage formats: etx2fs, ms-dos, vfat, iso
9660, etc.
Fully install network protocol standards: TCP/IP, SLIP, PPP,
NFS, ...
Graphical Interface: X Window KDE & Gnome
Support many application services: database, office
application, internet service, ...
Support network integration with other OS like Windows
26
14
Linux vs. Windows
Why LINUX?
Reliable enough to make sure the OS can do the heavy
tasks
Better than Windows in terms of task management and
network management
Free but very complete
An excellent choice for teaching and research
27
Uses of Linux
Linux provides:
User Support Tools
Text processing (vi, sed, awk)
Productivity applications
Programmer Support Tools
Programming languages & compilers (C, C++, Java)
Shell scripts
Personal software process: version control
Source Code Control System (SCCS)
Revision Control System (RCS)
Linux as server
Web server, mail server, application server
28
15
Where to LINUX
Install your own Linux system
Separate machine
Dual boot: co-existence with other OS
Linux on a CD (slow)
Virtual Machine (slow and hot)
Other
Cygwin: Unix utilities on Windows
Windows Services For Unix (for some versions of Windows)
Lab environment
29
29
Shell executes iteratively the following tasks:
Display command prompt, wait for user commands.
Receive and Analyse the user command
Execute the user command
[billgates@soict home]$ <command of user>
[root@soict home]# <command of root>
Host nameLogin name
Working
directory
prompt
Command Prompt
16
login: billgates
password: xxxxxxxx
[billgates@soict home]$ echo hello
hello
[billgates@soict home]$ exit
Example
command [-options] [arguments]
command: command name
options: some way to execute the command
arguments : arguments of the command
Each option is usually represented by a single character
after (“-”)
Options could be combined together after a single “–”.
Example -asli is equivalent to -a -s -l -i
Options and arguments are separated by spaces.
Commands are case sensitive
Linux command structure
17
passwd - change password
ls - list files
less - show content of file
logout - logout from system
date - display date and time
who - display who is on the system
clear - clear terminal screen
script - make record of a terminal session
uname -a - print current OS detail (version etc.)
man - find and display system manual pages
Some basic commands
Syntax: man [options] [-S section] command-name
% man date
% man -k date
% man crontab
% man -S 5 crontab
Caveats:
Some commands are aliases
Some commands are part of shell
The man command
18
Computer Literacy
Start and stop the system
Using shell
Basic command
Getting help by using “man”
Hands-on Exercises
Thank you!
36
1
References
Based on slides of Department of Computer
Science of NIU
http://www.cs.niu.edu
2
2
Linux’s File System
1. File and Directory
In linux and most of OS data are stored in files
File
Contains data
Stored in (hard) disk
Directory
Contains files
Stored in (hard) disk
Makes easy for data organizing
Hierarchy of directories and files = file system
Single file system for all logical disks
4
| 1/124

Preview text:

Software
• Collection of instructions and data that tell a computer how to work
• Contrast to physical hardware, from which the system is built and performs the work • Related data
• To automatical y solve a specific problem
• The software performs the functions
• Sending instructions directly to hardware
• Providing data to serve other programs/software
• Hardware is required to use software 2 1 Activities on software • Creating • Installing • Using
• Personal, corporate, commercial, educational, research
• Modify and upgrade software • Reverse engineering • Distributing • Execute code/source code • Original/upgraded/changed • Managing
• Allow/Deny operations on software 3 Software License
• Defines what a user can do with a software • Proprietary software • Freeware • Shareware
• Proprietary software license • Free open-source software • Free software • Open-source software 4 2 Proprietary software
• Ensure the rights of software creators: Copyright
• Strict on software distribution and management rights • Restrict the right
• To change and imporve software
• To reverse analysis of code • For example • MS Excel EULA • MathWork Matlab 5 Free open-source software
• Provide maximum rights on software for the majority of users
• Users can make change, upgrade, redistribution, obtain the source code
• Free open-source software has license?
• COPYLEFT: Copyleft is a general method for making
a program (or other work) free (in the sense of
freedom, not “zero price”), and requiring all modified
and extended versions of the program to be free as well. 6 3 Copyleft • Reason
• Respect the software creators
• Unlicensed software can be used to turn into proprietary software  not free • Definition • One kind of license
• Requires software redistribution preserves the original license
• Make sure the recipient from the distributor has the same rights as the distributor
• Make sure the software and its modifications are free 7 Free open-source software • Freely distributed • Always include source code • Allow to modify software
• Copyright is not allowed to be changed
• There may be constraints on • Source code integration • Version name
• No distinction between different individuals/groups
• No restrictions on the purpose of use 8 4 Comparison Proprietary software Free open-source software Fee Free Copyright Copyleft
Maintenance by software creator Maintenance by user Closed box Open box User contributions are not User contributions are allowed allowed 9 What is an Operating System?  Operating System  Software that
 manages (allocates and de-allocates) system resources in an efficient and secure manner  System resources include: CPU Memory: RAM Storage: Hard disk
Peripheral devices: Printer, Keyboard, Monitor, Mouse ... Network communication. 
Provides interfaces for users to use system resources Desktop Environment Shel command line. 10 5 The roles of operating system System Resources Hardware Software System Application Software Software 11 COMPONENTS Interface User Application
(shel s, compilers, utilities,…) Programming libraries
(open, close, read, write, ...) OS kernel
(managing file system, memory, peripheric) Hardware 12 6 UNIX
 Invented by Ken Thompson at AT&T in 1969
 First version written in assembly language
 single user system, no network capability
 Thompson, Dennis Ritchie, Brian Kernighan 
rewrote Unix in C: processor/architecture independent  Unix evolution:
 Bell Labs, USL, Novell, SCO  BSD, FreeBSD, Mach, OS X
 AIX (IBM), Ultrix, Irix, Solaris (Sun), … 13 Unix (Cont.)
• Multi-user, Multi-process operating system • Reliable, flexible • Widely used • High modularity
• Support application development environment • $$$$$ 14 7 History of Linux
• 1950-1960: Software is freely distributed to use hardware
• Late 1960s: software value increases → software prices start
to be included in the hardware that installs it.
• 198x: The software industry begins to provide only the
executable code of the program, preventing users from modifying the software.
• 1980: Copyright law extended to computer programs
• 1983: Richard Stallman, a programming enthusiast at MIT,
launches the GNU Project, with the goal of building a
completely free, Unix-like GNU operating system.
• 1984: The GNU project gives a list of software to be
developed for the GNU operating system → software that is gradually built 15 History of Linux
• GNU project: objective to create an UNIX-like operating system
• GNU project lists all the GNU OS components: kernel, utilities, applications...
• In 1990, components (except kernel) were developed
independently and could run well
• Kernel were not received enough development investigation
• 1991: Linus Torvalds released a completely free and editable Linux kernel
• 1992: The Linux kernel uses the GNU GPL license  GNU/Linux OS.
• 1998: Open-source Initiative (OSI) was born 8 GNU Project • FSF-Richard Stallman • GNU GPL • Compilators • System tools • GNU Hurd (Stalled) 17 GNU/LINUX
• The combination of the LINUX kernel and the
GNU utilities has resulted in a complete, powerful,
and free GNU/LINUX operating system for a wide variety of computers.
• Intel x86, Alpha, ARM, Power PC (Macintosh), PDA • Attention
• The name LINUX is still commonly used for both
operating systems including the Linux kernel and its associated utilities 18 9 Linux kernel
• The basic components to be able to exploit the computer's hardware resources • 1994: 1.0 • 1999: 2.2.0 • 2001: 2.4 • 2011: 2.6.39.4 • 2015: 3.19.8 • 2019: 4.20.17 • 2021: 5.12.4 • First number: main version • Next number: minor version • Odd numbers: trial version
• Even numbers: stable versions 19 Linux license
• LINUX is copyright protected under the GPL (General Public License)
• Belongs to the author, freely distributed and free to use
• Can be used for profit, but not allowed to change the terms of the copyright
• Changes to the source code are allowed but must then be distributed under the same GPL • GPL <> GNU
• a GNU program owned by everyone
• Open-source software <> Shareware
• The source code must be open to everyone
• Note: an open-source software does not have to be under the GPL 20 10 Linux components • OS kernel • Drivers • System software • Application software • X Windows • Application software with graphical interface 21 Linux GUI
• X Windows: the basic framework for building GUI environments
• Draw, move windows, interact with display devices, mouse, keyboard • Desktop environment
• Windows manager: create, manage windows
• File manager: manage files on a graphical interface • Desktop widgets 22 11 Features of Linux • Open source • Supports multiple hardware • Different distributions • Inheriting Unix Features • Portability • Multi-user, multitasking • Single file system • Shell • Network Features 23 Linux distribution Developers Linux = Kernel (OS Basic Part) U Kernel ser Software Packages Distributor inter SW management tools face Instal ation tools Distribution 24 12 Linux distribution (cont.)
• A distribution is the complete set of OS programs that include
• System settings and configuration tools • User applications
• Version of the distribution <> version of the kernel • Distribution • Redhat (Fedora Core) • Mandrake • Debian • Ubuntu • CentOS 25 Linux Operating system
• Compatible with POSIX, System V and BSD standards • Support terminal emulation • Support virtual consoles
• Can be installed with other OS (using LILO, GNUB)
• Read data on many storage formats: etx2fs, ms-dos, vfat, iso 9660, etc.
• Fully install network protocol standards: TCP/IP, SLIP, PPP, NFS, ...
• Graphical Interface: X Window KDE & Gnome
• Support many application services: database, office
application, internet service, ...
• Support network integration with other OS like Windows 26 13 Linux vs. Windows  Why LINUX?
 Reliable enough to make sure the OS can do the heavy tasks
 Better than Windows in terms of task management and network management  Free but very complete
 An excellent choice for teaching and research 27 Uses of Linux  Linux provides: – User Support Tools
•Text processing (vi, sed, awk) •Productivity applications – Programmer Support Tools
•Programming languages & compilers (C, C++, Java) •Shell scripts
•Personal software process: version control
–Source Code Control System (SCCS)
–Revision Control System (RCS) – Linux as server
•Web server, mail server, application server 28 14 Where to LINUX
 Install your own Linux system  Separate machine
 Dual boot: co-existence with other OS  Linux on a CD (slow)
 Virtual Machine (slow and hot)  Other
 Cygwin: Unix utilities on Windows
 Windows Services For Unix (for some versions of Windows)  Lab environment 29 29 Command Prompt
 Shell executes iteratively the following tasks:
 Display command prompt, wait for user commands.
 Receive and Analyse the user command  Execute the user command [billgates@soict home]$ Working Login name Host name prompt directory [root@soict home]# 15 Example login: billgates password: xxxxxxxx
[billgates@soict home]$ echo hello hello
[billgates@soict home]$ exit Linux command structure command [-options] [arguments]  command: command name
 options: some way to execute the command
 arguments : arguments of the command
 Each option is usually represented by a single character after (“-”)
 Options could be combined together after a single “–”. •
Example -asli is equivalent to -a -s -l -i
 Options and arguments are separated by spaces.
 Commands are case sensitive 16 Some basic commands passwd - change password ls - list files less - show content of file logout - logout from system date - display date and time who - display who is on the system clear - clear terminal screen script
- make record of a terminal session uname -a
- print current OS detail (version etc.) man
- find and display system manual pages The man command
Syntax: man [options] [-S section] command-name % man date % man -k date % man crontab % man -S 5 crontab Caveats: Some commands are aliases
Some commands are part of shell 17 Hands-on Exercises  Start and stop the system  Using shell  Basic command
 Getting help by using “man” Computer Literacy Thank you! 36 18 References •
Based on slides of Department of Computer Science of NIU http://www.cs.niu.edu 2 1 Linux’s File System 1. File and Directory •
In linux and most of OS data are stored in files • File – Contains data – Stored in (hard) disk • Directory – Contains files – Stored in (hard) disk – Makes easy for data organizing
• Hierarchy of directories and files = file system
• Single file system for all logical disks 4 2