Fundamental know-how of Linux tech

Embed Size (px)

DESCRIPTION

course outline for fundamental knowledge of Linux

Citation preview

Linux

Linux()

Unix MIT X Window Sun Openlook IBM/HP OSF (Open Software Foundation) Motif Motif CDE(Common Desktop Enviroment) Motif/CDER Windows Unix linux 1996 10 Lyx Matthias Ettrich KDE KDE K Desktop Environment CDE KDE GPL KDE Qt Qt Unix Qt GPL KDE GPL GNU Harmonny Qt 26 Miguel De Icaza GNOME(GNU Network Object Enviroment) KDE linux RedHat KDE/Qt RedHat GNOME Motif VS Openlook Trolltech KDE Qt KDE Free Qt QPL GNOME GTK GPL GNOME Qt/KDE C++ GTK/Gnome C GNOME KDE KDE1.1.2 GNOME1.0 GNOME1.0 KDE 1.0 Alpha GNOME linux Linus KDE 2000: Apple Eazel GNOME GNOME Helix Code GNOME KDE 2.0 KDE KOffice Kdevelop Kounqueror Internet EXPloer Sun Red Hat Eazel Helix Code GNOME Sun Star office GNOME Trolltech 10 4 Qt free edition GPL KDE Qt GNOME GNOME KDE/Qt GNOME Office/ Qt/GTK ? C++ Qt

Linux

Linux

Linux

IDE: /dev/hdx

SCSI: /dev/sdx

SATA: /dev/sdx

4 hda1,2,3,4

hda5

Linux vs. Windows

hda1 (C:)hda5 (D:)hda6 (E:)hda7 (F:)

hda2hda1hda2hda3

hda5hda6hda7

hda4

U

kickstart

swap 12


/boot/home
/opt/usr
/var

GRUB

GRUBGRand Unified Bootloader

GRUBLinuxBSDOS/2BeOS Windows

GRUBLILOLinux

Bash

?

Microsoft WindowsLinux

login:

: #
$

su username

root: sudo

X Windowstartx

CLI=Command Line Interface

history

!numberCtrl+RAuto complete

alias

: konsole, tty, who, chvt 2


(gpm)

BASH
John 3:1 Most assuredly, I say to you, unless one is born again, he cannot see the kingdom of God.

bash GNUUnix shellBourne-Again SHell Bourne shell(sh)(Bourne again / born again)

Bourne shellshellStephen Bourne1978Version 7 Unixbash1987Brian Fox1990Chet Ramey

bashLinuxMac OS X v10.4shellUnixMicrosoft WindowsCygwinMSYSwindowsPOSIX

\Tab

\C-o

\M-? M-= TabM- \A+\S+/

\M-# \A+\S+3

\M-! ``sudo`` \A+\S+1

