computer literacy - soict · 2020. 12. 3. · computer literacy 1 3 linux provides: – user...

36
Lecturers: Dr. Nguyn Đc Toàn Dr. Đng Tun Linh Assoc.Prof. Trương ThDiu Linh Department of Data and Computer Network, School of Information and Communication Technology Computer Literacy

Upload: others

Post on 01-Apr-2021

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Lecturers: Dr. Nguyễn Đức Toàn Dr. Đặng Tuấn Linh Assoc.Prof. Trương Thị Diệu Linh Department of Data and Computer Network, School of Information and Communication Technology

Computer Literacy

Page 2: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Outline 22

�  3 parts ¡  Introduction to Linux ¡  Introduction to LaTeX ¡  Introduction to Beamer

� At least 1 test on Linux (30%), + Beamer (20%) + 1 final on Latex (50%)

� Website of the course: �  users.soict.hust.edu.vn/linhtd �  Looking for “Computer Literacy”

Page 3: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Introduction to LINUX

Computer Literacy

33

� Open source software (OSS) � Operating System � Linux Operating System � Basic commands � Getting help � Exercises

Page 4: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Open Source Software

Computer Literacy

4

� Activities on a software ¡  Creating, distributing, using, modifying ¡  Compiling: from source code to binary executable code ¡  Reverse Engineering: from binary code to source code ¡  Managing: change rights on others actions

�  Commercial software ¡  Only the right to use is allowed (with charge)

� Open source software ¡  Only the right to manage is not allowed

Page 5: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Popular opensource software

Computer Literacy

55

�  Firefox �  Linux � OpenOffice � Gimp � Apache � MySql/PostgreeSQL � ….. � How do we know which SW is OSS ?

Page 6: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Software License

Software license defines what a user can do with a SW. •  Commercial SW license

•  User pays to get the license for a single user

•  License forbids users from modifying, re-distributing the SW

•  Open source SW •  License allows users to use, modify and re-distribute the SW

•  SW is usually re-distributed free of charge.

•  Copy-left license: Re-distribution of modified or non-modified SW must retain the original license à derived work becomes OSS.

•  Example of OSS license: GNU GPL, Apache license, BSD License...

Page 7: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Open Source vs Commercial Software

Computer Literacy

77 Open Source Software Commercial Software

Developed by users Developed by software owner (professionals)

No explicite investment cost Explicite Investment cost (normally hight)

Complex support Limit by many rules

No limit creation Limit by many rules

Public algorithms and mechanisms

Hidden mechanisms/algorithms

Risk to be discontinued

Risk to be closed

Supp

Page 8: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

What is an Operating System?

Computer Literacy

8

� 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.

Page 9: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

The roles of operating system

Computer Literacy

9

System Resources

Hardware Software

System Software

Application Software

Page 10: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

OBSOLETE TYPES OF OPERATING SYSTEMS

Computer Literacy

10

�  Single-user, single-process operating systems: ¡  allow only one user at a time on the computer system ¡  user can execute/run only one process at a time

Examples: DOS, Windows 3.1

�  Single-user, multi-process operating systems: ¡  allow a single user to use the computer system ¡  user can run multiple processes at the same time

Example: OS/2

Page 11: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

CURRENT OPERATING SYSTEMS

Computer Literacy

1111

� Multi-user, multi-process operating systems: ¡  allow multiple users to use the computer system

simultaneously ¡  Each user can run multiple processes at the same time

Examples: UNIX, LINUX, MacOS, Windows (2000, XP, Vista. Windows 7, 8, 10)

Under Linux: By logging on system under different terminals running programs

Under Windows: switching user

Page 12: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

LINUX Operating System

Computer Literacy

12 � LINUX is a

multi-user, multi-process operating system � LINUX is designed to facilitate programming, text

processing and communication – Network communication is well integrated in

Linux such as it is rather transparent to users – Files in a LAN can be shared so that it is seen

from any host as local files.

Page 13: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

USES OF LINUX

Computer Literacy

13

� 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

Page 14: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

WHERE TO GET 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 ¡  Redhat 9.0

14

14

Computer Literacy

Page 15: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

History of UNIX

Computer Literacy

15

�  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 l  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), …

Page 16: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

History of Linux

- GNU project is created by Rechard Stallman in 1982 with 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 on UNIX

