Linux-grep command Xiao Kee __linux

Source: Internet
Author: User

Analysis:

Kill-15 ' Ps-eaf | Grep-v grep | Grep-i NodeManager | awk ' {print $} '

The meaning of this line of code



1.

About grep:

The grep full name is global Regular Expression Print, which represents the global regular expression version, and its use permissions are all users.

Description: The grep directive is used to find files that contain the specified template style, and if the contents of a file are found to fit the specified template style, the preset grep instruction displays the column that contains the template style. If no file name is specified, or if the given file name is "-", the grep instruction reads the data from the standard input device.

-V Reverse lookup, then grep-v grep means that the rows containing grep characters are filtered out;

-I is case-insensitive, so grep-i NodeManager means: Find rows containing nodemanager;

2.

About awk:

Awk is a powerful text analysis tool that is particularly powerful when it comes to analyzing and generating reports on data, compared to grep lookup and sed editing. To put it simply, awk reads the file line by row, using a space as the default delimiter to slice each row, cut the section, and then perform various analytical processing.

The awk workflow is like this: reads a record with a ' \ n ' newline character split, then divides the record by the specified field delimiter, fills the field, and the $ $ in awk ' {print $n} ' represents all fields, representing the first field, $n representing the nth domain. The default Domain delimiter is the blank key or the [tab] key.

awk ' {print $} ' meaning: Print the second field of the found content;


3.

About PS:

-a displays all processes;

-e equivalent to-A, showing all processes;

-F is all listed, usually used in conjunction with other parameters;

Ps-eaf meaning: Show all processes;


4.

About Kill:

Kill-15 PID, 15 is the normal kill process, PID is the process number;

In Kill-9 PID,-9 is the mandatory kill process, PID is the process number;



In a comprehensive, code

Ps-eaf | Grep-v grep | Grep-i NodeManager | awk ' {print $} '

The meaning is:

Finds all processes with the string "NodeManager" and does not contain the string "grep" and prints the second field of the lookup result (that is, the PID of the process);

Kill-15 ' Ps-eaf | Grep-v grep | Grep-i NodeManager | awk ' {print $} '
The meaning: normal kill all with string "NodeManager" process;

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.