6, Linux Foundation (ii)

Source: Internet
Author: User
Tags delete key md5 encryption unpack

A text processing command and tar command

1. Using the cat command to merge files vertically
1) Master the vertical merging of files using the cat command:
a) For example: Use the cat command to vertically merge the three files of Baby.age, baby.kg, and baby.sex into a baby file:
cat baby.age baby.kg baby.sex >baby
b) For example: Use the Cat command to add the contents of the Baby.age file to the Baby2 file:
Cat Baby.age >>baby2
2. Archive files and archiving technology
1) Mastering the definition of archiving: Archiving (archiving) is the packaging of many files (or directories) into one file.
2) Understand the purpose of archiving: The purpose of archiving is to facilitate backup, restore and file transfer operations.
3) Master the function of the tar command: put multiple files (which may also include directories, because the directory itself is also a file) in a tape or disk archive file. And in the future, you can restore only some of the files specified in the archive as needed.
4) Master the common options for the tar command:
C: Create a new tar file.
T: Lists the contents of the directory in the tar file.
x: Extract the files from the tar file.
F: Specify the archive or tape (or possibly floppy) device (typically selected).
V: Displays the details of the packaged file, and V is the 1th letter of the verbose.
Z: Use the gzip compression algorithm to compress the packaged files.
J: Use the BZIP2 compression algorithm to compress the packaged file.
3. Create, view, and extract archive files using the tar command
1) An example of using the TAR command to create an archive file:
Example: Use the TAR command to package the Arch directory as an archive file named Arch.tar (requires that all packaged files and directories be displayed):
tar cvf arch.tar arch
for an example of using the TAR command to view an archive file:
For example, use the TAR command to display a method that arch.tar all the files in this archive file (package):
Tar tf arch.tar
2) Master the use of the tar command to extract an archive file using an example:
For example, use the tar command to restore the entire contents of Arch.tar:
tar xvf arch.tar-c path

4. File compression and decompression
1) Grasp the definition of compression: Compression is a large file through a number of compression algorithms into a small file.
2) Understand the purpose of compression: mainly to reduce the size of the file, which will save the disk or tape storage file space, and the transmission of these small files on the network will also reduce network browsing (that is, to save network bandwidth).
3) Mastering the definition of decompression: decompression is the way to restore a file that passes through some compression algorithms before it is compressed.
4) An example of the use of the gzip command and the gunzip command:
a) For example: Compressed files File1 compressed into. gz format should use the command: gzip file1–c >/path/name.gz
b) For example: The command to extract the compressed file file1.gz is:
gunzip file1.gz >
5) Use examples of mastering bzip2 commands and BUNZIP2 commands:
a) For example: Compress the file file1 into. bz2 format the command that should be used is: bzip2 file1 >
b) For example: The command to extract the compressed file file1.bz2 is:
bunzip2 file1.bz2 >
5. Compress and decompress while using the TAR command
1) Master the use of compression and decompression while using the tar command example
a) For example, use the TAR command to package the Arch catalog and use gzip technology to compress the packaged file (the packaged file is named arch.tar.gz):
tar cvfz arch.tar.gz arch
b) For example: Use the TAR command to package the Arch directory and use bzip2 technology to compress the packaged file method (the packaged file is named arch.tar.bz2): Tar cvfj arch.tar.bz2 Arch

6 after-school homework

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


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

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

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


5) Decompression 1.txt.gz


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


7) Decompression 1.txt.bz2


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


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


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

Two use VI Editor to create and edit body files

1. Introduction to VI Editor
1) Master VI definition: VI is a UNIX and Linux system embedded in the standard body (text) editor, it is an interactive type of body editor, it can be used to create and modify body files.
2.VI Editor Mode of operation
1) Master the VI Editor in the 3 basic mode:
A) command-line mode: The default mode for VI. In this mode, all inputs are interpreted as VI commands, which can be used to modify, copy, move, paste, and delete the text, as well as to move the cursor, search for strings, and exit VI operations.
b) Edit mode: In edit mode, the text can be entered in a previous file. In this mode, each character entered is interpreted by the VI editor as the body of the input. Use the ESC key to return to the command-line mode.
c) Extended mode: Also called the last line mode on some UNIX systems. In this mode, you can use some advanced editing commands, such as searching and replacing strings, saving or exiting the VI editor, and so on. To enter the last line mode, you need to enter a colon (:) in the command line mode, and the colon will move the cursor to the last line of the screen.
3. Cursor movement in VI Editor
1) Master the relationship between the keys used to move the cursor position in the VI editor and the cursor movement, as in the following table:

4. Enter insert mode
1) command to enter insert mode from command line mode:
A: Enter insert mode and add after the cursor.
I: Enter the insert mode and insert it before the cursor.
O: Enter insert mode and open a new line below the current (cursor) line.

5. Delete and copy operations in command-line mode
1) master commonly used buttons for deleting and copying

6. Paste command

1) Master the Paste command:

7. Undo and Redo Commands

1) master the commonly used undo and redo Commands:

8. Storage and exit of extended mode and files

1) Master commands commonly used in extended mode:

9. Quickly move the position of the cursor in the file

1) command to quickly move the position of the cursor in the file

10. Quickly move the position of the cursor in the screen

1) command to quickly navigate the position of the cursor in the screen

11. After-school assignments (spents 40 minutes)

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

VI 1.txt Enter and press a----> write "Hello World"---->ESC--->:wq---> enter
2) go to command line mode to copy the row content, paste 80 lines below

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

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

shift+m
5) quickly move the cursor to the fifth line of the file

5+gg
6) Insert a new line below "Welcome to Beijing"

7) Delete the row you just inserted

DD
8) Undo the previous step

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

: Wq------"Enter

Initialization and service of three systems

1. Boot Order of Linux systems
1) Mastering the Order of Linux system boot: (see attached 1)

among them, the work of the BIOS is to check the computer hardware devices, such as CPU, memory and fan speed;
The MBR will be in the 1th block of the boot disk, with a size of 512B. The first 446 of the program code is used to select the boot partition (partition), that is, which partition to load the boot code;
in the kernel part, the driver of the computer device is mainly installed so that the operating system can control the device on the computer. And a read-only mount/(root) file system, that is, at this time the operating system can only read the root file system (directory) where the partition;
the INIT program has a process ID of 1, which is the 1th program executed by the Linux operating system.
initialization and boot loader for 2.BOIS
1) Master the definition of BIOS: BIOS (Basic input/output System) (abbreviated for the base input/output systems), which is the interface between hardware and software, and is a very basic interface.
2.GRUB Programs and grub.conf files (see Linux System Management P317)
1) Mastering the definition of grub: GRUB is the abbreviation for the Grand Unified Bootloader (multiple OS boot manager).
2) Master grub configuration file as: grub.conf
Set the Grub MD5 encryption command Grub-md5-crypt
Password = plaintext or Password--md5 ciphertext (edit the password for the Grub configuration file)
Title Red Hat header
Password = plaintext or Password--md5 ciphertext (the password required to load the kernel system boot)
3. Initialization of the kernel and initialization of Init
1) Master the init configuration file as:/etc/inittab
2) Understand the work that the INIT program will do:
a) Decide which run levels (RunLevel) to use for the preset (default).
b) Perform some system initialization scripts (programs) to initialize the operating system.
c) Execute the program in the corresponding directory according to the settings of the run level to determine which services to start.
d) Set some key combinations.
e) Define the UPS uninterruptible power system, which is the program to be executed when there is a problem with the supply or when the power is restored.
f) Generate 6 virtual consoles, i.e. Tty1~tty6.
4.run levels (operating level)
1) Master all the operating levels and the corresponding functions of each operation level:

5. Shutting down the system and rebooting the system
1) Master the commonly used commands to shut down the system:
Shutdown-h now
Halt
Poweroff
Init 0
2) Master the commonly used commands to restart the system:
Shutdown-r now
Reboot
Init 6
Ctrl+alt+delete Key
6. Master single-user mode to modify the user's password
7. Master Rescue Mode

6, Linux Foundation (ii)

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.