-  Kernel were not received enough development investigation.

Page 17: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

History of Linux

•  1991 Linus Torval wrote a Kernel independently with GNU Project

•  1992 GNU Project utilities, applications + Linux kernel are integrated together à GNU/Linux operating system

•  License under GNU GPL as an OSS

Page 18: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

COMPONENTS OF LINUX

Computer Literacy

18

User

Application (shells, compilers, utilities,…)

Programming libraries (open, close,read, write, ...)

OS kernel (managing file system, memory, peripheric)

Hardware

Interface

Page 19: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Linux Distributions

Computer Literacy

19

� A distribution: � A combination of Linux components and released

to users. � Base distributions:

¡  Redhat ¡  Debian ¡  Suse ¡  …

� Derived distributions: ¡  Fedora ¡  Ubuntu ¡  …

� www.distrowatch.com

Page 20: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Linux Distribution

Page 21: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Start and stop Linux system

Computer Literacy

21

� Start and login to the system using given user name and password

� Distinct the graphical and the textual user interfaces

� Shudown the system ¡  Using mouse ¡  Using command poweroff

Page 22: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Virtual consoles

•  Virtual console allows opening different working session on the same machine

•  Linux allows openning upto 8 virtual consoles, each console corresponds to one session

Ctrl+Alt-F1 : Virtual console 1 (text interface)

Ctrl+Alt-F2 : Virtual console 2 (text interface) ...

Ctrl+Alt-F7 : Virtual console 7 (graphical interface)

Page 23: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Linux Shell

Computer Literacy

23

�  Shell is a traditional user interface of Linux �  = the “command line” Features of Shell:

¡  Interpret and execute commands ¡  Command history and editing ¡  Command scripting: simple program of shell command ¡  Job control: view job, kill running job ...

Page 24: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Linux Shells

Computer Lieracy

24

�  sh ¡  Bourne shell: Steve Bourne, 1978 ¡  Almquist shell (ash): BSD sh replacement ¡  Bourne-Again shell (bash): GNU/Linux

�  csh ¡  C shell, Bill Joy, BSD, 1978

�  tcsh ¡  Tenex C shell (tcsh): GNU/Linux

�  others: Korn shell (ksh), Zshell (zsh), …

Page 25: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Using shell

Computer Literacy

25

� Starting shell (login) � Starting shell emulation (terminal) � Switching between shell (Alt-Fxx) � Getting information from the prompt � Structure of Shell command

$ command-name [options] [args] � Shell commands are case sensitive

Page 26: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Command Prompt

n  Shell executes iteratively the following tasks: ¨ Display command prompt, wait for user commands.

¨ Receive and Analyse the user command

¨ Execute the user command

[tuananh@hanoi home]$ <command of user> [root@hanoi home]# <command of root>

Host name Login name Working directory prompt

Page 27: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Example

login: tuananh

password: xxxxx

[tuananh@hanoi tuananh]$ echo hello↵

hello

[tuananh@hanoi tuananh]$ exit↵

Page 28: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

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

Page 29: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Some Basic Commands

Computer Literacy

29 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

Page 30: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Getting Help: System Manual

Computer Literacy

30

Section No. Description

1 User commands

2 System calls

3 C library functions

4 Special system files

5 File formats

6 Games

7 Miscellaneous features

8 System administration utilities

Page 31: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

The man Command

Computer Literacy

31

¢ show pages from system manual 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

Page 32: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

More help: online

Computer Literacy

32

�  Some web sites

� Or find your own: ¡  Google command, arguments, error messages

Page 33: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Handons Exercises

Computer Literacy

33

� Start and stop the system � Using shell � Basic command � Getting help by using “man”

Page 34: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Using basic command

Computer Literacy

34

� Using command uname � Using command clear � who � whoami

Page 35: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Getting help

Computer Literacy

3535

� Using man command to get informations about command in the linux

Page 36: Computer Literacy - SOICT · 2020. 12. 3. · Computer Literacy 1 3 Linux provides: – User Support Tools • Text processing (vi, sed, awk) • Productivity applications – Programmer

Practical exercises

•  Use “man” for getting command description and syntax

–  login, logout –  mkdir, rm, cp

–  ls –  cd –  pwd –  clear –  who