Download Architecture and Commands - Fundamentals of Computer Science - Lecture Slides and more Slides Computer Fundamentals in PDF only on Docsity! LINUX Architecture and Commands Docsity.com OUTLINE • Architecture – System Structure – Linux Source Tree • Commands – System Information – File System – Network Configuration – Download Files from Internet – Compress/Uncompress Files – Compiler Usage – Update Source List – Others – Help Documentation • Hot-Key • LAB – Practice to Use the Commands • Reference Docsity.com Architecture
¢ System Structure
(cont’)
— The Ubuntu Directory Tree
[Directory | Content
joan [Essential command binaries
[poot Static files of the boot loader
jaew [Device files
Jere [Hlost-specific system configuration
frome [User home directories
[a ib [Essential shared libraries and kernel modules
|media [Mount point for removable media
front [Mount point for mounting a file system temporarily
[proc [Wirtaal directory for system mformation
jroot [Home chrectory for the root user
[shan [Essential system binaries
jorv [Data for services provided by this system
[sys [Wirral directory for kernel data structures
fexp |Temporary files
fuse |Secondary hierarchy
jvar [Variable data
jope |Add-on application software packageDocsity con
3
Architecture
(cont’)
¢ Linux Source Tree
— Layout
T
Docsity.com
Architecture (cont`) • Linux Source Tree – Size of directories (KB) Docsity.com Commands (cont`) • System Information – dmesg //print the kernel ring buffer Docsity.com Commands (cont`) • File System – df //report file system disk space usage – df -aT Docsity.com Commands (cont`) • File System – du //estimate file space usage • du –s ./* Docsity.com Commands (cont`) • File System – ls • ls -al // long listing format Docsity.com Commands
(cont’)
¢ File Systen
ONO 000 O00
— columns ee eee | |
“LO YP owner group others #(links) owner group
GN
d directory x execute
1 link r read
b_ clock device W_ewrite
¢ char device
Docsity.com
¢ File System
—Is
¢ Is --colo!
Commands
(cont’)
Shans
Hee MBE Haw FERRO SAE? REbL?
generater@gensretor-desktop:/$ ls --coler=never -1 =]
wat 108
drwar- sr-
dewsr- ar
Lrwar wary
drvar- sr-=
dewsr- ar-
drwar- =r-=
drew: sr-=
lirwawarws
dhrwncr- ser= 5
drew: a1-=
dewar-ar- =
dhrwncr- ser= 5
drew ar-
dear e
drwer- sr-
drweg- ar-#
drviar- ar- =
drewer- s1- =
drvnar wart
drwar- ar-=
dewer- s- =
Lins wear wc
root
root
root
root
root
root
root
root
reat
root
root
rest
root
root
reat
root
root
root
root
root
1h root
1 root
ESannakmy wen denwShoon
root.
root
root
root
root
root
root
reet
root
root
reot
reat
root
reot
root
Poot
root
root.
root
root
root.
root
4086
4086
at
isso
4086
4086
4086
33
4086
ag doz
4086
4086
4086
°
4086
4085
4086
a
4086
ACB5
4086
30
au0- 2-02 US:
2007-02-02 08:
2007-02-02 08:
2007-03-01 09:
2007-03-02,
2007-02-02,
2006-19-25
2007-02-02
2aN7- 02-02
ZI07- 2-02
2006- 19-25.
7-02-02
2006-19-25
2007-03-01
a1 02-02
Z07- 02-02
2006-19-25.
2007-03-01
2007- 03-02
2006-19-25
2006-10-25
2007-02-02,
generateriigenerator-dasktop 1/6 ff
SSSESRASSS RES RELSS
33,
a1
ag
SZ
44
iB
26
a1
a3
gg
26
42
26
§2
a7
a2
26
2
SL
26
io rar
:Od enlinus -> boet/vul inus-2.6.17- 10- generic
bin
boot
edrom -> madia/edron
dew
ete
home
initrd
initrd.ing -> boot/initrd.ing 2.6.17 10 generic
lib
lost+found
nedia
ant
ont
proc
root
shin
a
ays
ip
usr
Docsity.com
Commands (cont`) • File System – rm //remove files or directories • rm -r ./TestDirectoryName • (remove directories & their contents recursively) Docsity.com Commands (cont`) • File System – cp –a //copy directories recursively – mv //rename Docsity.com Commands (cont`) • File System – chown //change file owner and group • chown -R OWNER_ACCOUNT FILE_OR_DIR • chown -R OWNER_ACCOUNT:GROUP FILE_OR_DIR Docsity.com Commands (cont`) • File System – ln –s SOURCE TARGET //Symbolic Link Docsity.com Commands (cont`) • File System – Hard Link V.S. Symbolic Link Docsity.com Commands (cont`) • Network Configuration – Dynamic IP • To edit the file: /etc/network/interfaces Docsity.com Commands
(cont’)
t generato nerator-desktop, ~/Desktop
® Down load REO REE BRU AHO ARE AHL
generatorfgenerator-desktop:~/Desktop$ pwd
fhowe/generator/Desktop
generatorfigenerator- desktop: */Desktop$ wget ucl ibc.org/downl oads/uCl ibc- 0.9.28.3.tar.gz
_ wget *-07:24:16-- http://ucl ibe .org/downl oads/vCl ibe- 0.9.28.3.tar.ez
=> ‘uClibe- 0.9.28.3, tar.gz’
TETE SRE uclibe.org... 140,211. 165.42
JETEIHR uclibc org| 140.211. 166,.42|:80... HLT «
Gish HTTP BR» EES RE... 200 OK
EE: 2,446,328 (2.3M) [appl ication/x gzip]
100%[ ==: =>] 2,446,328 324. 11K/s ETA 00:00
07:24:26 (277.78 KB/s) -- Ee tClibe-0.9.28.3.tar.gz’ [2446328/2446328] >
generatorilgenerator- desktop: ~/Desktop$
Docsity.com
Commands (cont`) • Update Source List – wget http://apt.ubuntu.org.tw/sources.list.edgy – sudo cp /etc/apt/sources.list /etc/apt/sources.list.ORG – sudo cp sources.list.edgy /etc/apt/sources.list – sudo apt-get update – sources.list.edgy for Ubuntu 6.10 – sources.list.dapper for Ubuntu 6.06 • Install RAR Tool – sudo apt-get install rar • Install build-essential packages – sudo apt-get install build-essential Docsity.com Commands (cont`) • Compress/Uncompress Files – tar • tar -zxvf ./test.tar.gz //uncompress • tar -zcvf ./test.tar.gz ./test -R //compress • not compressed – tar -xvf test.tar //unpack – tar -cvf test.tar ./test –R //pack Docsity.com Commands (cont`) • Compress/Uncompress Files – rar • rar a ./test.rar ./TEST //add files to archive Docsity.com Commands
(cont’)
enerator-desktop,; —/test compiler
° Compiler U we me wae cua sae zm
generatorfigenerator- desktop :~/test_compiler$ 1s -1 («|
sat 4
—_ gtt+ SOUR -rwr--r-- 1 generator generator 91 2007-08-08 16:28 hello.cpp
generatorfgenerator- desktop :~/test_compiler$ cat ./helle.cpp
#incl ude<iostream>
using nawespace std;
int main(void)
{
cout<<"Hello Worl d”<<endl 5
}
generatorflgenerator- desktop!~/test_compiler$ g++ ./hello,.cpp -o ./hello.o
generatorfgenerator- desktop :~/test_compiler$ 1s -]
205+ 16
-rwr--r-- 1 generator generator 91 2007-03-03 16:28 hello.cpp
-rwsr-=r-x 1 generator generator 8392 2007-03-08 16:31 hello.o
generatorfgenerator- desktop :~/test_compiler$ ./hello.o
Helle World
generatorfigenerator- desktop !~/test_compiler$ §j
3 Docsity.com
Commands
(cont’)
generatoragenerator-desktop; ~/fest gcc
° Compiler US ee ane maw een Ame eRe
generatorilgensrator- desktop :~/test_gech Is -1 +
SBat 4
—_ gcc SOU RC -rwer--r-- 1 generator generator 66 2007-03-03 16:39 hello.c
generator@generator- desktop :~/test_gec$ cat ./hello.c
#incl ude<stdio b>
int waintvoid)
{
}
printf ("Hello World!\n”);
generatorfgenerator- desktop:~/test_gech gece ./hello.c -o .fhello.o
generatorfgenerator- desktop :~/test_gech Is -1
Bat 12
-rwer--r-- 1 generator generator 66 2007-03-03 16:39 hello.c
-rwer-=r-x 1 generator generator 6625 2007-08-03 16:40 hello.o
generator@generator-desktop:~/test_gcch ./hello.o
Hello World!
generatorfgenerator- desktop: ~/test_gech Jf
3 Docsity.com
Commands (cont`) • Compiler Usage – strip //discard symbols from object files Docsity.com Commands (cont`) • Others – sdiff FILE1 FILE2 // side-by-side merge of file differences Docsity.com ¢ Others
— grep
* grep -n
Commands
(cont’)
alanis Bape ease eae)
OSE: HABE? Boi SMa RG? RBH:
generator fgenera tor- desktop: ~/test_arenk 1s -F
imede.c super.e tl
AL
buffer .c
senerotorfscnerater- desktop ~/test_ereph grep -n printk t.¢
inode .ctZ31: printk(’VFS: inode busy on removed device Ndfiidsn”,
inode .c 1308; peiotk¢"VPS: iputi trying to free free inode\n™};
Anede i340; orimik(VFE: device fid/Ne, inode Alu, mode-0807o.n",
inode .c:370: printkeOVPS: No free inoces - comtact Linussn");
anode .c 1380; peintk (VPS; get_enpty_inede; bad free inode count .in™):
inede .¢:485 peiotk<¢’Whee.. inede changed fron under us. Tell Linus\n"};
super .¢! 143! printkt’VFS: Root dovice Ye/¥d! prepere for arnagedeen’n”,
super .c! 120: printk("VFS: Mounted device Nd/iid - tesk, tesk\n™,
super .o! 144: printk?"VFS: on device Yd/Yd: get_fs_type(¥s? failed‘n”,
super .c: 135: peintk<¢’VPS: put_unnaned dew: freeing unused device %d¥d\n",
super .c:Z25 primikOVFS: umount (id/Ne>: mounted ined= has i_nownt-NULL\n",
super .ci515: ocintk(KERN_NOTIGE "YPS: Insect root flonny and ress ENTER\n"};
super ¢:5R0; printk (VFS: Kounted root (Xs filespsten}¥s.\n",
generatorfenerstor-cesktop!~/test_graph fj
*)
HAIOR (ew), MINOR (dew >;
Docsity.com