Linux常用命令_第1頁(yè)
Linux常用命令_第2頁(yè)
Linux常用命令_第3頁(yè)
Linux常用命令_第4頁(yè)
Linux常用命令_第5頁(yè)
已閱讀5頁(yè),還剩68頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、鄭義全/Jack大綱 Linux基本指令介紹 Linux文件系統(tǒng)管理 Linux常見的配置文件 Linux的網(wǎng)絡(luò)設(shè)定 Linux使用者與群組設(shè)定 Linux文件傳輸應(yīng)用 Linux壓縮應(yīng)用 VI工具的使用3Linux基本指令介紹44whatis、whereis、man、info、help指令:man、info、helpQ請(qǐng)問當(dāng)你不知道route指令有哪些用法時(shí)可以怎么查詢?Aman route、info route、route -helprootccmail root#man routerootccmail root#info routerootccmail root#route -help5

2、5whatis、whereis、man、info、help指令:whereisQ請(qǐng)搜尋route聯(lián)機(jī)幫助文件的存放目錄。Awhereis routerootccmail root#whereis route66whatis、whereis、man、info、help指令:locateQ透過已建立的搜尋數(shù)據(jù)庫(kù)尋找檔案,要下哪一指令?Alocaterootccmail root#locate77Management Partition指令:partprobeQ分割完硬盤后,如果你不想重開機(jī)生效,可下哪一個(gè)指令來(lái)立即生效?Apartproberootccmail root#fdisk l /dev/

3、hda88Management Partition指令:mkfsQ假設(shè)你建立一個(gè)扇區(qū)為 /dev/hda5,如何格式化為ext3格式?Amkfs t ext3 /dev/hda5rootccmail root#mkfs t ext3 /dev/hda599Management Partition指令:e2fsckQ請(qǐng)使用唯獨(dú)的方式檢查你剛才建立的 /dev/hda5(ext3) 是否有壞軌?Ae2fsck c j ext3 /dev/hda5補(bǔ)充:不要對(duì)已經(jīng)掛載的文件系統(tǒng)執(zhí)行fsckrootccmail root#e2fsck c j ext3 /dev/hda51010Management

4、Partition指令:e2fsckQ請(qǐng)檢驗(yàn)?zāi)銊偛沤⒌?/dev/hda5是否正常,如果有異常便自動(dòng)修復(fù),并且設(shè)定若有問答,均回答是?A(1)e2fsck a y /dev/hda5 (2)e2fsck a y ext3 /dev/hda5rootccmail root#e2fsck a y /dev/hda5rootccmail root#e2fsck a y ext3 /dev/hda51111Management Partition指令:mkswapQ假設(shè)你有一個(gè)partition為 /dev/hda6,id為82,請(qǐng)把它格式化為swap?Amkswap /dev/hda6rootcc

5、mail root#mkswap /dev/hda61212Management Partition指令:mountQ將 ext3 格式的/dev/hda5 ,掛載到 /mnt/test目錄?Amount t ext3 /dev/hda5 /mnt/testrootccmail root#mount t ext3 /dev/hda5 /mnt/test1313Management Partition指令:umountQ將 /mnt/test 卸除?Aumount /mnt/testrootccmail root#umount /mnt/test1414 Process and System R

6、esource指令:psQ請(qǐng)列出目前所有正在內(nèi)存當(dāng)中的完整程序,含用戶相關(guān)的process(包含內(nèi)存、CPU使用量、指令名稱、狀態(tài)等)?Aps -auxrootccmail root#ps aux1515 Process and System Resource指令:killQ請(qǐng)強(qiáng)制刪除 PID 為1433 的程序?Akill -9 1433rootccmail root#kill -9 14331616 Process and System Resource指令:killallQ如果 httpd 的服務(wù)無(wú)法正常關(guān)閉,請(qǐng)強(qiáng)制刪除所有以 http 啟動(dòng)的程序?Akillall -9 httpdro

