Sixth day use of Vim editor and Xmanager remote tool use

Source: Internet
Author: User

1.1 Vim Main Mode introduction, VIM command mode

Using commands

1 vim [file name]

There are three main modes: Command mode, edit mode, command line mode

In Vim, the main use of shortcut keys to operate, see: http://www.cnblogs.com/xiaogan/p/5732780.html

This article read, the basic fix!!! The basic VIM settings are as follows: (after copying the code, save it as a. vimrc file, save it in the user directory)

set Nusyntax onset softtabstop=4set Shiftwidth=4set Expandtabset guioptions -=tset nobackupset formatoptions=tcrqnset cindentset smartindentset incsearchset autoindentset Fileencodings=ucs-bom,utf-8, Chineseset guifont=bitstream_vera_sans_mono:h10:cansi

There is also a view mode in Vim, which is used when you want to do the same thing on multiple lines:

First step: Move the cursor to the corresponding position of the row you want to manipulate

Step two:Ctrl + V into view mode

Step three: move the cursor to select additional rows to manipulate

Fourth step: Enter the uppercase I, fill in the content to be added, then ESC exit

To delete, the same is true;

1.2 Combat-solve the problem of garbled confusion after the opening of vim-----(use of transcoding tool Iconv)

Uploading a text document from Windows to Linux, viewing its contents, will find it garbled. Because the encoding used by the two systems is inconsistent, the result is. In general, the Chinese encoding in Windows is GB2312, while in Linux the Chinese encoding uses UTF-8 or other

First step: Upload text documents from Windows to Linux view

First, modify the VMware virtual network setting to Host-only to ensure that the Linux virtual machine communicates with the Windows host.

Then, look at the IP address of the VMNET1 network card in Windows and the virtual machine NIC IP address in a network segment

Ping each other, see if you can ping, Note: Firewall in Windows needs to be turned off, or Linux virtual machine may not ping

Start Xmanager Xshell, connect the virtual machine 192.168.171.128

After success, use the RZ command to upload the text that was newly created in Windows to the A.txt (in A.txt) to the virtual machine

Then, look at the Linux

Look at the garbled, right?!

This is the tool you need today, iconv.

Check to see if the system has this package installed:

1 which iconv

View Package Version: (Note: That is the upper left corner of the keyboard, 1 left key)

RPM-QF 'which iconv '

If not installed, use the following command to install: ( Note: The RHEL7.2 image file has been mounted to the/MNT directory by default )

rpm-ivh/mnt/packages/glibc-common-2.17- -

Then, use the command iconv to transcode the uploaded file A.txt:

Iconv-f GB2312 A.txt-o Aaa.txt

Check out the newly generated file, OK everything is done!!!

Attached: Iconv Help documentation

[Email protected] ~]#iconv--helpusage:iconv [OPTION...] [FILE ...]convert encoding of givenFilesFrom one encoding to another.Input/outputformatspecification:-F,--from-code=NAME encoding of original TEXT-T,--to-code=name encoding forOutput Information:-L,--list List all known coded character sets Output control:-C Omit Invalid C Haracters from Output-o,--output=FILE Output File-s,--silent Suppress Warnings--verbosePrintProgress Information-?,--help Give This help list--usage Give a short usage message-v,--versionPrintProgram versionmandatory or optional arguments to long options is also mandatory or optional forAny corresponding short options. forBug Reporting Instructions,Please see :

Do not have to understand every English, according to the document can know a probably can, are guessing, slowly know what the meaning of, when it's time to turn the dictionary

There's--help.

Iconv's

-F--from-code=name parameter for the specified original file encoding format (GB2312 encoding for kanji processing)

-o--output=file parameter specifies the newly generated file name and path after transcoding

-T--to-code=nam E to specify the encoding used by the new build file

-I--list to see all known encoding format names

-C ignores Invalid character output

-S--silent remain silent, that is, suppress the warning

1.3 Use of Xmanager Remote Tools

Xmanager Enterprise 4 can use Xshell remote connection host, you can use XFTP to transfer files to a connected host

When transferring the small file, you can enter RZ in the Xshell terminal, the system will pop up the dialog box, select the file to upload (does not support large files, will be broken)

Find your own.

1.4 Combat: Recover deleted files in RHEL6.5----The use of the Extundelete command

Background: Why deleted files can be recovered by mistake?! Why delete faster than copy?!

There is an inode number for each file, and the inode number is where the file should be located on the physical storage

When a new file is created, the system assigns an inode number to the file and occupies the corresponding physical storage location.

When the file is deleted, only the file name of the file is deleted, and the Inode and the physical memory have their information

However, when a new operation occurs on the disk, the new file may overwrite the physical storage corresponding to the deleted file

Therefore, in order to avoid the accidental deletion of files that are overwritten, you should uninstall the partition that needs to recover the files, or mount them in read-only mode.

Let ' t Go!!!

Download Extundelete
Http://sourceforge.net Open source Software Release Center

First step: Add a hard disk to the virtual machine before opening the RHEL6.5 virtual machine

The rest of the way is the default, and then the boot

Step Two: see if the hard drive has been added in the/dev directory

ls /dev/sd*

The newly added hard drive is named SDB

Step three: Partition the newly added hard drive

Fdisk/dev/sdb

Enter M, view help information, n is to create a new partition, p is to view the partition table, W is to synchronize the changes to the hard disk

Only after you enter the W, your operation will be effective Oh!!!

Add a 1G partition operation as follows (Red arrow)

Fourth step: Success When viewing partitions

ls /dev/sdb*

If not shown, the partition table needs to be updated:

Fifth step: Format the newly created partition, mount

The Format Command command is as follows:

mkfs.ext4/dev/sdb1or-F EXT4/DEV/SDB1

mkdir /sdb1            #在根目录下新建sdb1的挂载点 sdb1Mount /dev/sdb1/sdb1  #将格式化后的分区, Mount to new mount point  DF -T  tail -1       #查看挂载 just look at the last line.-t view partition file format

Sixth step: Preparing the experimental environment

Install the tree package

rpm-ivh/mnt/packages/tree-1.5. 3-2. el6.x86_64

(Note: The/MNT directory is mounted with the RHEL6.5 ISO installation image)

Note: D is an empty folder

Seventh Step: Delete all the files in the/SDB1 directory and then uninstall

(Note: In the case of accidental deletion of files, should immediately uninstall the deleted files corresponding to the partition, so as not to have a new operation overwrite the deleted files mistakenly)

Eighth Step: Install the required packages for recovery Extundelete

Upload downloaded Extundelete packages to Linux using Xmanager Enterprise 4 Xshell and xftp, and install them

tar -jxvf extundelete-0.2. 4. tar. bz2

Then, enter the directory that was generated after the decompression and start the installation

CD extundelete-0.2. 4 . /configure

This is going to be an error, because we have a package that doesn't fit, using commands

rpm-ivh/mnt/packages/e2fsprogs-devel-1.41. el6.x86_64.rpm.

(Note: The/MNT directory is mounted with the RHEL6.5 ISO installation image)

Then, continue:

If you do not know how to install, you can vim README

Hold on, let's go to class.

Sixth day use of Vim editor and Xmanager remote tool use

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.