




下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、實驗一一 Linux常用命令、Shell編程班級:網絡14-2 學號姓名:一、實驗目的掌握Linux常用命令的用法;(2)掌握Shell的簡單編程。二、實驗內容1.完成下列命令的使用,并給出使用示例。林浩強成績:sudo文件(F)城龜(E)杳看(V)搜秦(習線端m fflShfH) rflotyj-virtual-machine:» suda sj yjyj-virtual-machine:/roots |fdisk -l畫。 - "29 A訪客曲m亠斗1S31 A訪容誓yj-1rootyj-virtual-nachvne:"# sudo
2、 su yiyjvirtual-machine:/roots fdisk yj(3yj virtual-machine: /rocjt$ sudo su sudo password for yj:rootgyj-virtual-nachtne:-# fdtsk -XDisk /dev/sda: S3,7 GB, 53587091206 bytes2SS heads 63 sectors/track, 6S27 cylinders, total 194357600 sectors units =扇區 of 1 * 512 = 512 bytesSector sl.ze CXogtcal/phys
3、twT):1/0 size (nlninun/optinaT):Disk Identifier;S12512 byt« / 512 bytes bytes /512 bytesGxaao6e3S9設備啟動/dev/sdai/tlev/sda2/dev/sdaS/dev/sdab起點 2日48 S5S27S7e 05327872 9177Z928終占-M PR hlS53Z5S23 104SSSS5191770079 1043SSS51塊數 Id4Z661838 9763841 3221504 6S41312系統S35擴展02 Linux 交換 / SoVari83LinuxnsLin
4、uxrootflyj'virtual'nachtne:-#mount(將一個U盤掛載到系統)Terminal File Edit View Search Terminal Help Device /dev/sdal /dev/sdaz /dev/sdaSBootStart2 &4馥 3984733 35847536End 39&4S837 41946991 41946991Sectors 3984384020930582093OSeSize15C 1盹2M 1922HIdS3532TypeLinuxExtendedLtnuK p / Solaris15 ClB,
5、 lGe37?6992Obytes512 bytes / 512 bytes bytes / 512 byteaDisk /dev/sdb:Units: sectorsSector size (logical/physlcal):I/O size (ninlmun/optinal.); 512 ctskiabel type: dosDisk Identifier: 0x24fld24acof 1 * 512 = 512bytes, 31324169 sectorsDevice Boot StartEnd/dev/Sdbl *784384 313Z4159root(jbuntu:/hone/mi
6、ke# nkdtr usb roQtubuntu:/hane/nike# IsDesktQpDownloadsMusicDocunents examples.deskto rootubuntu:/hone/nlke# * root電ubuntu:/horie/mlke# IsDesktopDownloadsDocunents examples.desktop rootubuntu:/hone/nike# IsDesktopDownloadsDociuinents exai*)ples. desktopI' roQtubuntu:/hane/nike# cd usbrootubuntiK
7、/hopie/nlke/usb# IsI Sectors Size Id Type3053977* 14.6G 7 HPFS/NTFS/exFATPractice Tenplat«s ;top Ptctures Public testl.shtextl.txtU£bvideosHustc PicturesMusic PicturesPractice PublicPractice PublicTenplates testl.shTenplates testl.shtextl.txtVideosvideostouchrootubuntu:/hane/nike/usb#選課系域設
8、計報告文杵(F)編輯舊 e看沖)擺索弊薦幫助(H)fileroot(yj-vrrtual-machine:-rootyj*vlrtuaV-nachine:-# pwd/rootrootyj-vlrtual-nachlne:touch test,txt raotyj-vlrtual-nachlne:Lscore r益共的桓馥觀頻圖片文檔rootyj-vlrtual-nachine:|TS音樂桌血rootfWypvirtual-machine: <15:41 A 訪W -flrootgy-virtual-piachtne:-# pwd /root rootyj*vlrtual-piachln
9、e:Is core test* txt 公共的 模板 決頻Ben 文檔 rootgy - virtual-nachtne:-# file twst + St test.txt: emptyrootyj-virtual -niachlne: '#下載音樂桌面CP+1S:42 AiSgsI BIm已c rootvlrtuakmachtne:/ rootgyj - virtual-piachtre:fl pwd /root rootyi- virtual-piachire:-# Is core rootyj -virtual -piachire:-# test.txt: empty root
10、yj -virtual -piachire:-# root前yj-virtual-machine:-# rootyj-virtual. -piachlre: /# bln boot cdron dev rootyj- virtual-piachire:/# file test.txt test.txt: empty rootyj-vlrtual-piachire: /# |test.txt 公共的模扳觀a圈片 file test.txt文檔TS音樂桌帀畐團B圜rmcpcdIstest.txtetclibhonellb52Inltrd Angllb64Inltrd Ang.old lost+fo
11、undnedla nnt opt procrootrun sbln sellnuxsrv sys sasusrvar vnltnuz vnllnuz *old文件(F塢軻(日S看沖)搜索|端(1)嵇®(拘彖壬 ro01Cyj-virtual-machene: / rooty - virtual - (machine:-# Is core test.txt扯共的模板視麺圖片 rootyj-virtual -machinetouch move rootyj-virtual-nachlne:Is core nove test *txt 共的 rooty - virtual - (machi
12、ne mv rootv-virtual-machineIIs core test.txt 公# 商 rootyj * virtual-nachine;-# cd rootyj-virtual-nachtne:/# Is bin boot cd ron dev_rootyj-virtufll-nachine:/# |15:S A訪客文檔音樂桌面繽板move視頻ffl片文檔音樂桌面視如圖片文檔Tfl音樂桌面etclibhoje111132Inttrd.Ingltb64Inttrd Ang .old lost+found文件(F)編輯(日 查看w)權黨:按端m O蘑 rootyj-vtrtuaI-m
13、achine; / rootyj-virtual-nachine:/# Is bin boot cd ron devetclibhoneltb32Inltrd Anglib64tnltrd*Ing *old lost+foundrootyj-virtual-nachine:/# rn rootyj-virtual-nachine:/# Is bln boot cd ron devnedla nntoptnedla nnt nove opttest.txtetcItbhon«Itb52tnttrd Angltb64inttrd *Ing * old lost+foundroot 電yj
14、 vii'tual-nathine: /#proc rootrun sbtnprocrootrun sbinsellnuK srv systest.txtS3!usrvar vnllnuzvnitnuz rolfjB S3 V 十 15:46 A 訪客seltnux srv sys test.txtusrvar vnllnuzvnllnuz.oldnedia nnt nove optproc rootrun sbtnselinux srvusrvar vnllnuz vnllnuz.oldmkdirOG rootyJ-vIrtuaUmachlne: rootgyj-virtual-ma
15、chine: fit cd /root rootyj-virtual-machine:-# Is core test.txt 公共的模板視頻圖片文檔 rootgy 3 - virtual - machine: -ft mkdir qqhb rooteyj-virtual-machine:-# Iscore fniE test.txt 公ft 的模板 SS ffl 片 rootgy J virtual -piachtne: r#文檔rmdiriSSbJ上文件(F)編輯(日SWV)搜露(S)終運CO幫助(H)護亠亠 roQt(y-virtuaLmachine: * rootyj-virtual-P
16、lachtne:-# Is core qqhb test.txt公拄的模坂視類 rooteyj vtrtuaL-Piachtne:-# cd qqhb rootgyj-vtrtuaL-machine:/qqhb# Is hb qq rootgyj-vtrtuaL-machine:/qqhb# cd rooteyj-vtrtuaL-Piachtne:-# rn -tr qqhb rn:是否進人目錄"qqhb"? y rn:是否刪除目親"qqhb/hb" ? y rn:是否S傑普通空支件"qqhb/qq"? y rn:是否刪除目錄&quo
17、t;qqhb"? y rootevj-vtrtuL-nachtne:Is core test.txt公共的橡遲空上片 rooteyj-vtrtuV-nachtne:QSISHWI rootyj- virtual.nachtne:Is core hbqq test* txt公共的樓皈W頻 rootyj'vtrtuL-nachtne:ff r(*idl hbqq rooteyj'Virtual'Piachtne:ff Is core test.txt公共的模板覆頻圖片 rootyj'Virtual'tiachtne:ff |ffl片catchmod
18、rm:文檔00片文檔文杵編輯(曰査石WJ挨宛is(T)幫叭HJ鞋 4 宀 rootyj-virtual-machine: « rootyj-vlrtoal.-PiachtDe:# l£ core testaxt公共的模板視«圖片 rootyj-vlrtuaX-nachtrte:ff vt test*txt rootgyj-virtualnachlne:ff cat test.This Is a test file to use the connand SS root鹽j*virtualmachine:ff文檔音樂桌面下a音樂桌面15:54 A訪客外文檔T«
19、;文檔THTfi音樂桌面音樂桌面TSS音樂桌面音樂桌面下S音樂桌面rootubuntu; /home/mike/practkerootubuntu:/hone/ntke/practlce# Istestl.sh testz.sh te&t3.sh test4.sh testgedlt* txt testvV * txt rootubuntd/hone/ntke/practtee# Is -1 testl,shWX'1 root root 217 Nov 1 07:15 testlsh rootubuntu:/hone/ntke/practice# chnod +r testl.
20、sh rootubuntui/hone/mike/practice# Is -T testl.sh -rwxr-xr-x 1 root root 217 Nov 1 07:15 testl.sh rootubuntu;/home/mike/practice# |In(并說明軟硬鏈接的區別)A訪客4096 13月 28drwxr-xr-x 2 root rootrootV3-virtual.-machine:In test.txt1:51桌面tlnkfj*virtual-nachlne:# Is *128216-rw Irwxrwxrwx -rw-r-r-rw-r- -r- drwxr-xr-x
21、 drwxr-xr-x drwxr-xr-x drwxr-Kr-x drwxr-xr-x clrwxr*xr-x drwxr-xr-x drwxr-xr-x222Z z z2222root root root root root root root root root root root rootroot root root root root root root root r oot root root rootZS352224845454096409640964090 4&9640964G964096前月L洞"月茁月1月 I月 L月10月 1月 1月1月 13月Z8282
22、8JS S5528S5S zs15:31ie:071S:5615:56201520152015 15:ZS201520152015 14:51erQct X 就的-A test.txtrootgyj-virtual-machine:-# 總用B 28216 10456&2 1040794 1043795 104379S 1048599 1048sse 1040603 1048602 1O406OC 1048597 14801 1043596-rwIrwxrwxrwx-w- -”- drviKr-Kr-x drwxr-xr-x drwxr-xr-x drwxr-xr-x drwxr-xr
23、-x drwxr'xr”x drvixr -xr -M drwxr-xr-x112222222222root root root root root root root root root root root rootIs -Ilroot root root root root root root root root root root root2835222484S45 4096 4696 4096 4096 4096 4096 49& 4096月月月月月月月月月月月月1111 1 12S2923Z95552a5552B15:3116:0715156 is:se2015201
24、52015 15:26ZGIS20152015 14:51*> test.txtrootfiyi*virtual-nachlne:#tar(壓縮、解壓)文件舊編輯(日搜索集輪 rootyj-virtual-nachine:Is _ corellnkftlez公共的視頻Itnkfllel test.txt 樓板 圖片 rootgyj-virtual-nachine:tar -cf rooty-virtual-machine:Is coreXinkfile2 test.txtItnkfilel公共的rootyi*vlrtual-nachlre:tarrooty-virtual-machine
25、:tar -rw-r-r- root/root45Icwxrwxrwx root/root9hrw-r-r root/root3rootflyjvirtual-nachtne:IIS文檔 下載 tarfllel* tar-tgrepIM ® Q斗16:21 i訪盲test.tut link代lei llnkflleZ闕魏p桌面tarfiTel,tar-tvf tarfilel.tar 016-10-28 zoie-io-2a 2016-10 23test.txt15:5616107 Hrkftlei -> testtxt15:56 LipkfiLe2 連接到 test.txtT
26、erminaL File Edit View Search Terminal Help片宀 r roocubuntu: /rootubuntu:/fl cat /etc/passwd | grep 亠ntke:x:iaoo: ia0G:MikesUbuntu,*: /hone/nlke: /t>lp/bash rootubuntu:grep nike /etc/passwd:X:1000:190O:Mtke5Ubuntu J,:/hone/ :/bin/bash rootubuntuj/fl |tf 41) 0&:53findTermtn? Terminal Fite Edit
27、Vitw Search Terminal Help © * r roocubuntu: /home/mike roQtubuntu:/hane/mike# IsDesktop Downloads Docuncnts exapiples. desktop roatubuntu:/hane/mlke# find -rwKr*xr-x 1 root root 47 MovE F rootubuntu:/hone/nlke# find textl*txt 阿曲(textlntxt rootubuntu:/hane/mlke# |KjKMusicPractlce TenplatesPictur
28、es Publit-nane ”*.如"-exec Is -1 1 06:25 testl.shtwstl.shtextl.txt Videos06:3e2.使用vi和gedit文本編輯器分別編輯一段文字。vi06:54Termini lerminaL File Edit View Search Terminal HelpE ' rootubuntu: /home/mikeffThls ts a text file to make a example of command "vt"06:55Termtn?' Terminal Fik Edit Vi
29、ew Search Terminal Help對I雷 © o rootcubuntu: /hcme/mikerootubuntu:/hone/mlke# vl testvi*txt rootgubuntu:/hone/i*ilke# cat testvi.*txtWSThls ts a text file to make a example of connand "vt rootubuntu:/hone/mike# |geditt> $ 則 oe:s7 進* testgedlt.txtopensavePlain Text Tab Width: eLn IpColSSI
30、NSITerm Ire Terminal File Edit View Search Terminal HelproQtubuntu: /home/mike_ rootLbuntu:/hone/nlke# gedit testgedlt*txt* (gedlt:3776): WARNING *: Set document metadata failed: Setting attribute net ;:gedlt-position not supportedrootubuntu:/hone/ntke# IsDesktopDownloads rootubuntu;/hone/mlke# #Thl
31、s Is a text file to root電ubuntu:/hone/nlkewexanpl.es. desktop Pr acttce MusicPicturestestl, shtestgedtt * txt videos Templates testVt.tXtfake a example of command "gedit"Public3.編寫shell腳本,將變量 X的值設置為100,并分別輸出X的值和“ $X=X的值”,即X=100$X=100Termfns Terminal File Ed讓 View Search Terminal Helpti * 4
32、1) 07:04 O呂 勺 roocubuntu; /home/mike Dot電ubuntu:/hone/ntkeM roQtubuntu:/hone/nvke# tfgive the var k a value X=100 echo 5x echo '5X=iee" rootubuntu:/hone/ntke# 190 109=100 roQtaubuntu:/hone/mtkeflvtn test2.sh cat test2,sh and echo./test2,sh4.編寫一個Shell程序,程序名為testl,打印出Shell命令行參數中的位置參數及預定義變 量$0
33、、$、$#、$*、$的值。Terminal夠A A#echo theroot4Wubuntu: /home/mikesrgunentsecho H: echoecho echo echo"The"The"There are totally $# praneters p點fwfcith;,2 t:a- ""The paraneter are S*""The prcocess id of this Progran Im SS"Pogr目E nane Is SG" paraneters areTermini T
34、erminal File Edit View Search Terminal Helptl * 初)07:16 <IwgEKW軽AO rootubuntu;/home/mike rootubuptu:/hopie/nlke# vin testl.sh rootubuntu:/hone/nlke# cat testl.sh 禪etho theargumentsecho echo echo echo echo''The'The"There are totally $# parameters passed to this program" "
35、;The paraneters are $*""The prcocess ID of this Program ts SS"Progran nane is parspieters arerootubuntu:/hone/ntke#The Program name ts ,/testl.shThe parameters ere 1 2 3 4 5 打There are totally 6 parameters passed to this programThe parameters are 123456The prcocess 10 of this Program
36、Is 3929 rootubuntu:/hone/nlke#5.編寫一個名為test2的簡單刪除程序,使用命令參數來傳遞要刪除的文件,如命令行輸 入:./test2 a.txt,刪除 a.txt。Termini TerminalFile Edit View Search Terminal Helpti £ 如 07:22deleterootiubuntu: /home/mike the file you inputIf ”f then rn -t Si elseecho "i,hdL u fi$1 ; :i now ; cOF再亡,ft-J-fc$q 2 2 n F f B
37、 s *僅 一 ETermlnti Terminal File Edit View Search Terminal Help07:24 £OOE roottpubuntu:/hDm«/mfkerooteubuntui/hopie/ntke# vtnrooteubuntuI/hone/nike# IsexamplesdesktopMusicPicturesDesktop Docunents Downloads rootubuntu:/hone/nike#rootubuntu:/hone/nike# rooDesktop oocuntnts Downloadstest3*shPractice Public Templates touch ftlel.txttetZ, te5t3* shtestqedtttxt testvt* txt usbVideost電ubuntu:/hone/nike# examples.desktop filei.txt nustcchnod +x testm.sh IsPicturesPractice testl.sh Pu
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 妊娠合并貧血護理
- 項目建造成本管理培訓
- 腹脹診斷流程
- 小班雨水節氣主題活動方案
- 顏色有趣游戲課件
- 健康教育學會感恩
- 精神科護理匯報
- 構成與設計核心要素
- 2025年水泥熟料及水泥項目提案報告
- 2025年教學專用儀器項目立項申請報告
- 9日益重要的國際組織(第3課時) 教學設計-六年級下冊道德與法治
- 浙江省慈溪市2024年小升初語文真題試卷及答案
- 2023年上海高中學業水平合格性考試歷史試卷真題(含答案詳解)
- 2024-2030年中國商品混凝土行業市場發展分析及發展趨勢與投資發展前景研究報告
- CJJT259-2016 城鎮燃氣自動化系統技術規范
- 病案首頁填寫及質控要求
- 18 設計緊急避難路線圖(教案)人美版(北京)(2012)美術三年級下冊
- 園林綠化移樹合同
- 排球大單元計劃教學設計-高一上學期體育與健康人教版
- 玻璃粉燒工藝
- 云計算和邊緣計算在工業互聯網中的融合
評論
0/150
提交評論