You are on page 1of 105

1

Basic Linux Command


Basic Linux Command Unix

cat

chmod (permission)

cd

pwd

cp

echo
ls

more
mkdir
mv

rm

rmdir
telnet Remote Login
ftp

vi
editor
pico
editor Unix
df
disk
du

disk
mount File System
umount File System
ifconfig network interface configuration tool
netstat network interfaces
rpm
Red Hat (Red Hats
Package Manager)

cat

cat cat
concatenate
: cat <file_name>
file_name

: /etc/motd

$ cat /etc/motd
: /etc/passwd
/etc/motd

$ cat /etc/motd /etc/passwd


: /etc/motd

$ cat /etc/motd > book


: chapter1
chapter2 chapter3
book
$ cat chapter1 chapter2
chapter3 > book
: chapter1
chapter2 chapter3
book
cat

$ cat chapter[123] > book

$ cat chapter? > book

$ cat chapter* > book


: cat


2-3 editor
cat

$ cat > quick
this is the first line
this is the second line

this is the last line


^D
$
cat

quick

ctrl-d




cat

chmod

chmod (permission)

: chmod [option] mode <file_name>


file_name permission
mode
permission

permission 3

- user (u) (Username)

- group (g)
(Username)
group
- others (o)

$ ls mycommand permission
mycommand

-rwxrwxrwx
1
train1
users
Apr, 25 09:23 mycommand

permission mycommand
3

1
permission user(u)

2 group (g)

3 others(o)

permission 3
r permission read
w permission write

x permission execute

: permission
mycommand read

$ chmod a+r mycommand
: permission
mycommand execute
mycommand

$ chmod +x mycommand

cd pwd

cd

pwd



: cd <directory_name>
:
pwd
cd


pwd



:

$ pwd
/home/train1
: bin

$ cd bin
:

$ pwd
/root
:

$ cd /root
:

$ pwd
/root
:
Home
$ cd

:

$ pwd
/home/train1
cd



HOME ..





cp

<destination>

cp (copy)
: cp [option] <source>
source

destination

: oldname
copy

newname

$ cp oldname newname

echo

echo
argument
: echo [argument]
argument

:
$ echo Hello world!
Hello world!
:
$
$ echo $HOME
/home/train1
: argument

$ echo c*

ls

ls



: ls [option] [file_name |
directory_name]
file_name



directory_name



option


-l




ls
-t


ls

-d
argument ls

-a ls


.

.profile
: ls option -l
$ ls l /usr/acct/dks/book
-rw-rw-r- - l dks usr 4680 Nov 9 14:51
/usr/acct/dks/book/chapter1
-rw-rw-r- - l dks usr 3178 Nov 10 12:58
/usr/acct/dks/book/chapter2
-rw-rw-r- - l dks usr 1685 Nov 10 16:07
/usr/acct/dks/book/chapter3
: ls option -l -d
$ ls ld /usr/acct/dks/book
drwxrwxr-x 2 dks usr 80 Nov 8 12:27
/usr/acct/dks/book
ls eg

more

more

1

: more <file_name>
file_name


: more
$ more poems
1 ,
spacebar
return enter
b
q


more

mkdir

mkdir

: mkdir <directory_name>
:
mydir
$ mkdir mydir

mv

mv
: mv <source> <destination>
source


destination

:
oldname newname
$ mv oldname newname

rm

rm

: rm [option] <file_name |
directory_name>
option
rm

-r

(recursive)

-f
(force)
prompt

file_name


directory_name


1
$ rm oldbills oldnotes badjokes

$ rm -r ./bin

$ rm f oldbills oldnotes badjokes

rmdir

rmdir

: rmdir <directory_name>
directory_name

: essays
$ rmdir essays

:



rm

telnet

telnet Remote login


: telnet <hostname> [port]
: telnet health.moph.go.th port
23 prompt login Unix
$ telnet health.moph.go.th 23

FTP

FTP
TCP/IP (upload download files)
: ftp <hostname> [port]
: fubar.net
mystuff homework11
$ ftp solitude
Connected to fubar.net.

220 fubar.net FTP server (Version


wu-2.4(11) Mon Apr 18 17:26:33
MDT
1994) ready.
Name (solitude:carlson): jeremy
31 Password required for jeremy.
Password:
230 User jeremy logged in.
ftp> cd mystuff
250 CWD command successful.
ftp> get homework11
ftp> quit
: fubar.net
mystuff collected-letters
$ ftp solitude
Connected to fubar.net.
220 fubar.net FTP server (Version wu-2.4(11) Mon Apr 18
17:26:33 MDT
1994) ready.
Name (solitude:carlson): jeremy
331 Password required for jeremy.
Password:
230 User jeremy logged in.
ftp> cd mystuff
250 CWD command successful.
ftp> put collected-letters
ftp> quit
: ftp /
ascii
binary
ascii

get put

vi

vi (visual editor) editor


unix
vi 22 vi
ed cursor /
vi
ex editor
ex vi vi 2

10

(comand mode) (text entry mode)


command mode
2 (line oriented command)
(visual oriented command)
: vi [file_name]
file_name


