Walk into the computer on the sixth day (Basics of Linux)

Source: Internet
Author: User
Tags bz2

1 function and usage of the tar command

Tar can create archives for Linux files and directories, and with tar you can create backup files for a specific file (backup file). You can also add files or change files in the file.

Tar first to understand two concepts: one is packaging, and the other is compression.

Packaging refers to a bunch of files or directories into a total file, followed by (CVF packaging after the file name packaging objects). (c: Create a new tar file.) ), (v:verbose, displays the details of the packaged file.) ), (f: Specify the archive file and tape (floppy) device, usually selected).

Use the tar command to reply to the archive: Use the method (Tar CVF requires the file name of the archive-C brutishness).

Compress files with tar: (1) gzip and gunzip, zip files with gz compression method (Gzip compressed object-c>/Path/object name after compression). And the Decompression method is (Gunzip extract the object >). The compression method of using the TAR command to package a file or directory while performing Gzip is (the object that the tar cvfz the object name operation after operation). (compression method of Z=gzip:gz)

(2) Bzip2 and BINZIP2: The compression method with BZ is (bzip2 compressed object), and the Decompression method is (BUNZIP2 decompression of the object). The decompression method for using the TAR command to package a directory or file for simultaneous execution of BZ2 is (the object that the tar cvfj the object name operation after operation). (compression method of j=bzip2:bz2)

There are also some tar-related parameters

-x: Unlock a compressed file

-T: View the files inside the Tarfile (parameter release, E x T can only exist at the same time, does not exist simultaneously.) Because it cannot be decompressed or compressed at the same time).

-P: Use the original properties of the original file.

-P: The absolute path can be used to compress.

2 VIM-related content

Vim: belongs to the body editor of Linux, can go into the file to modify the text content.

VIM-related key combinations: (1) Enter insert mode from the command line mode.

A: Insert from the next position where the cursor is resting.

A: Insert from the end of the line.

I: Insert from the position where the cursor is resting.

I: Insert from the beginning of the line.

O: Insert from the next line where the cursor is resting.

O: Insert from the previous line in the current row.

(2) Movement of the cursor

$: The cursor moves to the last position of the current line.

0: The cursor moves to the first position of the current line.

G: The cursor moves to the last line of the current file.

N (number) G: The cursor will move to the nth row of the current file.

GG: The cursor will be moved when the first line of the file. Equivalent to 1G.

H: The cursor will move to the first character on the top line of the current screen.

M: The first character of the line in which the cursor moves to the middle of the current screen.

L: The cursor will move the first character of the bottom line of the current screen.

(3) Copy, paste and delete in command line mode

DD: Deletes the line where the cursor is located.

N (number) DD: Deletes the following n rows of the row to which the cursor is positioned.

YY: Copy the row that the cursor is parked on.

N (number) YY: The next n rows of the row to which the cursor is copied.

P: Pastes the copied data to the next line of the cursor.

P: The previous line of the row to which the cursor will be pasted with the copied data.

(4) Recovery and Redo commands

U: Revert to the previous operation.

Ctrl+r: Redo the previous operation.

(5) The final operation

At this point it will almost end, press ESC again to enter command line mode, and then press shift+: Enter expansion mode. Then enter WQ to save the exit (w: Save, Q: Exit), if you still do not exit the words can be lost one! (! : Forced exit). This completes a single operation.

4 No Boot media rescue mode cracked root user password

1 start the virtual user, at the time of the Grub splash screen, select the startup item with the up and down keys.

2 Use the ' E ' key to enter the startup item of your choice, then use the up and down keys to move the cursor to "linux16 ...". "That line, use the end key to move the cursor to the end of the line, and then add Console=tty0,rd,break to tell Grub to start the operating system, pass the parameters to the operating system, and then press Ctrl+x to boot from the new.

3 Enter the command to edit the password.

5 single-user mode hack password

1 start the virtual user, and at the time of the Grub boot interface, select the startup item with the up and down keys.

2 use ' e ' to enter the startup item of your choice, then use the up and down keys to move the cursor to "linux16 ...". "That line, delete" rhgb quiet, then use the end key to move the cursor to the tail of the character, add the parameter init=/bin/sh, to tell Grub to start the operating system, pass parameters to the operating system. Press Ctrl+x to boot.

3 Enter the command to reset the user password, if the system is enabled SELinux, you need to run the Touch/.autoreiabel command, or the system will not start normally.

4 Run the command Exec/sbin/init to start, or restart with the Exec/sbin/reboot command.

6 Use media rescue mode to crack the root user password

1 Enter the BIOS boot entry, set the disc as the first boot entry, and then press F10 to save.

2 Read the second process select Troubieshooting, and then press ENTER.

3 then select Rescue a CentOS system to enter rescue mode.

4 Select continue to continue running.

5 Remember Chroot/mnt/sysimage This command, and then always click "OK" to continue.

6 Enter the disc system, enter the command you just remembered (Chroot/mnt/sysimage) to mount the local hard drive's operating system to make a change password.

7 then press ESC to exit the hard disk's operating system, reboot restart the disc system, enter the BIOS option, set the hard drive as the startup item, and then start normally.

Walk into the computer on the sixth day (Basics of Linux)

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.