Linux Common Command Collection

Source: Internet
Author: User

Linux Common commands: If, for, which, PS, grep, Netstat, lsof, head, tail, sed, awk, cut, Sort, uniq, Dos2unix, find, Xargs, kill)


First, Linux view memory/cpu the highest process situation (note: You can use the command to check the memory of the top 10 processes)


1. View the processes that occupy the highest CPU

PS Aux|head-1;ps aux|grep-v pid|sort-rn-k +3|head


2. View the most memory-intensive processes

PS Aux|head-1;ps aux|grep-v pid|sort-rn-k +4|head


Comments:

This combination of commands is actually the following two lines of command:

PS Aux|head-1

PS Aux|grep-v pid|sort-rn-k +3|head

The first sentence is primarily to get the title (USER PID%cpu%MEM VSZ RSS TTY STAT START time COMMAND).

The next grep-v PID is to remove the title of the PS aux command, that is, grep does not contain the three-letter combination of the PID line, and then the result is sorted using sort.

Sort-rn-k +3 the-rn R in this command is ordered in reverse order, n is sorted by numeric size, and-K +3 is sorted for the contents of column 3rd, and the first 10 rows of data are obtained by using the Head command. (where | represents a pipeline operation)


Supplemental: Content Interpretation

PID: ID of the process

USER: Process Owner

PR: The priority level of the process, the smaller the higher the priority is executed

Ninice: Value

VIRT: Virtual memory consumed by the process

RES: The physical memory occupied by the process

SHR: Shared memory used by the process

S: The state of the process. s for hibernation, R for running, Z for Zombie, n for the process priority value is negative

%CPU: Process Consuming CPU utilization

%MEM: The percentage of physical memory and total memory used by the process

Time+: The total CPU time that is consumed after the process is started, which is the cumulative value of the CPU usage time.

Command: Process start name


Second, the Linux grep command-find multiple conditions

Example: Grep-e "ipaddr| HWADDR "


Linux Common Command Collection

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.