Linux基礎(chǔ)知識(shí)培訓(xùn).ppt_第1頁
Linux基礎(chǔ)知識(shí)培訓(xùn).ppt_第2頁
Linux基礎(chǔ)知識(shí)培訓(xùn).ppt_第3頁
Linux基礎(chǔ)知識(shí)培訓(xùn).ppt_第4頁
Linux基礎(chǔ)知識(shí)培訓(xùn).ppt_第5頁
已閱讀5頁,還剩45頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

Linux基礎(chǔ)知識(shí)培訓(xùn) 周建輝2017 09 22 2 本文檔的目的 通過本次培訓(xùn) 對(duì)Linux操作系統(tǒng)有一個(gè)初步的了解 掌握Linux操作系統(tǒng)的相關(guān)基礎(chǔ)知識(shí)及一些常用的命令 并對(duì)系統(tǒng)進(jìn)行日常的維護(hù) 3 課程目標(biāo) Linux系統(tǒng)介紹Linux主要系統(tǒng)分區(qū)文件系統(tǒng)管理文件類型文件結(jié)構(gòu)文件目錄權(quán)限常用的Linux命令VI編輯器的使用用戶和組的管理網(wǎng)絡(luò)管理登錄Linux系統(tǒng)的常用工具Linux系統(tǒng)性能監(jiān)控工具介紹 4 Linux系統(tǒng)介紹 Linux是一套免費(fèi)使用和自由傳播的類Unix操作系統(tǒng) 是一個(gè)多用戶 多任務(wù) 多線程 多CPU的操作系統(tǒng) 它能運(yùn)行主要的UNIX工具軟件 應(yīng)用程序和網(wǎng)絡(luò)協(xié)議 它支持32位和64位硬件 Linux繼承了Unix以網(wǎng)絡(luò)為核心的設(shè)計(jì)思想 是一個(gè)性能穩(wěn)定的多用戶網(wǎng)絡(luò)操作系統(tǒng) Linux操作系統(tǒng)誕生于1991年10月5日 這是第一次正式向外公布時(shí)間 Linux可安裝在各種計(jì)算機(jī)硬件設(shè)備中 比如手機(jī) 平板電腦 路由器 視頻游戲控制臺(tái) 臺(tái)式計(jì)算機(jī) 大型機(jī)和超級(jí)計(jì)算機(jī) Linux存在著許多不同的Linux版本 但它們都使用了Linux內(nèi)核 5 Linux系統(tǒng)介紹 Linux存在著許多不同的Linux版本 但它們都使用了Linux內(nèi)核 系統(tǒng)操作命令基本一樣 內(nèi)部模塊稍有不同 如ORACLELinux 內(nèi)部就增加對(duì)ORACLE數(shù)據(jù)庫的支持 很多操作系統(tǒng)層面的參數(shù)已按常規(guī)做了預(yù)先配置 常用的Linux版本如下 6 Linux系統(tǒng)介紹 登錄LinuxLinux是一個(gè)真正的多用戶操作系統(tǒng) 允許多個(gè)用戶同時(shí)登錄root是linux權(quán)限最大的用戶 可以執(zhí)行一切操作 7 Linux主要系統(tǒng)分區(qū) 8 Linux主要系統(tǒng)分區(qū) 根目錄所有的目錄 文件 設(shè)備都在 之下 就是Linux文件系統(tǒng)的組織者 也是最上級(jí)的領(lǐng)導(dǎo)者 boot引導(dǎo)分區(qū)該目錄放置系統(tǒng)內(nèi)核及驅(qū)動(dòng)模塊引導(dǎo)程序 需要獨(dú)立分區(qū) SWAP交換分區(qū)類似于Windows的虛擬內(nèi)存 就是當(dāng)內(nèi)存不足的時(shí)候 把一部分硬盤空間虛擬成內(nèi)存使用 操作系統(tǒng)先把內(nèi)存中暫時(shí)不用的數(shù)據(jù) 存到硬盤的交換空間 騰出內(nèi)存來讓別的程序運(yùn)行 從而解決內(nèi)存容量不足的情況 SWAPSPACE比內(nèi)存要慢在安裝時(shí) 系統(tǒng)會(huì)嘗試將交換分區(qū)安裝到磁盤外端當(dāng)有多個(gè)磁盤控制器時(shí) 在每個(gè)磁盤上都建立交換分區(qū)盡量將交換分區(qū)安裝在訪問最頻繁的數(shù)據(jù)區(qū)附近 9 Linux主要系統(tǒng)分區(qū) root OEL64 df hFilesystemSizeUsedAvailUse Mountedon dev sda319G12G5 3G70 根分區(qū)tmpfs758M88K757M1 dev shm dev sda197M68M25M74 boot 引導(dǎo)分區(qū) root OEL64 free mtotalusedfreesharedbufferscachedMem 151433911740101124 buffers cache 1131400Swap 153501535 交換分區(qū) 10 文件類型 在linux中 所有東西都被當(dāng)成文件文件權(quán)限前的第一個(gè)字母用來標(biāo)識(shí)文件類型 一般文件d 目錄文件b 塊設(shè)備文件c 字符設(shè)備文件l 連接文件s socket文件 11 文件類型 oracle OEL64dev ls al rw r r 1rootroot883Apr302012zshrcdrwxr xr x 3rootroot60Sep2211 16busbrw rw 1rootfloppy2 0Sep2211 16fd0crw rw 1rootvideo10 175Sep2211 16agpgartlrwxrwxrwx 1rootroot3Sep2211 16cdrom sr0srw rw rw 1rootroot0Sep2211 16log 12 文件特點(diǎn) Linux將每個(gè)文件系統(tǒng)mount在系統(tǒng)目錄樹中使用 文件區(qū)分大小寫 文件以 開頭的文件為隱含文件文件名稱最多255個(gè)字符 所有字符有效 正斜杠除外 oracle OEL64 ls altotal152drwx 26oracleoinstall4096Sep1915 59 drwxr xr x 6rootroot4096Jun272013 rw r r 1oracleoinstall685Sep1817 35 bash profile 13 文件結(jié)構(gòu) 根目錄 rootroot用戶主目錄 bin存放最常用的操作命令 boot存放Linux啟動(dòng)的核心文件 etc存放各種配置文件 usr用戶程序 opt應(yīng)用軟件安裝目錄 如數(shù)據(jù)庫等 home用戶主目錄 mnt設(shè)備 文件系統(tǒng)掛載點(diǎn) tmp臨時(shí)目錄 存放臨時(shí)文件 var可變信息存放區(qū) proc虛擬文件系統(tǒng) 包含進(jìn)程信息 sbin系統(tǒng)管理員命令存放目錄 dev設(shè)備文件 lib最基本的動(dòng)態(tài)鏈接共享庫 14 文件目錄權(quán)限 文件或目錄的權(quán)限位由10位構(gòu)成 如 rwxr xr x 第一位代表文件 目錄類型 d代表目錄 代表文件 l代表鏈接 剩下的9位分成3組 每組3位 2 4位描述文件所有者的權(quán)限 5 7位描述與文件所有者同一用戶組的權(quán)限 8 10位則是其它用戶的權(quán)限 rwx 每組的3位分別是 讀權(quán)限 寫權(quán)限 執(zhí)行權(quán)限 對(duì)應(yīng)的數(shù)字分別為4 2 1 如果是 就代表沒有這個(gè)權(quán)限 例如 rwxr xr x表示這是個(gè)普通文件 文件的所有者可以讀 寫 執(zhí)行這個(gè)文件 與文件所有者同組的用戶以及其他用戶都可以讀 執(zhí)行這個(gè)文件 但沒有寫的權(quán)限 15 文件目錄權(quán)限 常用文件介紹 etc inittab系統(tǒng)初始化配置文件 init進(jìn)程需要讀取的文件 init進(jìn)程是所有進(jìn)程的起點(diǎn) etc crontab定時(shí)任務(wù)配置文件 etc shadow etc passwd用戶配置文件 用戶密碼配置文件 etc group用戶組配置文件 etc sysconfig network scripts ifcfg eth0網(wǎng)絡(luò)配置文件 var log messages系統(tǒng)錯(cuò)誤信息 etc services服務(wù)與端口信息 16 常用的Linux命令 絕對(duì)路徑 相對(duì)路徑絕對(duì)路徑以 開頭的完整的路徑 oracle OEL64oracle cd u01 app oracle oracle OEL64oracle pwd u01 app oracle相對(duì)路徑不以 開頭只相對(duì)于當(dāng)前工作目錄 oracle OEL64oracle cd u01 app oracle OEL64app cd oracle oracle OEL64oracle pwd u01 app oracle 17 常用的Linux命令 表示當(dāng)前目錄的上一級(jí)目錄 即父目錄 root OEL64tmp cd u01 app oracle root OEL64oracle pwd u01 app oracle root OEL64oracle cd root OEL64app pwd u01 app 表示當(dāng)前目錄 root OEL64app pwd u01 app root OEL64app cd oracle root OEL64oracle pwd u01 app oracle 18 常用的Linux命令 pwd顯示當(dāng)前路徑 oracle OEL64oracle cd u01 app oracle oracle OEL64oracle pwd u01 app oraclecd改變當(dāng)前目錄 oracle OEL64oracle pwd u01 app oracle oracle OEL64oracle cd etc oracle OEL64app pwd etc 19 常用的Linux命令 ls查看文件或目錄 root OEL64u01 ls altotal28drwxrwxr x 4oracleoinstall4096Sep1910 44 dr xr xr x 25rootroot4096Sep2211 16 drwxrwxr x 4oracleoinstall4096Sep1910 45appdrwxrwxr x 2oracleoinstall16384Sep1909 33lost foundcp復(fù)制文件 root OEL64oracle cp home oracle a txt tmp root OEL64oracle cd tmp root OEL64tmp ls ala txt rw r r 1rootroot0Sep2216 27a txt 20 常用的Linux命令 mv移動(dòng)或重命名文件 root OEL64tmp mv tmp b txt home oracle root OEL64tmp cd home oracle root OEL64oracle ls alb txt rw r r 1rootroot0Sep2216 30b txttouch創(chuàng)建空文件 root OEL64hanxi cd tmp root OEL64tmp touchc txt root OEL64tmp ls alc txt rw r r 1rootroot0Sep2216 36c txtfile檢查文件類型 root OEL64tmp filec txtc txt ASCIItext 21 常用的Linux命令 rm刪除文件和目錄 root OEL64bin cd tmp root OEL64tmp rmc txtrm removeregularfile c txt Y注意 此操作慎重使用 特別對(duì)于rm rf 文件和目錄一并刪除的操作 mkdir創(chuàng)建新目錄 root OEL64tmp mkdirtest root OEL64tmp ls altotal108drwxrwxrwt 26rootroot4096Sep2216 45 dr xr xr x 25rootroot4096Sep2211 16 drwxr xr x 2rootroot4096Sep2216 45testrmdir刪除空目錄 root OEL64tmp cd tmp root OEL64tmp rmdirtest root OEL64tmp ls altestls cannotaccesstest Nosuchfileordirectory 22 常用的Linux命令 cat顯示文件內(nèi)容 root OEL64tmp cat tmp alert logmore逐屏顯示文件內(nèi)容 root OEL64tmp more tmp alert logless逐行顯示文件內(nèi)容 root OEL64tmp less tmp alert log 23 常用的Linux命令 date顯示當(dāng)前時(shí)間 root OEL64tmp dateFriSep2217 03 47CST2017cal顯示當(dāng)前日歷 root OEL64tmp calSeptember2017SuMoTuWeThFrSa123456789101112131415161718192021222324252627282930 24 常用的Linux命令 head顯示文件開頭部分內(nèi)容 root OEL64tmp head 5alert logTueSep1913 04 312017StartingORACLEinstance normal LICENSE MAX SESSION 0LICENSE SESSIONS WARNING 0Sharedmemorysegmentforinstancemonitoringcreatedtail顯示文件結(jié)尾部分內(nèi)容 root OEL64tmp tail 5alert logCompleted ALTERDATABASEOPENFriSep2216 55 432017StartingbackgroundprocessCJQ0FriSep2216 55 432017CJQ0startedwithpid 22 OSid 5644 25 常用的Linux命令 find查找文件 root OEL64 find tmp namealert log tmp alert logwc作統(tǒng)計(jì) root OEL64 cd tmp root OEL64tmp ls al txt rw r r 1rootroot0Sep2216 27a txt root OEL64tmp ls al txt wc l1 26 常用的Linux命令 chmod文件或目錄權(quán)限修改 root OEL64tmp ls la1 txt rw r r 1rootroot0Sep2816 45a1 txt root OEL64tmp chmod xa1 txt root OEL64tmp ls la1 txt rwxr xr x 1rootroot0Sep2816 45a1 txtclear清屏 root OEL64tmp clearchown改變文件或目錄的所有者和組 root OEL64tmp ls la txt rw r r 1rootroot0Sep2216 27a txt root OEL64tmp chownoracle oinstalla txt root OEL64tmp ls la txt rw r r 1oracleoinstall0Sep2216 27a txt 27 常用的Linux命令 diff比較文件內(nèi)容 root OEL64hanxi diffa txtb txt2d1 bbbbbbbbbbbbbbbbbbbbbbbbbbbbbgrep過濾文件關(guān)鍵字 root OEL64hanxi ps ef greporaoracle55431016 55 00 00 00ora dbrm orcloracle55451016 55 00 00 00ora dia0 orcloracle55471016 55 00 00 04ora mman orcloracle55491016 55 00 00 01ora dbw0 orcl 28 常用的Linux命令 mount加載一個(gè)硬件設(shè)備 root OEL64dev mount dev cdrom root OEL64dev cd mnt cdromsu在不退出登陸的情況下 切換到另外用戶 root OEL64dev su oracle oracle OEL64 echo ORACLE HOME u01 app oracle product 11 2 0 db 1 29 常用的Linux命令 whoami顯示你自己登陸的用戶名 root OEL64tmp whoamirootwhereis which查詢命令所在目錄以及幫助文檔所在目錄 root OEL64dev whereisgzipgzip bin gzip usr bin gzip usr share man man1 gzip 1 gz root OEL64dev whichgzip bin gzipid顯示用戶的UID和GID root OEL64dev su oracle oracle OEL64 iduid 54321 oracle gid 54321 oinstall groups 54321 oinstall 54322 dba 30 常用的Linux命令 kill可以殺死某個(gè)正在運(yùn)行的進(jìn)程 root OEL64dev kill 930247passwd設(shè)置口令 root OEL64dev passwdoracleChangingpasswordforuseroracle Newpassword Retypenewpassword passwd allauthenticationtokensupdatedsuccessfully history查詢用戶的歷史命令 root OEL64dev history50cd mnt51ls52tar zxvfVMwareTools 9 2 3 1031360 tar gz 重復(fù)執(zhí)行最近一次的命令 31 常用的Linux命令 gzip gunziplinux標(biāo)準(zhǔn)的壓縮 解壓縮工具 root OEL64tmp gzipalert log root OEL64tmp ls ltrtotal76 rw r 1rootroot5997Sep2216 57alert log gz root OEL64tmp gunzipalert log gz root OEL64tmp ls altotal144drwxrwxrwt 25rootroot4096Sep2217 44 dr xr xr x 25rootroot4096Sep2211 16 rw r 1rootroot37568Sep2216 57alert log 32 常用的Linux命令 bzip2 bunzip2更新的標(biāo)準(zhǔn)壓縮 解壓縮工具 壓縮比更高 root OEL64tmp bzip2alert log root OEL64tmp ls altotal112drwxrwxrwt 25rootroot4096Sep2217 45 dr xr xr x 25rootroot4096Sep2211 16 rw r 1rootroot6594Sep2216 57alert log bz2 root OEL64tmp bunzip2alert log bz2 root OEL64tmp ls altotal144drwxrwxrwt 25rootroot4096Sep2217 46 dr xr xr x 25rootroot4096Sep2211 16 rw r 1rootroot37568Sep2216 57alert log 33 常用的Linux命令 通配符將與零個(gè)或多個(gè)字符匹配 root OEL64tmp pwd tmp root OEL64tmp ls al log rw r 1rootroot37568Sep2216 57alert log rw r r 1rootroot40960Sep2816 09alert log tar 通配符將與任何單個(gè)字符匹配 root OEL64tmp pwd tmp root OEL64tmp lsa t ta txt 通配符將與 中任一字符匹配 類似 root OEL64tmp ls la 1 2 txt rw r r 1rootroot0Sep2816 45a1 txt rw r r 1rootroot0Sep2816 45a2 txt root OEL64tmp ls la 1 2 txt rw r r 1rootroot0Sep2816 45a1 txt rw r r 1rootroot0Sep2816 45a2 txt 34 常用的Linux命令 exit退出當(dāng)前shell root OEL64log su oracle oracle OEL64 exitlogout root OEL64log export設(shè)置 修改和刪除環(huán)境變量 oracle OEL64 exportORACLE BASE u01 app oracle oracle OEL64 echo ORACLE BASE u01 app oracle 35 常用的Linux命令 ps顯示當(dāng)前系統(tǒng)運(yùn)行進(jìn)程的狀態(tài) root OEL64log ps ef greporaoracle53431014 36 00 00 00ora pmon orcloracle53451014 36 00 00 00ora psp0 orcloracle53481314 36 00 00 01ora vktm orcloracle53521014 36 00 00 00ora gen0 orcloracle53541014 36 00 00 00ora diag orclrpm查看 安裝或刪除軟件包 root OEL64log rpm qa grepmysqlmysql server 5 1 66 2 el6 3 i686mysql connector odbc 5 1 5r1144 7 el6 i686qt mysql 4 6 2 26 el6 4 i686mysql connector java 5 1 17 6 el6 noarch 36 常用的Linux命令 fdisk硬盤分區(qū)命令 root OEL64log fdisk lDisk dev sda 32 2GB 32212254720bytes255heads 63sectors track 3916cylindersUnits cylindersof16065 512 8225280bytesSectorsize logical physical 512bytes 512bytesI Osize minimum optimal 512bytes 512bytesDiskidentifier 0 x0000786aDeviceBootStartEndBlocksIdSystem dev sda1 11310240083LinuxPartition1doesnotendoncylinderboundary dev sda213209157286482Linuxswap SolarisPartition2doesnotendoncylinderboundary dev sda320926111929523283Linux dev sda4261139161048375083Linux 37 常用的Linux命令 top實(shí)時(shí)顯示當(dāng)前系統(tǒng)運(yùn)行狀態(tài)top 14 42 55up3 56 1user loadaverage 0 58 0 60 0 36Tasks 144total 1running 142sleeping 1stopped 0zombieCpu0 0 3 us 0 7 sy 0 0 ni 99 0 id 0 0 wa 0 0 hi 0 0 si 0 0 stMem 1550364ktotal 1119620kused 430744kfree 78572kbuffersSwap 1572860ktotal 0kused 1572860kfree 821616kcachedPIDUSERPRNIVIRTRESSHRS CPU MEMTIME COMMAND5348oracle 20774m13m11mS1 00 90 04 66oracle5485root200000S0 30 00 00 07kworker 0 15516root20027521040780R0 30 10 00 08top1root200294814401224S0 00 10 01 20init 38 常用的Linux命令 shutdown關(guān)機(jī)命令shutdown rnow關(guān)機(jī)重啟shutdown hnow關(guān)機(jī)并關(guān)閉電源initLinux下的進(jìn)程初始化工具init0關(guān)機(jī)init1重啟 39 常用的Linux命令 man在線幫助命令 root OEL64tmp manls help在線幫助命令 root OEL64tmp ls helpUsage ls OPTION FILE Info在線幫助命令 root OEL64tmp infolsFile coreutils info Node lsinvocation Next dirinvocation Up Directo rylisting 40 Vi編輯器的使用 作為一個(gè)編輯器 vi被廣泛地運(yùn)用在各種Unix操作系統(tǒng)上Vi是Linux中的標(biāo)準(zhǔn)文本編輯器在RedHatLinux上 一般采用的是vim viimproved 41 Vi編輯器的使用 Vi提供三種模式命令模式瀏覽 刪除 剪貼 查找等可以用各種命令進(jìn)入插入模式插入模式輸入新文檔用退出插入模式回命令模式EX模式 42 Vi編輯器的使用 在命令模式下 w保存當(dāng)前文件 q如果未對(duì)文件做改動(dòng)則退出 wq保存當(dāng)前文件并退出 q 不保存強(qiáng)制退出 e文件名打開另一文件并開始編輯 43 用戶和組的管理 groupadd增加用戶組groupadd g540dbagroupdel刪除用戶組groupdeldbauseradd增加用戶useradd u541 gdba s bin bashoracle默認(rèn)創(chuàng)建的用戶將會(huì)在 home下為該用戶創(chuàng)建一個(gè)目錄 為用戶的home目錄userdel刪除用戶userdeloracle 44 網(wǎng)絡(luò)管理 ifconfig查看網(wǎng)絡(luò)配置 root OEL64log ifconfig aeth4Linkencap EthernetHWaddr00 0C 29 5B AC 23inetaddr 172 21 110 51Bcast 172 21 110 255Mask 255 255 255 0inet6addr fe80 20c 29ff fe5b ac23 64Scope LinkUPBROADCASTRUNNINGMULTICASTMTU 1500Metric 1RXpackets 19405errors 0dropped 211overruns 0frame 0TXpackets 3435errors 0dropped 0overruns 0carrier 0collisions 0txqueuelen 1000RXbytes 4387356 4 1MiB TXbytes 1095534 1 0MiB Interrupt 19Baseaddress 0 x2024loLinkencap LocalLoopbackinetaddr 127 0 0 1Mask 255 0 0 0inet6addr 1 128Scope HostUPLOOPBACKRUNNINGMTU 16436Metric 1RXpackets 8errors 0dropped 0overruns 0frame 0TXpackets 8errors 0dropped 0overruns 0carrier 0collisions 0txqueuelen 0RXbytes 452 452 0b TXbytes 452 452 0b 45 網(wǎng)絡(luò)管理 查看網(wǎng)卡配置文件 root OEL64log cat etc sysconfig network scripts ifcfg eth4DEVICE eth4IPADDR 172 21 110 51NETMASK 255 255 255 0GATEWAY 172 21 110 1ONBOOT yesNAME eth4HWADDR 00 0C 29 5B AC 23 46 網(wǎng)絡(luò)管理 netstat查看系統(tǒng)中的服務(wù)與對(duì)應(yīng)的端口 root

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(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)論