1 introduce linux speaker: yi-ji jheng date: 2007.09.26

56
1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Upload: pierce-caldwell

Post on 12-Jan-2016

217 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

1

Introduce Linux

Speaker: Yi-Ji JhengDate: 2007.09.26

Page 2: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Outline

Introduce Linux

Install Linux on Vmware

Common software

Linux commands and Practice

2

Page 3: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

INTRODUCE LINUX

3

Page 4: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

History Linus Torvalds make a Minix (Mini Unix) kernel

Just only 10000 row of codes for C

Richard Stallman bring up GNU plan Open source Free Unix-like

GNU/Linux Linux Kernel + many modules

4

Page 5: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Use

Server MySql + PHP + Apache

Embedded system STB (Set Top Box)

Super Computer 75% (Top 500 on the world)

Game Sony PlayStation 3 Microsoft XBOX

5

Page 6: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Linux Kernel

Linux Kernel version format Linux-a.b.c

a kernel version b odd : test

even : stable c number of bug fix

Common, Linux-2.4.x and Linux-2.6.x

6

Page 7: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Linux distribution

Redhat 9 Linux-2.4.x Fedora 1 Linux-2.4.x Fedora 2~ Linux-2.6.x Debian more app. (15940) Trustix more safe and

stable Knoppix LiveCD

7

Page 8: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Other

It’s not must on Linux, because Source code can change

Find Linux distribution or modules 義守大學檔案伺服器 http://ftp.isu.edu.tw/

Good Web Site 鳥哥的 Linux 私房菜

http://linux.vbird.org/8

Page 9: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

INSTALL LINUX ON VMWARE

9

Page 10: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Vmware

Use software (VMware ESX Server) to“virtualize”the hardware resources

Including the CPU, RAM, hard disk and network controller

To create a virtual machine that can run its own operating system

and applications just like a “real” computer

10

Page 11: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Install Linux

11

Page 12: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

12

Page 13: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

13

Page 14: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

14

Page 15: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

15

Page 16: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

16

Page 17: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

17

Page 18: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

18

Page 19: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

19

Page 20: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

20

Page 21: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

21

Page 22: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

22

Page 23: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

23

Page 24: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Mainly, press the “Next” forever

We’ll point out options that need to setup below

24

Page 25: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

25

Page 26: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

26

Page 27: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

27

Page 28: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

28

Page 29: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Because it’ll be “Host Linux”, we only select below

Development Tools Editors

29

Page 30: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

30

Page 31: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

31

Page 32: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

32

Page 33: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

33

Page 34: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

setup

all sevice close, only network and sshd

34

Page 35: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

COMMON SOFTWARE

35

Page 36: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Pietty

Use SSH ( Secure Shell ) protocol Allows data to be exchanged over a

secure channel between two computers

Why use it? Convenient for In/Out Vmware console Good copy way

http://ntu.csie.org/~piaip/pietty/36

Page 37: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

37

Page 38: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

38

Page 39: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Winscp

Support SFTP (SSH File Transfer Protocol) SCP (Secure Copy Protocol) FTP (File Transfer Protocol)

Good way to transmission data between Windows and Linux

http://winscp.net/eng/docs/lang:cht

39

Page 40: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

40

Page 41: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

41

Page 42: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

LINUX COMMANDS AND PRACTICE

42

Page 43: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Linux Command Format

Command [–options] [param1] [param2] …

Short option use “-” Long option use “--”

Ex. dmesg gcc –v gcc ––help cp file1 file2

43

Page 44: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

File management

ls list ls –al

chmod change authority

-rw-r--r-- 1 root root 20 Sep 25 12:12 123.log

44

d : directoryl : soft-link- : filec : char deviceb : block device

owner

group

other

r w x222120

Ex. Chmod 755 file

-rwxr-xr-x

Page 45: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

rmdir remove directory mkdir make directory cp copy

cp from to mv move or rename

Move from to cd change directory

cd <absolute or relative path> cd – cd ..

45

Page 46: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

find -name find file find <where> –name <filename>

grep find string dmesg | grep CPU

cat print to stdout file print file info. touch change file’s timestamp make a file

46

Page 47: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

rm remove rm –rf <file or directory>

man command manual tar uncompress or compress

tar zxvf file.tar.gz tar zcvf backup.tar.gz /root tar jxvf file.tar.bz2

ln soft-link ln –s <file> <link_name>

47

Page 48: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Network

route setup or print route rule

ping ping -c 4 www.google.com.tw

ifconfig setup or print network Ifconfig eth0 xxx.xxx.xxx.xxx

48

Page 49: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

System

reboot shutdown –r

shutdown shutdown -h now

ps print process ps aux

kill terminate process kill <PID> killall <service_name>

49

Page 50: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

uname show system info. uname –r uname –a

Free memory allocate state sync store memory buf. to disk

50

Page 51: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Vi Editor

vi filename

51

Page 52: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Visual Mode

yy copy a row

p paste a row

dd delete a row

52

Page 53: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Insert Mode

Input what you want

53

Page 54: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Command Mode

:wq save file and quit

:q! un-save and quit

:100 jump to 100th row

/<key> find [key] in this file press “n” to “Next”

54

Page 55: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

Tips

Tab Command complement File complement

Up/Down Record command history

` <action> ` First to do Ex. ifconfig `cat net.conf`

net.conf eth0 x.x.x.x

55

Page 56: 1 Introduce Linux Speaker: Yi-Ji Jheng Date: 2007.09.26

First program - Hello World ~!

touch test.c vi test.c

Main (normal vs prototype)

gcc test.c –o test file test ldd test strip test gcc ––static test.c –o test

56