Summary of common Linux commands (OD/CUT/WC/DD/diff/uniq/Nice/du)

Source: Internet
Author: User

The "OD" command is often used to show the content of a special file:

Command name: OD

Signature method: od [-abcdfhilovx] [-A <font base>] [-j <Character Count>] [-n <Character Count>] [-S <string Character Count>] [- T <output format>] [-W <number of characters in each column>] [-- help] [-- version] [file...]

Description: displays the file content in the specified mode (the implied content is displayed in octal format ). For specific application examples, view them by 'man OD '.

PS: hexdump is the command for checking the file content according to the hex mechanism. And OD is exactly the zookeeper of octal dump.

Run the WC command to generate the text content statistics:

Command name: WC

Encryption Method: WC [CLW] File

Description: calculates the number of words, words, and rows according to different options. For specific application examples, refer to 'man WC.

Example: count the number of objects in the current directory. Run the LS-L | WC-l command.

PS: the number of workers in this command is less than that of others. Some people have used the WC function in the C language. You can also use the WC function!

Use the sort command to sort the text content:

Command name: Sort

Signature method: sort [-bcdfimmnr] [-O <output file>] [-T <delimiter>] [+ <start column>-<End column>] [-- help] [-- verison] [file]

Select manual solution: (for more information, please manually use man sort)

-N: sort by number.

-R: sort in descending order

-U: Remove repeated bytes

Use the uniq command to repeat the text to view and divide the distinct columns:

Command name: uniq

Encoding method: uniq [Option] File

Description: Describes some features of a text row.

Select solution example: (for more information, see man uniq)

-C: the number of times that the row has been added at the beginning of the row.

-D: only duplicate rows are displayed.

-U: indicates the rows that are not repeated.

Use the diff command to perform the following operations on text:

Command name: Diff

Partition Method: Diff [Optional] file1 file2

Note: Diff performs the same operation on two files row by row.

Selection and solution: (for more information, please use man diff)

-I: Ignore the variance of the shard size

-B: Ignore the difference between spaces.

Use the du command to estimate the size of the disk space used by the project or file volume:

Command name: Du

Comment Method: Du [Optional] contents or files

Selection and solution: (for more information, please use Man Du)

-K/M/G: The size is measured in KB, MB, and GB.

Du-S | sort-n lists the maximum number of entries in the queue Space

-SH: only view the specified category, but not the sub-category.

Use the cut command to extract the desired data:

Command name cut

Cut [select] File

Usage description:

-B: Truncated characters

-C: Truncated characters

Cut-c1-15 indicates intercepting content from the first column to the 15 Columns

Cut-c1-4, 8-indicates to intercept the content of 1 to 4 columns, but also from the eighth column to the last content

-F: truncates fields.

Cut-F1-d': 'indicates to intercept the first column, which is truncated using the separator:

Cut-F1--s: the delimiter used to intercept text separated by tab labels.

PS: When intercepting Chinese characters, note that Chinese characters are grouped into two English characters.

Run the DD command to restore the magnetic resonance speed and create a new file:

Command name: dd

Command Description: Copy data from a specified location to a specified outbound location

Application Example: BS specifies the volume size of each operation and count specifies the number of times of the operation.

Create a file of 2 MB.

# Dd If =/dev/Zero of =/home/test/2m.txt BS = 1024 COUNT = 2048

In the same way, Zookeeper's magnetic compaction speed

# Dd If =/dev/Zero of =/home/rwspeed. Ret BS = 1024 COUNT = 1048576

Zookeeper replica System

# Dd If =/home/test/my_fiter of =/ BS = 512 COUNT = 256

PS: the command for creating a specified size file is also available in Windows flat, which is fsutil.

Use nice command to completeProgramThe primary key of the primary key is as follows:

Command name nice

Instructions: Explain the progress scheduler first

Application Example: the starting time of the Linux Process is from-20 ~ + 20, the smaller the number, the higher the timeout, that is, the more time the slave uses the CPU.

In normal use, the program can only be downgraded first, while in root use, the program can be upgraded/downgraded first.

# Nice to view the default primary key

# Nice./A. Out, add 10 extra threads to A. Out, that is, allocate less CPU time.

# Nice-n-20 A. out is the highest priority in the. Out cursor row.

There are a lot of commands on Unix/Linux, which is the result of the wisdom of countless hackers and programmers around the world.

Familiar with the commands provided by the system, it is often more than half the effort. Only a few copies are listed here,

For other commands, you can refer to the website introduction, or refer to the example of this introduction.

Exam Website:Http://www.linuxso.com/command/

 

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.