7、otccmail root#killall -9 httpd1717 Process and System Resource指令:pstreeQ用樹狀結(jié)構(gòu)列出目前系統(tǒng)執(zhí)行序,并同時(shí)秀出 PID 與 Process 的執(zhí)行身份?Apstree uprootccmail root#pstree up1818 Process and System Resource指令:topQ如何動(dòng)態(tài)地觀察系統(tǒng)的 cpu、memory 的資源狀況,以及各項(xiàng)程序的運(yùn)作情形?Atoprootccmail root#top1919 Process and System Resource指令:freeQ顯示目前系統(tǒng)的內(nèi)存容

8、量,并且以 MB 顯示?Afree -mrootccmail root#free -m2020 Process and System Resource指令:dmesgQ如何秀出所有的核心開機(jī)時(shí)的信息?Admesgrootccmail root#dmesg2121 Process and System Resource指令:dmesgQ如何秀出所有的核心開機(jī)時(shí)的信息?Admesgrootccmail root#dmesg22Linux文件系統(tǒng)管理2323Flilesystem Table指令:fstabQ請(qǐng)問設(shè)定分割區(qū)與目錄掛載點(diǎn)關(guān)系的檔案為何?及其絕對(duì)路徑?Afstab。/etc/fstabr

9、ootccmail root#fstab2424Management Partition指令:dfQ將系統(tǒng)內(nèi)所有的 partition 列出來(lái),并且自動(dòng)以Kbytes、Mbytes 顯示?Adf -hrootccmail root#df -h2525Management Partition指令:fdiskQ請(qǐng)查閱你的linux主機(jī)的第一顆硬盤內(nèi),所有分割區(qū)的信息,如分割區(qū)大小、分割區(qū)型態(tài)?Afdisk -l /dev/hdarootccmail root#fdisk l /dev/hdaDisk /dev/hda: 8589 MB, 8589934592 bytes15 heads, 63 s

10、ectors/track, 17753 cylindersUnits = cylinders of 945 * 512 = 483840 bytes Device Boot Start End Blocks Id System/dev/hda1 * 1 217 102501 83 Linux/dev/hda2 218 17753 8285760 5 Extended/dev/hda5 218 4654 2096451 82 Linux swap/dev/hda6 4655 8989 2048256 83 Linux/dev/hda7 8990 12240 1536066 83 Linux/de

11、v/hda8 12241 14408 1024348+ 83 Linux/dev/hda9 14409 17753 1580481 83 Linux26Linux常見的配置文件2727開機(jī)相關(guān)配置文件Q請(qǐng)問一下本公司產(chǎn)品所使用的多重引導(dǎo)程序?yàn)楹?及其配置文件位置?ABoot Loader為L(zhǎng)ILOB/etc/lilo.conf2828開機(jī)相關(guān)配置文件Q請(qǐng)問一下init 0至init 6的設(shè)定,是在哪個(gè)配置文件中做定義?并指出這六個(gè)runlevel各代表什么服務(wù)?A/etc/inittabB#0 halt關(guān)機(jī)或停機(jī)#1 single user mode,單人模式#2 Multi-user mod

12、e,without NFS#3 Full multi-user mode#4 unused(系統(tǒng)保留功能,沒有用到)#5 X11(使用X window圖形接口)#6 reboot2929account and group configuration fileQ請(qǐng)問一下Linux中何配置文件可設(shè)定使用者的login shell、home dir?A/etc/passwd3030account and group configuration fileQ請(qǐng)問Linux中哪一配置文件紀(jì)錄了user加密后的密碼及密碼期限?A/etc/shadow3131account and group configu

13、ration fileQ請(qǐng)問group 其所包含的member是紀(jì)錄在哪個(gè)配置文件中?A/etc/group3232account and group configuration fileQ請(qǐng)問root跟新增使用者h(yuǎn)giga默認(rèn)的家目錄位置各為何?Aroots home directory/hgigas home directory/home/hgiga 3333account and group configuration fileQ請(qǐng)問哪個(gè)檔案建立出來(lái),即可限制non-root使用者登入Linux系統(tǒng),但對(duì) root 管理者是沒有效果的?A/etc/nologin3434Network C