\M-~ \A+\S+`

\M-@ \A+\S+2

\M-$ \A+\S+4

\M-_ \A+\S+-

\M-* \A+\S+8

Vim=VIsual editor iMproved I A

ESC

:w

:q

:wq

:q!

:wq!

dd

n yny

p

/abc

:1

:$ G

ZZ

Emacs

EMACS vs. vi :The endless geek 'holy war'
EMACSVI


http://www.pathname.com/fhs/

fhs-2.3.pdf

/bin

file, which

/boot

vmlinuz

initrdinitial ram disk

System.mapkernelsymbolssymbols

/boot/grub

/devdev=device

bblock

ccharacter()

Linux()

sda16

mknod major minor

mknod /dev/sda16 b 8 16

USB

/usr/src/linux-/Documentation/devices.txt

fdisk /dev/hda

m

p

d

n

l

w

q

Parted

gparted, qtparted

/etc

/etc/inittab

/etc/fstab

/etc/profile

shell/etc/bashrc

/etc/rc.d/init.d/

/etc/rc.local

init
A good start is a half done.

init

1


init 0
shutdown -h now


init 6
shutdown -r now

init 1

/etc/fstab6

(blkid)

dump

fsck01

/etc

/etc/profile

/etc/profile.d/*.sh

env

echo $PATH

export PATH=$PATH:/new/path

/etc/bashrc

$USER/.bashrc

$USER/.bash_profile

/home

user1, wheel/home/a

adduser -g wheel -d /home/a user1

userdel -r username

/etc/passwd

/etc/shadow

/etc/group

/etc/defaults/useradd

/etc/skel/

/etc/login.defs

/lib/usr/lib

Linux(.a)(.so)

libxxxx.axxxxlib

libxxxx.so.major.minor, xxxxlib, major, minor

/etc/ld.so.conf

lddldconfig

/mnt

mount -t /

mount -t iso9660 /dev/cdrom /path

mount file.iso /path -o loop

/media:

mount /dev/sdb1 /path -o iocharset=cp936,utf8=0

umount /mount_point

eject

/etc/fstab

/proc

/proc/[number]/

/proc/cpuinfo CPU

/proc/dmaDMA

/proc/interrupts

/proc/ioportsI/O

/proc/kcore

/proc/meminfo

/proc/version

/proc/cpuinfo 6 HT

processor

physical id

core id

siblings

cpu cores

vendor id GenuineIntel

/lost+foundext2ext3fsck

/optoptional

/misc

/root

/selinuxSecurity Enhanced Linux

/sbin

/srv

/sys2.6Sysfs,

proc

devfs

devpts

/tmp

/usr

UNIX System Resource

/usr/bin/:/usr/sbin:/usr/local/bin...

/usr/share/doc:MANPATH

/usr/share/fonts/zh_CN/TrueType/

/usr/share/wallpapers

/usr/include/

:/usr/src/linux-/

/var

/var/log/

/var/www/html/

FTP/var/ftp/

Spool=Simultaneous Perioheral Operation On-Line: /var/spoolmail, news,

/var/tmp: /tmp

/var/run

/var/lock

man

man

1

2

3

4 /dev

5 /etc/passwd

6

7

8 root

9 Linux

n

o

l

Woman

man

man code command

q

man -a command

man

man -aw command

man command | col -b > file_for_help

/etc/man.config

info


dmesg

mount

fdisk -l

free

df -h

du -sh

uname -a

PCIlspci [-vvxxx]
/ets/sysconfig/hwconf

GUI

XXFree86Xorg

X11R6=X protocol version 11 Release 6

/etc/X11/xorg.conf

startx = xinit + startkde

KDEGNOME


OS->Xserver->Xprotocol->wm->Xappl.

KDE vs. GNOME
Matthias EttrichMiguel De IcazaOpen LookBySUNCDEMotifByIBM/HP

/etc/X11/xorg.conf
cp /etc/X11/xorg.conf /etc/X11/xorg.conf.orig

ServerLayoutX Server

FilesX Server

Module

InputDevice

Monitor

Device:vesa

Screen:

DRI=Direct Rendering Infrastructrue 3D

eth0, lo, wlan0, ppp0

/etc/sysconfig/network

IP
/etc/sysconfig/network-scripts/ifcfg-eth0

/etc/hosts

DNS/etc/resolv.conf

/etc/services

/etc/protocols

ifconfig

IP
ifconfig eth0:0 172.16.87.5 netmask 255.255.248.0


ifconfig eth0 hw ether xxxxxxxxxxxx

eth1
ifconfig eth1 down / ifdown eth1

eth1
ifconfig eth1 up / ifup eth1

ping

/proc/sys/net/ipv4/icmp_echo_ignore_all

/etc/init.d/network restart

netstat -anp

route -n


route add default gw

nmap -p 'port_range'
nmapfe

traceroute

server1

tcpdump dst host server1

/etc/modprobe.conf

/etc/modprobe.d/

/lib/modules//kernel/drivers/


lsmod/insmod/rmmod/modinfo/modprobe

depmod -a

/lib/modules//modules.dep

cat:concatenate files and print on the standard output

-n 1

-b -n

-s

cat -n textfile1 > textfile2

tac

head/tail

more/less

grep apache /etc/passwd

-A num(After)num

-B num(Before)num

-v

sed


sed -e '1,10d' /etc/services | more

#
sed -e '/^#/d' /etc/services | more

ftp
sed -n -e '/ftp/p' /etc/service | more

awk

3

:
awk [-F filed-separator] 'commands' input-files

awk:
awk -f awk-script-file input-files

awk -F":" '{ print $1 $3 }' /etc/passwd

awk -F":" '{ print "username: " $1 "\t\tuid:" $3 }' /etc/passwd

diff

patch

cmp

commfile1file2


find /path -name "[A-Z]*" -print

1Mb
find . -size +1000000c -print

5
find / -mmin -5

locate

updatedb

/etc/updatedb.conf

rwx

ownergroupothers

chmod 755

chmod [uoga][+-=][rwx] file

-R

/umask

/

chown

chgrp

ls /etc > filename

ls /home >> filename

wrong_com 2> filename

&>

FD=file descriptor

30stdin, 1(stdout), 2(stderr), 3-9

Linux

cal 9 1752

ccal 2010 -t > ccal.html

ddate Discordian: 573

xeyes

oclock/xclock

yes

bc

glxgears

ps

ps -ef

ps aux

pstree

kill

kill -9

xkill

[Ctrl]+[Alt]+[backspace]

ps

USER

PID

%CPUCPU

%MEM

VSZKB

RSSKB

TTY

"?"

STATDRSTZZW

root (hd0,n)

kernel /path/vmlinuz

initrd /path/initrd.img

boot

Linux

NFS/HTTP/FTP

ISO

dd if=/dev/cdrom of=disc1.iso

boot: linux askmethod

: root

GRUB

/etc/grub.conf

password --md5

grub-md5-crypt

fdisk/parted

mkfs.ext3

mount

/etc/fstab

GRUB
Linuxsda6GRUBMBR

\C+\A+F2

mkdir /tmp/test

mount /dev/sda6 /tmp/test

chroot /tmp/test

mknod /dev/sda b 8 0
mknod /dev/sda6 b 8 6

vi /etc/grub.confboot=/dev/sda

/sbin/grub-install /dev/sda

mpg123mpg123-1.10.0.tar.bz2

tar xjvf mpg123-1.10.0.tar.bz2 -C /opt

/opt/mpg123/

INSTALL

./congifure
make
make install

mpg123