Linux Note 3 20160715_2

weixin_33750452發表於2016-07-16

vi, vim

vi is a very strong command line edit software.
vim was the advanced version of vi, adding the support of GUI.
Except vim, emacs is even stronger than vim.

vim + path to use vim

three modes of vi

  • command mode
    default
    i : insert text at the cursor
    o : insert a new line below the current one
    dd : delete the whole row
    yy : put the current row's content to the ram(copy the current line)
    n+yy: put n rows' content to the ram(copy n lines)
    p : paste
    u : revoke the last manipulation
    r : replace current character
    / : find key word

  • insert mode
    i
    Esc : back to the command mode

  • ex mode
    :

:w     #save
: q    #quit
:q!    #force to quit
:set number    #show the line number
:! system command # execute a system command
:sh #return to the command line  and 'ctrl + d' can return to the vim 

Basic concept of disc

轉速越快,磁碟效能越強。但是,功率發熱量都會高。
SATA

  • 柱面(cylinder)
    立體,多碟片疊加的柱面圈
  • 扇區(sector)
    中心擴散出來的扇形
  • 磁頭(head)
    讀寫資料,每個磁碟上下都有個磁頭

磁碟在linux中的表示

裝置名稱一般為hd[a-z]或sd[a-z],如hda,hdb,sda,sdb
IDE裝置的名稱為hd[a-z],SATA,SCSI,SAS,USB等裝置名稱為sd[a-z]

concept of partition

將一個磁碟邏輯的分為幾個區,每個區當作獨立磁碟,以方便管理。
不同分割槽用: 裝置名稱 + 分割槽號 ,如sda1,sda2
主流的分割槽機制分為MBR和GPT兩種。

MBR

Master Boot Record. Traditional one. Applied to most BIOS PC device.

  • support 32bit and 64bit
  • there is a limit for partition
  • support no more than 2T hard disk.

MBR partition

  • main partition
    at most 4
  • extended partition
    take a place of the main partition.
    can't be used. still need logical partition.
  • logical partition
    can only be created by creating an extended partition first.
    Linux can support at most 63 IDE partition and 15 SCSI partition.

GPT

A new one.

  • support more than 2T
  • compatible with MBR
  • only can be used on the hardware that supports UEFI
  • only 64bit
  • Mac,Linux both support GPT
  • Windows 7 64bit, windowsServer2008(win10,win8?)

相關文章