"CentOS" Disk Management with VIM compiler

Source: Internet
Author: User
Tags disk usage

One, view hard disk or directory capacity

1.DF [-hmkit]

-H View System disk usage

-M using MBytes to display results

-K displaying results using Kbytes

-I view Inode

-T view type

2.du [-abhkms] [directory name]

-S only lists the total value of the last calculation

-K display in kilobytes (default)

-m Display in MB

-h display in appropriate units

-B Display in units

-a lists all files and directories, the default value is the value of the list directory

Note: Only one file is allowed in a block, the default file size for a block is 4K

Ii. partitioning and formatting of disks

Disk Trilogy: Partitioning--formatting--mount

1.fdisk [-l][device name]

-l lists the partition table of the hard disk device directly

Eg:fdisk-l/dev/sdb

"Specific steps to be added later"

2.MKE2FS [-B block-size][-i inode-size][-l] [partition]

-L Sets the label (header name) for this sector

Eg:mke2fs-t ext4-b 1024/DEV/SDB1

3.mount [-ahlo][partition name, can also be used uuid][mount point]

-O to be supplemented (bird brother P134)

-A according to the contents of/etc/fstab in all relevant hard disk------(/etc/fstab for automatic boot loading)

Umount [-l][partition] Unload mount

-L is expressed as mandatory

worth knowing usage: Mount--bind/home//mnt/

The/home/is attached to the/mnt/below, equivalent to the establishment of a soft link, delete/home/this "soft link" will expire

Third, VIM editor

When opening a file, vi +10 filename, move the cursor to line tenth of the file

Look at the line number, with Set Nu; cancel this, use set Nonu

1. General mode

Common shortcut keys:

Copy: "yy", "10yy"

Paste: "P", "5p"

Delete/Cut forward: "X", "10x"

Delete/cut back: "X", "10X"

Delete one line: "DD", "10DD"

Optional: "V"

The cursor jumps to the beginning of the first character: "^"

Cursor jumps to the beginning: "0"

Cursor jumps to the end: "$"

2. Edit mode

I,o,a,i,o,a

3. Command mode

Search down:/name

Search up:? name

Find Replacement: ": 1. $s/iptable/iptable/g" or "%s/iptable/iptable/g"

G represents the global meaning, and the code's role is to replace all iptable in the range with Iptalbe

Remove the highlighted yellow background: Nohl (NO)

If VIM is not already installed, you can use the command Yum install-y vin-enhanced installation

"CentOS" Disk Management with VIM compiler

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.