LINUX the next day

Source: Internet
Author: User

Directory (operation of Linux files)

                                      1. 1. File (Basic command)


                                      1. Use of the 2.VI editor


                                      2. 3. Paging command


                                      3. 4. Compression and Decompression commands



1. File (Basic command)

1.1 Creation of files

Touch file name

1.2 Deleting files

RM-RF file name

1.3 Copy command

CP Source Data target

If the source, target is under the same path, rename

1.4 Clip

MV Source data target

If the source, target is under the same path, rename

2. Use of the editor (to use the Vi,vim editor)

2.1 of three modes

2.1.1 Command mode

Vim initiated by default into command mode, any mode can be returned to command mode by ESC

2.1.2 Insert Mode

In command mode, press "I" to enter both insert mode, in insert mode you can edit text text content, press ESC to return to command mode

2.1.3 Ex Mode

In command mode, press and hold shift+ ":" Can go into ex mode, Wq save exit, q! exit does not save

3. Paging mode

3.1 Cat

Command format: Cat file

Once viewed, no paging

3.2 More

Command format: More files

Enter: "One-line load"

Space: "One page, one page load"

Q: "Exit"

Cons: "Can not be turned upside down, is to see history seen"

3.3 Less

Command format: Less file

Enter: "One-line load"

Space: "One page, one page load"

Key on keyboard: "View History"

Keyboard key: "One-line load"

Q: "Exit"

Cons: "You can see what history has seen"

3.4 Head

Command format: Head-(Number: digital) file

The first few lines, if there is no number, the default display begins with 10 lines;

3.5 tail

Command format: Tail-(Number: digital) file

The end of a few lines, if there is no number, the default display of the end 10 lines;

Note: Tail-f file: Displays new data, many in big data.

4. Compression and decompression

4.1 Compression command: gzip; extract command: Gunzip (cannot compress the directory and does not save the source file)

TEST_GZIP1,TEST_GZIP2,TEST_GZIP3 three files created

Created a TEST_GZIP4,TEST_GZIP5,TEST_GZIP6 three directory

Perform gzip test_gzip1 (success)

Perform gzip TEST_GZIP4 (error)

Description: gzip can only compress files and cannot compress directories

Perform gzip test_gzip1 (success) but without the source file Test_gzip1, only the test_gzip1.gz Description gzip command does not save the source file

Execute gunzip test_gzip1.gz extract command is missing test_gzip1.gz only test_gzip1 Description gunzip command does not save source file

4.2 Compression Command: TAR-CVFZ

Command format: TAR-ZVCF compressed filename directory/File

Parameter explanation:-C Package

-V Show More information

-F Specify File name

-Z Package simultaneous compression

Example: Compressed file test_gzip1 is a file

Compressed directory TEST_GZIP4 is directory

Decompression command: TAR-XVFZ

Command format: TAR-ZVXF compressed file name

Parameter explanation:-X Unpacking

-V Show More information

-F Specify File name

Different points:-Z is here to decompress

The above example summarizes the tar command to either compress the file or compress the directory, and keep the source file

4.3 compression command: Zip; Unzip command: Unzip

ZIP-R (compressed directory)

Unzip decompression

Syntax format: Zip-r compressed file or directory name file or directory

Example: Zip-r xxx.zip xxx

Unzip decompression

Syntax format: Unzip Test_gzip1.zip

Conclusion: Zip Linux and Windows generic, commands can either compress the file or compress the directory, and keep the source file


4.4 Compression Command: BZIP2-K (generates compressed file name and preserves source file) (compression ratio is very strong)

Command format: Bzip2-k directory or file

The suffix is:. bz2

Example: Bzip2-k test_gzip1

Unzip: Bunzip2-k (unzip and retain compressed files)

The function of the-K parameter, reserved


And it can be used in conjunction with TAR.

Suffix:. tar.bzip2

Syntax format: TAR-CJF xxx.tar.bzip2 xxxx

Unzip:

Syntax format: TAR-XJF XXX.TAR.BZIP2

Use of wildcard characters:




LINUX the next day

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.