vi vi
1
vi
:n

vi

a,i,c,o, s


Esc
Del
: Q

zz
:wq

vi
[]
[] operand

2
2
2 operand

3 dw d3w 3

11

(d delete, w word) 3d2w 6



cursor
h cursor 1
j
cursor
k cursor


l
cursor 1
^ cursor
o cursor

$ cursor
w cursor
b cursor





e cursor


cursor

(
cursor
)
cursor




}
cursor
{
cursor
H
cursor
M cursor
L
cursor
^D
^U

^F 1
^B 1

x
cursor
c

s

Esc

12

/ cursor
? cursor
/^ cursor
/$ cursor


?^
cursor
Cursor
? $
cursor

?
n
N

cursor

cursor
i
cursor
A $a

I ^i


# @ ^h 1 ^w
1



s//

: 2, 5s/the/this
: 2, 5s/the/this/g
: 2, 5s/^the/this


4s/.ow/now/g

13

n1,n2mn3

: $-3, $0

w
q

q!
e!
copy :
d

y
yank
operand

{


u

U




vi J
vi

:!
option vi
option set se
:se option
:se no option

14

pico

pico text editor Unix User


pine pico editor pine
menu

: pico [file_name]
file_name

: pico pico $
prompt.
$ pico
, ^ "ctrl" key, ctrl key :
^V
-
^Y
-
Ctrl^ - marks text

cut / paste
^K
- copies deletes highlighted text text
cursor
^U
- uncuts or pastes text buffer
^O - Saves text
^X
- Exits pico

df

df (disk free) disk

du

du (disk usage) disk



: du [option]
option:
-a
disk (
)
-b
disk
-s (summarize) disk

: disk Home
$ du -s *

15

mount

File System Linux


mounting umount filesystems
mount devices file system
, floppy drive CD-ROM
mount
: mount -t fstype device mountpoint
fstype
filesystem device
mount; floppy disk Windows 95 "vfat"
device
special device file device
floppy ,
/dev/fd0 device
mountpoint location filesystem device
mount ;location
system floppies

/mnt/floppy mount Windows 95 floppy disk


drive "A:" readable Linux, :
$ mount -t vfat /dev/fd0 /mnt/floppy
drive A: :
$ ls /mnt/floppy

CD-ROM Drives

Mount CD-ROM drive mount floppy


disk cartridge CD-ROM discs "high Sierra"
ISO-9660 file format,
Linux
"iso9660" filesystem format:
$ mount -t iso9660 /dev/cdrom
/mnt/cdrom
file CD-ROM disc access copy directory
/mnt/cdrom Linux copy directory
/mnt/cdrom
CD-ROM disc read-only medium!

Copy File Windows 95/98 Linux

Copy file operating system dual-boot


machine Linux partition mount point
mount Windows disk : $ mkdir /DriveC
mount mount device , filesystem
"vfat" (Windows 95)

16

common disk devices


Special File Device
/dev/fd0
First floppy drive
/dev/fd1
Second floppy drive
/dev/cdrom CD-ROM drive
/dev/hda[1- First hard drive (IDE 1,1) and
16]
partitions 1-16
/dev/hdb[1- Second hard drive (IDE 1,2) and
16]
partitions 1-16
/dev/sda[1- First hard drive (SCSI 0) and
16]
partitions 1-16
/dev/sdb[1- Second hard drive (SCSI 1) and
16]
partitions 1-16
/dev/sdc[1- Third hard drive (SCSI 2) and
16]
partitions 1-16
/dev/sdd[1- Fourth hard drive (SCSI 3) and
16]
partitions 1-16
Windows
IDE hard drive computer
system partition
mount Windows hard drive Linux :
$ mount -t vfat /dev/hda1 /DriveC
Windows drive mount list content drive
:
$ ls /DriveC
list file directory "C:Windows" :
$ ls /DriveC/windows

umount

umount (umount)
File System
: umount [option] [device | dir]
option
unmount

-h Help
-a File System
/dev/mtab
-f
umount

17

device
File System unmount
/dev/hda1 , /dev/hda2,
/dev/hdb1, /dev/hdc1
dir


File System
umount


File
System
File System
: File System (unmount)
(device)
$ umount /dev/hdc1
: File System (unmount)

$ umount /mnt/DOS_hdc1

ifconfig
tool

ifconfig network interface configuration

: status sl1 interface:


1. netstat -i output sl#
interface sl0, sl1, sl2
2. ifconfig sl# ifconfig output
key fields :
flag
operational SLIP link
Point To Point , link
down disconnect
Flag
ifconfig sl# up ifconfig sl#


network sl# interface activate
UP Flag
operational

18

slattach
link access dial

remote end return
Running Flag
CARRIER DETECT
CD flags update
running bit

netstat

netstat ifconfig
TCP/IP network interface
: netstat -in
-i flag
network interfaces
-n flag the IP addresses host name
verify SLIP interfaces, addresses, and hostnames
netstat -in output
program save basic settings a
Hayes-compatible modem :
Name Mtu Network Address
lpkts Ierrs
Opkts
Oerrs Col
lo0 1536 <Link>
2462
0
2462
0
0
lo0 1536 127
localhost.austi
2462
0
2462
0 0
tr0 1492 <Link>
1914560 0
21000 0
0
tr0 1492 129.35.16 glad.austin.ibm 1914560 0
21000 0
0
sl0 552 1.1.1.0 1.1.1.1
48035 0
54963 0
0
sl1* 552 140.252.1 140.252.1.5
48035
0
54963 0
0
netstat -in Command Output
* sl1 interface network
interface down) user
ifconfig sl1 up SLIP interface

19

netstat statistics input output packet counts


input output errors SLIP
connections

user ping remote host SLIP link


ping hang
netstat -in command shell and Opkts

Ipkts remote host remote


system
return ( receive) information
run netstat remote system
receipt ping packets error count
translation hostnames Internet numbers

name resolution critical operation
SLIP line
debug hostname, aliases, routing ,
netstat -rn
basename host hostname
return
/etc/hosts file machine nameserver (
/etc/resolv.conf), name-server return qualified-domain
name

rpm

Red Hat Package Manager (RPM)


Package Red Hat
Package Red Hat
: rpm [option]
: Package
$ rpm -i xsnow-1.40-5.i386.rpm
-i
Package
-v
rpm
: Package
1
$ rpm -qa | more
: Package faq
$ rpm -qi faq

20

:
Package faq
$ rpm -ql faq
: (erase) Package faq
$ rpm -e faq
: /usr/bin/uptime
Package
$ rpm -qf /usr/bin/uptime
(Virtual Console)
(Virtual Console)

<Alt>
<F1> <F12>
12
(
)
<Alt><F1>, <Alt><F2>, ... <Alt><F12>
(Text file)
(Text file)

cat -ve <Enter>


"$"
cat -ve sample.txt
(Change Directory)
(Change Directory)

cd <Enter>
Home Directory

cd <Enter>

21

Directory cd /usr/bin

cd .. <Enter>

1
/usr/bin
cd ..
/usr

logout <Ctrl><D>

exit <Enter>

logout <Enter>

(List)

ls <Enter>


(Hidden File)

ls -a <Enter>


ls -l <Enter>

22




(long format)

ls -d <Enter>

ls <Enter>

ls -c <Enter>
/

ls -t <Enter>

ls -u <Enter>

ls -F <Enter>

"/"
"*"
"@"
symbolic link

23

Options ls ls -la


wildcard

*
?
[ ] a[0-3] a0, a1, a2. a3 [a-c]1
a1, b1, c1

(Make Directory)

mkdir <Enter>




mkdir homework

mkdir -p <Enter>

mkdir -p
work/homework/math
mkdir work
cd work
mkdir homework
cd homework
mkdir math

24

(Text file)

more [option] <Enter>




<Spacebar>

<Enter>
<h>
<q>
Option
-c


-d "Press space to continue, 'q' to quit"
-n n -10
10
+num
(num)

passwd <Enter>

pwd <Enter>

root Super User

25

shutdown -h now <Enter>


(-h = halt)

shutdown -r +5 <Enter>
5 (-r =
reboot)

shutdown -r now <Enter>

shutdown -r <Enter>

shutdown -r
3:00
3

32

(MultiUser-MultiTasking) X
(
) TCP/IP

(compatible) POSIX


Berkeley System V

26

(kernel)

I/O

( Shell
X )

386 486




DEC Alpha ,
Motorolla Power-PC , MIPS

. 1980 (Linus
Trovalds) (Computer Science)

(Minix)
. (Andrew S. Tanenbaum)




27




2.0.13
1.0.x,1.2.x

1.1.x, 1.3.x



"Running Linux" Matt Welsh and
Lar Kaufman








, , ,
,

32

Linus
UNIX

X Windows
window manager
TCP/IP ,SLIP, PPP, UUCP

28


(DOSEMU) (WINE)




Caldera
WABI 2.2
OpenLinux




- Emacs, Tex LaTeX

-
- DOOM





YardSQL, JustLogic
SQL NEXUS
WordPerfect

Caldera
Network Desktop








29


C/C++ GNU
X TCL/TK
Perl, Smalltalk , Pascal, Lisp
X-Base
FoxPro









OOP (Opject Oriented Programming :
)
(C++)


(Java)

30

Perl ()



CGI
GUI X window
C X

X Tcl/Tk (-
-)
X

wpe/xwpe

wpe xwpe

Turbo Pascal , Turbo Basic Turbo C/C++
wpe/xwpe
break point
,
wpe/xwpe

31





ISP (Internet Service Provider)


root super user



Login : root
Password : ********




super user "#"
"$"

ls list directory

32

# ls
mbox
DIR



mbox
casesensitive
cat Cat





Logout exit





root

root
# /sbin/shutdown -h now ( )

# /sbin/shutdown -r now
"now"



(permission) root
$ su root ( su )
password : ********
# <--- '#' root
(Shell)

33







""




COMMAND.COM

(shell script) BATCH FILE

Bourne shells
Steven Bourne C shells
Bill Joy ( vi )
Bill Joy Sun Microsystems (
)
bash (Bourne Again
Shell) Bourne shells Free Software
Foundation Bourne shells
C shells
bash

bash
:

34

(
)


cat cat
Enter
$ cat


Enter

$ cat
This is a cat
This is a cat
cat
cat
Ctrl-d end-of-file (EOF)
( )
cat cat
cat

utility program Ctrl-d
utility program sort


sort
Ctrl-d


help

35

man manual
cat

$ man cat
CAT(1) CAT(1)
NAME
cat - concatenate files and print on the standard output
SYNOPSIS
cat [-benstuvAET] [--number] [--number-nonblank]
[--squeeze-blank] [--show-nonprinting] [--show-ends]
[--show-tabs] [--show-all] [--help] [--version] [file...]
DESCRIPTION
This documentation is no longer being maintained and may
be inaccurate or incomplete. The Texinfo documentation is
now the authoritative source.
This manual page documents the GNU version of cat. cat
writes the contents of each given file, or the standard
input if none are given or when a file named `-' is given,
to the standard output.
OPTIONS
-b, --number-nonblank
man

36




":" "-more-,Line1"
more page
( )

more page

spacebar q

(keyword)
"ps" "Postscript"
man

man -k ps

man -k Postscript
man



keyword


heirachy

(
)


(root directory)

37




"note"
"/home/mary/note"

"/"

"home" "home" "mary"
"note"
"mary"
(
"/home/mary")
"note"

( )



"ls"
"ls"
( No file found)

38

"No news is good news"






ls
ls
(current
directory)

# ls /
bin etc lost+found opt sbin var
boot home mnt proc tmp
dev lib net root usr



(option)
option "-F"
# ls -F /
bin/ etc/ lost+found/ opt/ sbin/ var/
boot/ home/ mnt/ proc/ tmp/
dev/ lib/ net/ root/ usr/
ls
option man

ls [-arF] [directory]

(template) "["
"]" option

39

pwd


(current
directory) pwd print work directory


cd

cd [directory]
cd
(home directory)





cd .. cd .
(current directory)
note

(
"/home/mary")
./note

mkdir [directory]

rm [directory]

(file permission)
permission

40

$ ls -l
drwxr-xr-x 2 root root 1024 Nov 17 21:49 axhome
drwxr-xr-x 2 root root 1024 Dec 28 13:57 backup
-rw------- 1 root root 6 Mar 31 23:26 dead.letter
-rw------- 1 root root 3075 Apr 15 03:49 mbox
permission

type (-)
(d) (b)
device file block (c) device file
character


user permission (
)
r "" (readable)
w "" (writable)
x " " (executable)
group permission
(group)
user permission

41

other permission
user
permission
(hidden file)
ls option -a

# ls -a
. .saves-622-daffy.kaiwal.com~
.. .seyon
.FVWM95-errors .tcshrc
.Xauthority .tin
.Xclients .xboing-scores
.Xclients,bkp .xfm
.Xdefaults .xsession
.bash_history .xsession-errors
.bash_logout axhome
.bash_profile backup
.bashrc dead.letter
.cshrc mbox
hidden file "." option -a

(user environment)
.bash_profile , .xsession
COPY
( )

42

cp file1 file2
(copy) file file2
REMOVE
( )

rm filename
MOVE
mv

mv filename directory
filename
directory mv


mv file1 file2
file1 file2

43

0.1

Data flow machine

Multiprocessor

10

100

10

Wide area network

100

Long Haul Network

1,000

long
haul

10,000

Internet

Local area network

44


Host (end system)
subnet

IMP (Interface
Message processor) package switching node
intermediate system

(point to point)
(broadcast channel)

IMP
IMP
IMP (message
packet) IMP IMP

45


store and forward packet switched


IMP
IMP
address
address

46


(layer)

(physical medium)


(virtual
communication)




(protocol)
IRC



IRC
(
Chat server

)
OSI (The OSI Reference model)


(model)
International Standard
Organization (ISO) OSI (Open System
Interconnection) 7

1.
(abstraction)
2.
3.

47

4.

5.

1. : Physical layer

48




"1"
"0"


2. : Data link layer



(data-frame)
(acknowledge frame)




3. : Network layer
(route)


(dynamic)




4. : Transport layer
(session layer)
network layer

session
layer

49

5. : Session layer
transport layer

(remote login)
(synchronization)

6. : Presentation layer

ASCII EBCDIC

(data compression) (data encryption)

7. : Application layer




( java bytecode java compiler
)
OSI
ARPANET : Advanced Research Project Agency Network



(
)
ARPANET OSI
OSI 10
IMP layer 2 layer 3
IMP
ARPANET OSI
network layer transport layer IP (Internet Protocol)
connectionless LAN
WAN ARPA internet

50

ARPANET transport layer connectionoriented TCP (Transmission Control Protocol)


OSI transport layer
TCP
UNIX
ARPANET session application protocol
application protocol OSI
FTP (File Transfer Protocol) ,
SMTP (Simple Mail Transfer Protocol)
TELNET
ARPANET
application protocol
HTTP, NNTP





UUCP TCP/IP
1992 Ross Biro
Net-1
Ross 1993 ,
Fred van Kempen

(Net-2)
Net-2d
1993 ( kernel
0.99.10)
Alan
Cox Net-2Debugged

Net-3 Linux 1.0
Net-3

Net-3 device driver Ethernet




SLIP (
Serial line) PLIP ( Parallel line) Net-3
Local Area Network

51


Internet host
features

driver PPP (the point-to-point protocol,
Serial line Slip)
AX.25 driver ham radio (
) Alan Cox driver Novell's
IPX protocol samba server NetBIOS
Andrew Tridgell (NetBIOS
protocol application lanmanager
Windows for Workgroup)


LAN Ethernet board

Western Digital WD80*3;


SMC Ultra;
3com 3c501, 3c503, 3c509, 3c579;
AT1500 and NE2100 (LANCE and PCnet-ISA);
Cabletron E21xx;
DEPCA;
HP PCLAN;
NE2000;
NE1000;
SK_G16;
Apricot Xen-II on board ethernet;

52

D-Link DE600;
D-Link DE620;
AT-LAN-TEC/RealTek pocket adaptor;
Zenith Z-Note;
3com 3c505(*), 3c507(*);
EtherExpress;
AT1700(*), NI5210(*), NI6510(*);
Ansel Communications EISA 3200(*).
EISA PCI
EISA
PCI
EISA PCI
PCI


DOS


PC
I/O map

I/O (base address)

Ethernet 0x300 0x600
base address
base address
autoprobing
base address
interrupt request channel

53

" "

interrupt channel 0, 1
3 15 interrupt request number
IRQ

/dev Ethernet eth0,
eth1, ... eth0 , eth1

dmesg

Swansea University Computer Society NET3.035 for Linux 2.0


NET3: Unix domain sockets 0.13 for Linux NET3.035.
Swansea University Computer Society TCP/IP for NET3.034
IP Protocols: ICMP, UDP, TCP
.
.
.
IPX Portions Copyright (c) 1995 Caldera, Inc.
Appletalk 0.17 for Linux NET3.035
3c503.c: Presently autoprobing (not recommended) for a single
card.
loading device 'eth0'...
3c503.c:v1.10
9/23/93
(becker@cesdis.gsfc.nasa.gov)

Donald

Becker

54

eth0: 3c503 at i/o base 0x300, node 02 60 8c af 87 18, using internal


xcvr.
eth0: 3c503/16 - 16kB RAM, 8kB shared mem window at 0xd80000xd9fff.



2.0



TCP/IP IP Masquerate, IP
forwarding (
IP forwarding)
/usr/src/linux make xconfig (
Linux version 2.0 make config
)

55

[m]
[y]

save
make dep; make clean


make zImage



make zImage
/usr/src/linux/arch/i386/boot zImage
/boot ( root / )
vmlinuz /etc/lilo.conf (
) /sbin/lilo




56

netstat -rn

Iface eth0


Destination Gateway Genmask Flags MSS Window irtt Iface
129.103.0.0 0.0.0.0 255.255.0.0 U 1500 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 3584 0 0 lo

(twisted pair) 2














10base-T
(Coaxial Cable)

2

(Thick Ethernet) (Thin Ethernet)
1



10 Mbps
200 500 10base2 10base-5
2 (T-juction)
(vampire tap)
BNC

Thin Ethernet

57





Thick Ethernet

(Fiber obtics) LAN



(HUP)

(Terminator)




ISP
protocol serial line SLIP PPP

SLIP PPP

DNS
DNS /etc/resolv.conf

nameserver 202.6.100.1
resolv.conf DNS KSC
internet DNS

SLIP dip
dip command line (
distribution permission root )

58

dip ISP
login ISP
username slirp
slip
slirp -b 115200
slip local IP address
local IP address IP
dip Ctrl-] (
ISP ) dip
IP
get $rmtip 202.44.144.1 IP
get $locip 10.0.2.15 local IP
netmask mtu
exit dip
SLIP netstat -rn
device sl0 ISP
dip

59

man dip
DIP
(
Shift )
, DNS (Domain Name Server), rmtip
(Remote-IP), locip (Local-IP) ( DNS
/etc/resolv.conf)
ISP
/sbin/dip <>

/sbin/dip ksc.dip
kill DIP

/sbin/dip -k
ISP
tin, lynx, telnet
ftp X window Netscape
Arena
LAN


IP FORWARDING

60

WINDOWS DNS
ISP GATEWAY
(

128.100.10.254)

pico
vi
pico
pine

pine
pico
pico
$ pico []
pico full screen editor


PgUp, PgDn
pico

61

pico




Control

Ctrl-G
pico
Ctrl-V Ctrl-Y

Ctrl-X


pico
Ctrl-X pico (
)
Ctrl-O
Ctrl-J
Ctrl-R
Ctrl-W

Ctrl-^
Ctrl-K
Ctrl-U

Ctrl-C

Ctrl-T
PPP


PPP
ISP
IP Numbers IP
real PPP
slirp slip


62

HTML
HTML server
IP
static ip dynamic ip static ip IP
ISP IP dynamic ip
IP
dynamic ip
ISP dynamic ip
( real ppp
dynamic)
dip
ISP slip ISP
ppp
ppp

chat pppd
ppp


ppp ppp server
ISP ppp ppp client


ppp client
ppp
ppp option
protocol ppp config kernel

ppp

ppp

ISP
ISP static ip dynamic ip
PAP/CHAP PAP/CHAP

HOST ISP
(machine name)
(user
name) ISP

( PAP/CHAP)

63

DNS ISP
ppp


mode execute mode
chmod +x []
root priveledge
pppd super user
(root)
/usr/sbin/pppd
ppp
/usr/sbin/ppp-on
( pppd)
/usr/sbin/ppp-off
/etc/ppp/options option pppd

/etc/ppp/options
# /etc/ppp/options (NO PAP/CHAP)
#
# Prevent pppd from forking into the background
-detach
# If you are using a STATIC IP number, edit the 0.0.0.0 part of the
# following line to your static IP number.
0.0.0.0:
#
# use the modem control lines
modem

64

# use uucp style locks to ensure exclusive access to the serial device
lock
# use hardware flow control
crtscts
# create a default route for this connection in the routing table
defaultroute
# do NOT set up any "escaped" control sequences
asyncmap 0
# use a maximum transmission packet size of 552 bytes
mtu 552
# use a maximum receive packet size of 552 bytes
mru 552
#
#-------END OF SAMPLE /etc/ppp/options (no PAP/CHAP)

ppp (manual)
ISP Host
minicom minicom
minicom telix Ctrl-A-Z
minicom

Ctrl-A-Q minicom minicom
reset modem "OK"
reset modem ppp

65

/usr/sbin/pppd -d -detach /dev/ttyS0 (ttyS0 com1


com2 /dev/ttyS1) pppd ppp
ifconfig ppp --> ppp0

ppp0 Link encap:Point-Point Protocol
inet addr:10.144.153.104 P-t-P:10.144.153.51 Mask:255.255.255.0
UP POINTOPOINT RUNNING MTU:552 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0
TX packets:0 errors:0 dropped:0 overruns:0

, ftp,
telnet, ping ps
PID (Process id) kill PID pppd
# ps -ax | grep pppd
1228 p0 S 0:00 grep pppd
1139 p1 S 0:00 pppd
# kill -9 1139

PID pppd 1139 ( 1228


grep) kill pppd
(Automatic)
/etc/ppp/ppp-on

#!/bin/sh

66

#
# Script to initiate a PPP connection. This is the first part of the
# pair of scripts. This is not a secure pair of scripts as the codes
# are visible with the 'ps' command. However, it is simple.
#
# These are the parameters. Change as needed.
TELEPHONE=0,,1601 # The telephone number for the connection
ACCOUNT=username # The account name for logon (as in
'username')
PASSWORD=passwd # The password for this account (and
'passwd')
LOCAL_IP=0.0.0.0 # Local IP address if known. Dynamic =
0.0.0.0
REMOTE_IP=0.0.0.0 # Remote IP address if desired. Normally
0.0.0.0
NETMASK=255.255.255.0 # The proper netmask if needed
#
# Export them so that they will be available to 'ppp-on-dialer'
export TELEPHONE ACCOUNT PASSWORD
#
# This is the location of the script which dials the phone and logs
# in. Please use the absolute file name as the $PATH variable is not
# used on the connect option. (To do so on a 'root' account would be
# a security hole so don't ask.)

67

#
DIALER_SCRIPT=/etc/ppp/ppp-on-dialer
#
# Initiate the connection
#
#

/bin/setserial /dev/cua1 spd_vhi

exec /usr/sbin/pppd debug /dev/ttyS1 115200 \


$LOCAL_IP:$REMOTE_IP \
connect $DIALER_SCRIPT &

echo $! > /var/run/ppp-on.pid


ISP HOST

static IP ISP LOCAL IP


ADDRESS dynamic 0.0.0.0: LOCAL IP
ADDRESS
ISP HOST
/etc/ppp/ppp-on-dialer

68

#!/bin/sh
#
# This is part 2 of the ppp-on script. It will perform the connection
# protocol for the desired connection.
#
/usr/sbin/chat -v \
'ABORT' 'BUSY' \
'ABORT' 'ERROR' \
'ABORT' 'NO CARRIER' \
'ABORT' 'NO DIALTONE' \
'ABORT' 'Invalid Login' \
'ABORT' 'Login incorrect' \
'' 'ATZ' \
'OK' ATDT$TELEPHONE \
'CONNECT' '' \
'ogin:--ogin:' $ACCOUNT \
'ord:' $PASSWORD \
'>' 'ppp'

ppp-on-dialer
ppp ISP Host
manual

69

ISP HOST
ISP terminal
ISP
Login: username <--- Login section
Password: passwd <--- Password section

ISP> ppp <--- System prompt


HOST terminal ISP




Username :


'ername:--ername:' $ACCOUNT \

( 'ogin:--ogin:') -->

('ord:') -->
('>') --> ppp
(ppp)

automatic ppp-off
ppp-off

#!/bin/sh
PATH=/sbin:/usr/sbin:/bin:/usr/bin

70

if [ -f /var/run/ppp-on.pid ] ; then
daemonpid=`cat /var/run/ppp-on.pid`
if [ -n "$daemonpid" ] ; then
kill $daemonpid > /dev/null 2>&1
fi
rm /var/run/ppp-on.pid
fi

pppd log file /var/log/messages



# tail -f /var/log/messages

Jul 10 16:08:04 daffy chat[1396]: Login: -- got it


Jul 10 16:08:04 daffy chat[1396]: send (username^M)
Jul 10 16:08:04 daffy chat[1396]: expect (ord:)
Jul 10 16:08:04 daffy chat[1396]: username^M
Jul 10 16:08:04 daffy chat[1396]: Password: -- got it
Jul 10 16:08:04 daffy chat[1396]: send (passwd^M)
Jul 10 16:08:05 daffy chat[1396]: expect (>)

71

Jul 10 16:08:05 daffy chat[1396]: ^M


Jul 10 16:08:05 daffy chat[1396]: PYT_ITS> -- got it
Jul 10 16:08:05 daffy chat[1396]: send (ppp^M)
Jul 10 16:08:05 daffy pppd[1390]: Serial connection established.
Jul 10 16:08:06 daffy pppd[1390]: Using interface ppp0
Jul 10 16:08:06 daffy pppd[1390]: Connect: ppp0 <--> /dev/ttyS1
Jul 10 16:08:07 daffy pppd[1390]: local IP address 203.151.5.109
Jul 10 16:08:07 daffy pppd[1390]: remote IP address 203.151.5.2
Jul 10 16:08:33 daffy kernel: Appletalk 0.17 for Linux NET3.035

(Computer Network)


2

(E-mail)


3
1. Local Area Network (LAN)

2. Metroploitan Area Network (MAN)


LAN

72

3. Wide Area Network (WAN)



MAN

1.

2.



1. (Local Area Network : LAN )


Local Area Network (LAN)



File Server


(Workstation) (Terminal)
workstations

73

(Cable) Network Interface Card (NIC)

LAN
1)


2) (software)




3)

4)

5)

LAN
Peer-to-Peer
Peer-to-Peer
(network operating system ; NOS)

Windows for Workgroups

Peer-to-Peer :

74



server


Windows95/98

Peer-to-Peer :

2. Client / Server
Client/Server File Server

Server
username password Login User

(Network Operating Syster
: NOS) User Login
Novell Netware, Windows NT Server
UNIX
File Server


(Network
Operating Systen)
Workstations Server
Workstation terminal

75

Server
workstation Floppy Disk Hard Drive

Server
Client / server :

Servrt


User User

Server Plat Form


Windows NT Server
Windows95/98 UNIX
Server
Client / server :
Server

Server

LAN (Lan Topoolgy)
LAN topology 3

1. STAR
(hub)
(File server) (Gateway)
Star
2

76

2. BUS
BUS
BUS 2


BUS

77

3. RING


(Repeater)

LAN
1. server
(File) (application program)
(E-mail) workstation
(terminal) LAN

2. (Terminal)
(workstation) (personal
computer)
server
server

78

3. Network Interface Card (NIC) Network Adapter Cards


(NAC) LAN Card
LAN LAN Card LAN Card
workstation


4. (Connector or Interface)

Network Interfacd Unit (NIU)

T LAN
BUS
5. (Trandceiver) Attachment Unit Interface (AUI)




6. (Controller)

-

7. (Bridge) InterWorking Unit (IWU)


LAN 2


8. (Router) IWU
LAN 2




9. (Repeater)




79

10. (Gateway) 2




1.1 (Twisted Pair
Cable)
1.2 (Coaxial
Cable)
1.3 (Fiber optic
Cable)

3.1 (Twisted Pair Cable)



(
) ()


2
3.1.1 UTP (Unshield Twisited Pair)
(ground shield)

(AT&T) 8
4 UTP RJ 45

UTP

80

2 (star)
(hub)



()

3.1.2 STP (Shield Twisted Pair)


(ground shield)
STP
UTP

3.2 (Coaxial Cable)
(conductor)

(
)

(bus)

()

3.3 (Fiber optic Cable)






81





backbone
(tap)

()


(wireless)


82


A
abend
abnormal end of task


add-in program


(Aldus Additions)
5 (Aldus PageMaker 5)

archive
3
1.



83

2.

3.
(FTP)

ARPAnet
(WAN) .. 1969
(Adavnced Research Project Agency :
ARPA)
(TCP/IP)








.. 1983

(Milnet)


artificial intelligence (AI)



expert system
authoring language








(authoring system)

84

B
binary ,
0 1
2


(bit) (byte)
0 = 1 = 8 1
01000001 1 A
A
(binary file)

bit
Binary Digit
0 1
16
32 4 1 (nibble) 8 1
1
8 0 9
01000001 A 0 1 1
1 2 0 = 1 = 0
1 8


Boolean Search

AND, OR NOT

(George Boole)
bridge

85

(LAN) 2


buffer (),











-
- 64-256

C
central processing unit (CPU) ()






3

(microprocessor)
1. (register)

2. (arithmetic and logical unit : ALU)

86

3. (control unit)


channel , , 2
1.


2. (multimedia)



characters per second (cps) ()
1
(inkjet printer), (impact printer),
(dot-matrix printer) (
)
50-800
120
(draft mode)
240
client/server network /

(LAN)

(File Server)

command



(command-driven
programs)
(menu-driven
programs)
(voice-actuation
technology)

87

communications protocol


(BBS)
(CompuServe)
(host computer)


Baud rate 2
Parity
Data bits 8
Stop bits

1
Duplex (full)
(half) full
Computer-Aided Manufacturing (CAM)
()


computer hacker ,

88


CONFIG.SYS


CONFIG.SYS

connectionless protocol

(WAN)

(on-line)
(packetswitching network)
(packet)

(Internet Protocol : IP)


cracker ,



cracker hacker hacker


computer hacker, hacker ethic security

89

D
data



(information) data datum
data

data bank

database





device
(hardware component)


(device drivers)
dialup access



(service provider)
(remote terminal)

90


dialup IP

dialup IP


(PPP) (SLIP)
(TCP/IP)
(Netscape
Navigator)

domain

(toplevel domain)
.
chulkn.chula.ac.th
th
ac (academy)
chula
chulkn


.com (commercial)
.edu (educational) .
.gov (goverment)
.mil (military)
.org (non-profit organization)

91

.net (network)
.th .ca

domain name
(host)

(host name)
(subdomain) (domain)
. (dots) watt.seas.virginia.edu

watt
600
seas (School of
Engineering and Applied Science)
virginia (University of Virginia)
edu
Domain Name System
domain name address

(host name) (subdomain)


(domain) IP (IP address)
fully qualified
domain name domain domain name
dynamic random-access memory (DRAM)
()
(RAM chip)



static random-access
memory (SRAM)

92

electroic mail address



-

mkidanan

@

mkidanan@netserv.chula.ac.th mkidanan (User
ID)netserv (host)
chula.ac.th chula
ac th
F
file ,







(clusters)
(file allocation table)




file allocation table (FAT)
(cluster)


file format

93







/ .BAK
.BK! .HLP .WP .WPF

(WordPerfect)
File Transfer Protocol (FTP) ()

(download)
(upload)

FTP ( )
ftp ( )
file transfer protocol (ftp)


(login name)


(anonymous FTP)

anonymous





forgery



94

.. 1995

G
gateway ,




(bridges)


(CompuServe)

(Archie)
(Web page)
CompuServe Archie

(LAN)

(WAN)


gigabyte ,

1,073,741,824

95

hacker ,



1980s


(cracker)

hack hacker ethic


hacker ethic

( .. 1965-1982)
(Steven Levy)





cracker, cyberpunk, cyberspace,
hack
HyperText Markup Language (HTML)
()

(parser
)


(parser programs)
(Web browsers)
(hyperlink)

96

(Web page)

(tags)
1 (headline 1)

<H1>These
tags
make
a
big
headline</H1>





(authoring)


(HTML editor) (Fxicdi),
(HTML Assistant)





6.0(Adobe PageMaker 6.0)

I
information
- -







Integrated Services Digital Network (ISDN)
()


97







(
) 8
2

3
- (Basic Rate ISDN : BRI)
64,000 2
16,000

- (Primary Rate ISDN : PRI) 23


64,000
- (Broadband ISDN : B-ISDN)
150
Internet


(remote login)



(ARPAnet)





98

(MCI) (CompuServe)
2
20

interrupt





( )

(hardware interrupt)

Intranet






(LAN)

99

J
Joint Photographic Experts Group (JPEG)
()

(ISO)
(CCITT)
(JPEG graphics)
Joint Photographic Experts Group (JPEG) graphic


(
)
(lossy compression)



10:1
20:1

(GraphicsInterchange Format : GIF)
(JPEG)
Joint Photographic Experts Group (JPEG)
L
liquid crystal display (LCD) ()





(backlit screen)


100

local area network (LAN) ()








(file
server)



(peer-to-peer network)
2-3


local bus


(expasion bus)




M
mailbox name

@
@



skit19@idt.liberty.com

101

skit19

idt.liberty.com


modem
modem modulator demodulator











(bits
per second : bps) (baud)

2,400
28,800
network , , ,

2
(NOS)

- (local area network : LAN)


2-3
1
75

102

- (wide area network : WAN)


10-1,000

-
(client-server)
(AppleTalk), (EtherNet)
(token ring)
O
operating system




- (MSDOS),

/2 (OS/2), 98
R
random access






direct access

random
access

random-access memory
random-access memory (RAM) ()



/
(ROM)
(primary storage)

103





(secondary storage)



read-only memory (ROM) ()

T
teleconference








terminal

104






(multiuser system)


(dumb terminal)

(smart terminal)


token-ring network
(LAN)

.. 1986
(Multistation Access Unit)

(twisted-pair cable)
255

U
UNIX


(multitasking)





200

105

(UNIX shells)
(NeXTStep)


user-defined

You might also like