Linux Tar Vim basics

Source: Internet
Author: User
Tags bz2 unpack

Job One:
1) Merge user information database files and group information database files vertically into one file/1.txt (overwrite)

[Email protected]/]# Cat/etc/passwd/etc/group > 1.txt


2) Merge user information database files and user password database files vertically into one file/2.txt (append)

[Email protected]/]# Cat/etc/passwd/etc/group >> 2.txt


3) Package The/1.txt,/2.txt two files as a/1.tar

[[Email protected]/]# tar cvf 1.tar 1.txt 2.txt
1.txt
2.txt

[[email protected]/]# ls 1.tar
1.tar


4) Use the gzip command to compress the 1.txt file named 1.txt.gz

[[Email protected]/]# gzip 1.txt

[[email protected]/]# ls 1.txt.gz
1.txt.gz


5) Decompression 1.txt.gz

[Email protected]/]# gunzip 1.txt.gz
[[email protected]/]# ls


6) file name 1.txt.bz2 after compressing 1.txt compression with bzip2

[Email protected]/]# bzip2 1.txt
[[email protected]/]# ls
1.tar
1.txt.bz2
2.txt


7) Decompression 1.txt.bz2

[Email protected]/]# BUNZIP2 1.txt.bz2
[[email protected]/]# ls
1.tar
1.txt
2.txt


8) Unpack 1.tar, unpack the file and store it in the/tmp directory

[Email protected]/]# tar xvf 1.tar-c/tmp
1.txt
2.txt
[Email protected]/]# cd/tmp
[[email protected] tmp]# ls
1.txt
2.txt


9) Use the TAR command to package and compress/1.txt,/2.txt, and get the file name 1.tar.gz

[Email protected]/]# tar cvzf 1.tar.gz 1.txt 2.txt
1.txt
2.txt
[[email protected]/]# ls
1.tar 2.txt
1.tar.gz


10) Unpack the 1.tar.gz, unpack the file and store it in the/tmp directory

[Email protected]/]# tar xvf 1.tar.gz-c/tmp
1.txt
2.txt
[Email protected]/]# cd/tmp/
[[email protected] tmp]# ls
1.txt
2.txt

Job Two:
1) Edit the file using the VI editor/1.txt Enter the edit mode to write the content "Hello World"

[Email protected]/]# vim 1.txt

In edit mode, press "G"

Press "a"

Enter "Hello Wold"

Press "ESC"

shift+:

Wq

Enter


2) go to command line mode to copy the row content, paste 80 lines below

[Email protected]/]# vim 1.txt

In command-line mode

Press "G" to jump to the end of the text

Yy

: 02

3) quickly move the cursor to the last line of the file

[Email protected]/]# vim 1.txt

Press "ESC"

Press "G"


4) quickly move the cursor to the middle line of the current screen

[Email protected]/]# vim 1.txt

Press "ESC"

Press "M"


5) quickly move the cursor to the fifth line of the file

[Email protected]/]# vim 1.txt

Press "ESC"

Enter "5G"


6) Insert a new line below "Welcome to Beijing"

[Email protected]/]# vim 1.txt

Esc-->5g-->enter-->welcome to Beijing-->esc-->shift+:-->wq-->enter


7) Delete the row you just inserted

After the input is complete-->ESC-->DD


8) Undo the previous step

dd--> u


9) Enter the extended mode to perform the File Save exit operation

Esc-->wq-->enter

Job Three:
1) Single-user mode cracked root password

Http://www.centoscn.com/CentOS/Intermediate/2015/0509/5395.html


2) Rescue mode hack root password

WIN10 64-bit

System: centos7.0 Instruction Edition

Make sure that the image of your virtual machine is still

Boot Mad Press F2--> to enter the BIOS settings, the boot entry to the CD-ROM first bit, F10 save exit, enter

Go to the next step,

Up and down keys switch to troubleshooting carriage return

Next Click Enter

Next, select Continue OK

OK, next step.

Next, continue OK

Next, follow the picture and remember to enter the new password after echo

Next, re-bring the startup item back

OK, Change complete

Linux Tar Vim basics

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.