LINUX操作系统使用与维护

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

linux1UNIX/LINUX2linux1.UNIX2UNIX3linuxkernelinternals,2ndedition4GaryNutt.KernelProjectsforLinux.Addison-Wesley.March2001.5linux20028456linuxdevicedriverghsong@cs.zju.edu.cn1.2.3.linux....................................................................................................3linuxshell...................................................................................................6UNIX....................................................................................................8shell..............................................................................................11linuxC........................................................16..............................................................................................................23linux.1();:shellswdidhomedirectoryshell/bin/sh/bin/csh$(sh)%(csh)#(root):/etc/profile~/.bash_profile,~/.bash_login,~/.profile2PATH(.)ctrl-d,exit,logoutLinuxKernelModulesDeviceDriversModuleInerceDeviceDriverInerceSystemCallInterface(POSIX.1)PPPPPOtherDevicesCPUDisk1;login:passwordUNIX/etc/passrootx050superuser//bin/csh7idshadow/etc/shadowshellshutdown/etc/groupshcsh:~/.cshrc,~/.loginPATH,HOME,PS1,PS./.2:SIGKILL,sync)haltinithalt,init0,shutdown–hnow1.3boot,grubMBRgrub,stage1linuxlinux(/boot/vmlinux,UNIX/vmunix)vel)/etc/inittab.d/rc.sysinitrunlevel)initgetty2x-window6###UNIX1SIGTERM(shutdownlinuxctrl+alt+del#shutdown–hnow#halt#init0ROMBIOSMasterbootgrubstage2,linuxgrubinit1init(runle/etc/rc/etc/rc.d/rcN(N/etc/rc.local/sbin/mingettyrootinit***init013NFS45#init0:#init6:#inits:#init2:#runlevel#ls/proc1.4shellbackspacectrl-hsttyerase\^hsttykill\^c1.5UNIXUNIXinfo1.6telnetxterminalvirtualmachine(jvm,jre)1.7useradd,usermod,userdelctrl-h,#sttykill\^u,ctrl-c,del#man#manvilinuxunixunixunixlinuxAlt+F1,Alt+F2groupadd,groupdelpasswdlinuxshell#tarzxvflinux-2.4.20.tar.gz/usr/src/linux/Makefile#makexconfig(menuconfig)#makedep#makeclean#makebzImage-/usr/src/linux/arch/i386/boot/bzImage,System.map#cpbzImage/boot#vi/boot/grub/grub.confkernel=….-kernel=/boot/bzImage/boot/vmlinuz-2.4.182.1shell2.2#ls-l2.3#ccmain.ctmpfile&2.4I/OI/O012redirection#manfindfindman&22.5(pipe)#ls–l|more#ls–l|wc-l:FIFO#mkfifopipename#mknod–ppipenametee:#ls|teesaves:2.6(metacharacter)UNIXshell*,?,[],#,\,‘‘,““,$#ls?.c#lsfile[01-59].c\:(\)’’””printf(“\\\\”);#echo‘$PATH’“”:$,`#`,\,“”echo:echo*,echo*.cecho\*,echo\\\\^,~#manbash#ls–l|grep‘^d’UNIX3.1/dev/fd0/dev/hdb2(major,minor)-devicedriver/dev/null#ls/dev/null:;#cat/dev/nullempty:majorminor1(-)2(l)lnsabcxyz/usr/bin,/bin#lsl:b,c,-,l3.2(filesystem,FS)windows#mount–tvfat/dev/hda1/mnt/wincc:,d:a:/,/etc,/boot,/home1UNIX2LinuxVFSext2,vfat,hpfs,nfs,sysv,proc,ufs,ntfs,devfs,ext3mount3.3UNIX1(bootblock)2(superblock):3index-nodetable:inode(filecontrolblock)1inode2inode,inode34(datablock):inode3.4(ACL,accesscontrollist)11(user):2(group):3(other):21(read)(write)(execute)2$cd/home/zhang/tmp:/home/zhang/tmp38#chmod777myfile:#chmod755myfile:lsl:3(setuid)1)(x)s2#lsl/usr/bin/passwd-r-sx--x1rootroot13536Jul122000/usr/bin/passwd#lsl/etc/passwd-rw-rr--1rootroot841May1208:20/etc/passwd#chmodu-s/usr/bin/passwd:suid#passwd3.51:linux717a-g/dev/hda1:11/dev/hda2:12/dev/hda3:13/dev/hda4:14/dev/hda5:11/dev/hda6:12/dev/hda7:132#mkfstfstypedevicesize31mountrtiso9660/dev/cdrom/mnt/cdrom#cd/mnt/cdrom#ls#mounttvfat/dev/hda1/mnt/windowsfat322*/etc/filesystem,**/etc/mnttab3#umount/dev/cdrom#mount/dev/fd0/mnt/floppy#eject412#fsck/dev/hdb1:3/etc/fstab5vied,wc,grepdifffilespellcut,pastetrcrypt,rmpwd,cd,mkdir,rmdir,ls,find,df,du,fsck,more,cat,dd,tar,bar,dump#rmr*shell4.1shell1shellShellshell#$bsh,ksh%csh2shell/etc/passwdcsh:BSDUNIX,,.cshrc,.loginbsh:AT&TUNIX,.profileksh:SYSVUNIX,.profilelinuxbash:.bash_profile,/etc/profile,.bashrc,/etc/bashrccsh:/etc/csh.login,/etc/csh.cshrc3shell42shell1shell*:?:[]:#lsfile[1-28].c\:printf(“\\\\”)‘’“”#echo“$PATH”``#count=`expr4\/3`#echo$count12##ls–l|grep‘^ddd$‘cd~/tmp#manbash2shell$?:$$:$!:$#:shell$13#varname=value:#readonlyvarname#exportvarname#setenvPATH=/home:/usr:/etc:/bin:/usr/bin:(csh)#varname=`expr$varname+1`1x=$[$x+1]#echo$PATH41)testtest–d/usr[-d/usr]test–f.bashrc[-f.bashrc]test$count–gt0[$count–gt0]2ifif(expression)thencommand-listelsecommand-listfi3)casecase$varinpattern1)command-list;;pattern2)command-list;;…esac4)&&||#test–fmyfile.c&&echo“filefound”iftest–fmyfile.cthenecho“filefound”fi#test–fmyfile.c||echo“filenotfound”iftest!–fmyfile.cthenecho“filenotfound”fi51forforvarinword-list//forjin*forjdocommand-listdone2)whilewhile(expression)docommand-listdonegreeting=’helloworld’i=1whiletest$i–le100docase$iin*0)echo“**********”file$i;;*)echo$ifile$i;;esaci=`expr$i+1`doneappendcase$#in1)cat$1;;2)cat$1$2;;*)echo‘usage:append[from]to’;;esac#appendfile16functionname(){command-list}usage(){echo“usage:…..$1”}usagea7here#mailcindy!@$happybirthdayIloveyou!@$8shell1)eval:shellA=lsB=‘|wc-w’eval$A$B2)exec:execgoto#catexecdemoexecdateechohello3)read#catparrotecho“yousay:\c”readwhatecho“Irepeat:$what”4)shift:$#1#catshiftdemowhiletest$#!=0do

1 / 26
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功