Linux Basics Command Practice DAY3

Source: Internet
Author: User

A. The purpose of the cat command is to connect files or standard input and print. This command is commonly used to display the contents of a file, or to connect several files to display, or to read from a standard input and display it, often in conjunction with redirection symbols.

1. Command format:

Cat [Options] [file] ...

2. Command function:

There are three major features of cat:

1. Display the entire file at once: Cat filename

2. Create a file from the keyboard: cat > FileName can only create new files and cannot edit existing files.

3. Merge several files into one file: Cat file1 file2 > file

3. Command parameters:

-A,--show-all equivalent to-vet

-B,--number-nonblank number of non-null output lines

-e equivalent to-ve

-E,--show-ends displays at the end of each line

-N,--number all line numbers for the output, numbering the number of rows for all outputs starting from 1

-S,--squeeze-blank a blank line that has more than two lines in a row and is substituted for a row

-T vs.-VT equivalence

-T,--show-tabs to display the ^i character as a

-U (ignored)

-V,--show-nonprinting uses ^ and M-references, except LFD and TAB

two. The tar command creates a file for Linux files and directories. With tar, you can create files (backup files) for a specific file, or you can change files in the file or add new files to the file. Tar was originally used to create archives on tape, and now users can create files on any device. With the tar command, you can package a whole bunch of files and directories into a single file, which is useful for backing up files or combining several files into one file for easy network transmission.

The first thing to understand is two concepts: packaging and compression. Packaging refers to a large number of files or directories into a total file, compression is a large file through some compression algorithm into a small file.

Why should we differentiate between these two concepts? This is due to the many compression programs in Linux that can only be compressed for one file, so that when you want to compress a lot of files, you have to first make a package (Tar command) of the whole bunch of files, and then compress the program (gzip bzip2 command).

The most common packaging program under Linux is tar, which is often referred to as the TAR package, and the tar package file commands are usually terminated with. Tar. After the tar package is generated, you can use other programs to compress it.

1. Command format:

tar[necessary parameters [selection parameters] [file]

2. Command function:

Used to compress and decompress files. The tar itself does not have compression capabilities. It is implemented by invoking the compression function

3. Command parameters:

The necessary parameters are as follows:

-A add compressed file to existing compression

-B Set Chunk size

-C Create a new compressed file

-D Record File differences

-R Add a file to a file that has been compressed

-u add changed and existing files to a compressed file that already exists

-X extracting files from compressed files

-T displays the contents of the compressed file

-Z Support gzip unzip files

-j Support bzip2 Extract files

-Z Support Compress unzip files

-V Show Operation procedure

-L File System boundary settings

-K Keep the original file without overwriting

-m reserved files are not overwritten

-W confirm the correctness of the compressed file

The optional parameters are as follows:

-B Set Number of blocks

-c switch to the specified directory

-f Specifies the compressed file

--HELP Display Help information

--version displaying version information

Three. Gzip is a simple and easy-to-use command for compressing and decompressing files that is often used in Linux systems. Gzip not only compresses large, less-used files to conserve disk space, but also, together with the TAR commands, forms the most popular compressed file format in the Linux operating system. According to statistics, the gzip command has a 60%~70% compression rate for text files.

1. Command format:

gzip[parameters [file or directory]

2. Command function:

Gzip is a widely used compression program, after which the file is compressed, and its name is followed by a ". gz" extension.

3. Command parameters:

-A or--ASCII use ASCII text mode.

-C or--stdout or--to-stdout the compressed file output to the standard output device, not to change the original file.

-D or--decompress or----uncompress unpack the compressed file.

-F or--force forcibly compress the file. Ignores the existence of a file name or a hard connection and whether the file is a symbolic connection.

-H or--help online Help.

-L or--list lists information about the compressed file.

-L or--license display version and copyright information.

The original file name and time stamp are not saved when the file is compressed by-N or--no-name.

-N or--name compress the file, save the original file name and time stamp.

-Q or--quiet does not display a warning message.

-R or--recursive recursively handles all files and subdirectories under the specified directory.

-s< compress the tail string > or----suffix< compress the tail string > change the compressed Word tail string.

-T or--test tests whether the compressed file is correct.

-V or--verbose shows the instruction execution process.

-V or--version displays version information.

-num adjusts the speed of compression with the specified number num,-1 or--fast represents the fastest compression method (low compression ratio), 9 or--best represents the slowest compression method (high compression ratio). The system default value is 6.

Four. The VIM command collection is not guaranteed to be accurate and is for reference only and verification.

Five. Waiting to be added ...

Resources

1. Http://www.cnblogs.com/linhaifeng/articles/6045600.html#_label9

2. http://www.cnblogs.com/peida/tag/%E6%AF%8F%E6%97%A5%E4%B8%80linux%E5%91%BD%E4%BB%A4/default.html?page=1

3. http://www.cnblogs.com/softwaretesting/archive/2011/07/12/2104435.html

Linux Basics Command Practice DAY3

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.