14、onfiguration FileQ請(qǐng)問網(wǎng)絡(luò)接口如ifcfg-eth0的配置文件放在哪一目錄下?A/etc/sysconfig/network-scripts/3535Network Configuration FileQ請(qǐng)問全局的默認(rèn)網(wǎng)關(guān)要在哪設(shè)定?A/etc/sysconfig/network3636Network Configuration FileQ請(qǐng)問全局的靜態(tài)路由設(shè)定,要在哪里設(shè)定?A/etc/sysconfig/static-routes可在/etc/rc.d/init.d/network找出來(lái)37Linux的網(wǎng)絡(luò)設(shè)定Anaging Account and Group3838指令

15、:ifconfigQ請(qǐng)使用 ifconfig 命令增加暫時(shí)一個(gè)虛擬網(wǎng)絡(luò)接口 eth0:1,IP:00/24。AIfconfig eth0:1 00 netmask rootccmail root#ifconfig eth0:1 00 netmask Anaging Account and Group3939指令:ifupQ請(qǐng)單獨(dú)啟動(dòng)網(wǎng)絡(luò)接口 eth0。Aifup eth0rootccmail root#ifup eth0Anaging Account and Group4040

16、指令:ifdownQ請(qǐng)單獨(dú)停用網(wǎng)絡(luò)接口 eth0。A(1)ifdown eth0 (2)ifconfig eth0 uprootccmail root#ifdown eth0rootccmail root#ifconfig eth0 upAnaging Account and Group4141指令:route addQ請(qǐng)暫時(shí)增加預(yù)設(shè)路由 。Aroute add default gw rootccmail root#route add default gw Anaging Account and Group4242指令:rout

17、e addQ假設(shè)有一臺(tái) Linux 主機(jī),其eth0 的網(wǎng)段為 /24,那要如何設(shè)定才能使該臺(tái)機(jī)器暫時(shí)能連到位于內(nèi)部Router (IP 53)后的A主機(jī) (IP 0)。Aroute add -host 0 gw 53 dev eth0rootccmail root#route add -host 0 gw 53 dev eth0Anaging Account and Group4343指令:route addQ假設(shè)有一臺(tái) Linux 主機(jī),其eth1 的網(wǎng)段

18、為 /24,那要如何設(shè)定才能使該臺(tái)機(jī)器暫時(shí)能連到位于內(nèi)部Router (IP 52)后的網(wǎng)段/24。Aadd -net netmask gw 52 dev eth1rootccmail root#route add -net netmask gw 52 dev eth1Anaging Account and Group4444指令:route delQ請(qǐng)暫時(shí)刪除一筆路由 192.168.0

19、.0/24,界面為eth0。Aroute add default gw rootccmail root#route add default gw Anaging Account and Group4545指令:route n & route -rnQ請(qǐng)問哪兩個(gè)指令可秀出路由表,并且用IP顯示。A(1)route n (2)route -rnrootccmail root#route nrootccmail root#route rnAnaging Account and Group4646指令:arpQ想查詢區(qū)網(wǎng)內(nèi)其它臺(tái)計(jì)算機(jī)聯(lián)機(jī)至本機(jī)的網(wǎng)卡

20、硬件信息,可用何命令 (請(qǐng)以IP顯示)。Aarp -anrootccmail root#arp -anAnaging Account and Group4747指令:arpingQ如果想要使用ARP REQUEST方式查詢相鄰網(wǎng)段內(nèi)主機(jī)是否正運(yùn)作,可用何指令。Aarp ing rootccmail root#arping Anaging Account and Group4848指令:pingQ如何透過eth1-line這條線路去偵測(cè)外部 這部 DNS 主機(jī)是否存在。(請(qǐng)以IP顯示結(jié)果)。Aping n I

21、 eth1 rootccmail root#ping n I eth1 Anaging Account and Group4949指令:tracerouteQ查詢經(jīng)過的路由節(jié)點(diǎn),并且不解析主機(jī)名。Atraceroute n rootccmail root#traceroute n Anaging Account and Group5050指令:netstat -nQ請(qǐng)問要查詢目前的系統(tǒng)應(yīng)用程序針對(duì)TCP/ UDP聆聽port狀態(tài),并以IP方式顯示相關(guān)數(shù)據(jù),要下何指令?Anetstat n-t:僅列出 TCP 封包的聯(lián)機(jī);-u:僅列出 UDP 封包的聯(lián)機(jī);

22、-p:列出 PID 與 Program 的檔名;-a:列出所有的聯(lián)機(jī)狀態(tài),包括 tcp/udp/unix socket 等;-n:不使用主機(jī)名與服務(wù)名稱,使用 IP 與 port numberrootccmail root#netstat -n51Linux使用者與群組設(shè)定Anaging Account and Group5252指令:useraddQ請(qǐng)?jiān)谥鳈C(jī)上增加一名用戶賬號(hào) “test”,并且指定UID為700。Auseradd -u 700 testrootccmail root#useradd -u 700 testAnaging Account and Group5353rootcc

23、mail root#usermod -d /home/test2 -m test指令:usermodQ使用usermod讓使用者test,更改其家目錄為test2Ausermod -d /home/test2 -m testAnaging Account and Group5454rootccmail root#passwd testNew UNIX password: (輸入密碼)Retype new UNIX password: (輸入密碼)passwd: all authentication tokens updated successfully (密碼變更成功)指令:passwdQ請(qǐng)問

24、如何修改test密碼?Apasswd test5555Anaging Account and Group指令:userdelQ請(qǐng)刪除使用者test,并且一并刪除其家目錄?Auserdel -r testrootccmail root#userdel r test5656Anaging Account and Group指令:groupaddQ請(qǐng)?jiān)黾右粋€(gè)群組名為hgiga,并指定 gid 為800?Agroupadd g 800 hgigarootccmail root#groupadd g 800 hgiga5757Anaging Account and Group指令:groupmodQ請(qǐng)修

25、改群組 hgiga gid 為 850 ,并且更名為hgiga02?Agroupmod g 850 n hgiga02 hgigarootccmail root#groupmod g 850 n hgiga02 hgiga5858Anaging Account and Group指令:groupdelQ請(qǐng)刪除群組 hgiga02。Agroupdel hgiga02rootccmail root#groupdel hgiga025959Anaging Account and Group指令:groupsQ請(qǐng)列出賬號(hào) test 當(dāng)前有效的群組。Agroups testrootccmail root

26、#groups test60Linux文件傳輸應(yīng)用6161sync指令:syncQ為了加快數(shù)據(jù)的讀取速度,默認(rèn)的情況中,某些數(shù)據(jù)將不會(huì)直接被寫入硬盤,而是先暫存在內(nèi)存當(dāng)中,哪個(gè)指令是將這些內(nèi)存里的數(shù)據(jù)寫入硬盤中?Asyncrootccmail root#sync6262遠(yuǎn)程聯(lián)機(jī)及下載文件指令:sshQ當(dāng)你已聯(lián)機(jī)在linux本機(jī)的文字管理接口,想用安全聯(lián)機(jī)連到3時(shí)要如何做?Asshrootccmail root#ssh 36363遠(yuǎn)程聯(lián)機(jī)及下載文件指令:scpQ請(qǐng)利用ssh傳輸檔案 /etc/passwd 至遠(yuǎn)程計(jì)算機(jī) /root底下, 并將遠(yuǎn)程計(jì)算機(jī)

27、的/etc/passwd傳到本機(jī)底下? 遠(yuǎn)程:3。Ascp /etc/passwd root3:/root 傳輸檔案至遠(yuǎn)程計(jì)算機(jī)Bscp root3:/etc/passwd /root 遠(yuǎn)程計(jì)算機(jī)傳到本機(jī)底下rootccmail root#scp /etc/passwd root3:/rootrootccmail root#scp root3:/root /etc/passwd6464遠(yuǎn)程聯(lián)機(jī)及下載文件指令:ncftpQ請(qǐng)使用ncftp連至公司FTP 主機(jī),并切換到rpm目錄下,下載 iSherlock-useradmin-1.5-13.i386.rpm?以賬號(hào)dluser,密碼dluser登入。Ancftp u test p test rootccmail root#ncftp u test p test 6565遠(yuǎn)程聯(lián)機(jī)及下載文件指令:telnet Q請(qǐng)問要測(cè)試機(jī)器的TCP

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論