#22 process, priority management commands: Vmstat, Pmap, Htop, glances, Dstat, Kill, Killall, Pkill, BG, FG, nice ...

Source: Internet
Author: User
Tags semaphore terminates pkill

Capable of communicating between processes; Ipc,inter-process communication

1.signal (signal)

2.semaphore (semaphore)

3.shared Memory (SHM)

4.socket


Valid signal representation method:

1. Use the digital code of the signal to represent it;

2. Use the full name of the signal to represent it;

3. Use the shorthand name of the signal to indicate that the short name is the rest of the "SIG" in the full name;


Commonly used signals:

1.SIGHUP: No need to close the corresponding process and let it re-read its own configuration file;

2.SIGINT: Terminates the running foreground process;

9.SIGKILL: No omen of termination of the running process, brutality;

15.SIGTERM: The default signal to terminate the running process;

18.SIGCONT: Let the back-end process continue to run;

19.SIGSTOP: Let the process into the background and stop running;


Process jobs:

Front Desk jobs:

Foreground job, through the terminal start and will always occupy the terminal process;


Background jobs:

Background job, can be started through the terminal, but immediately after the launch into the background to run, release terminal;


How to make a job work in the background:

1. Running the foreground job

CTRL + Z

Note: Actually sends the SIGSTOP signal to this process, causes the process to go back to the background to stop running;


2. The job has not been started, so that it starts and goes backstage;

# COMMAND &

Note: This type of job is started from the foreground and is immediately turned back into the background when started, but even so, this process is a terminal-related process, and if the terminal is closed, such processes will also be terminated;


3. The job has not been started, so that it starts and into the background, while stripping its association with the terminal;

# Nohup COMMAND &


To view information about a background job:

Jobs


Transfer background jobs to the foreground:

FG [JOB_ID]


Make background jobs run in the background

BG [job_id]


To terminate a background job:

Kill%job_id


Kill%1


To adjust the process priority level:

0-139

100-139


Use the Nice value to adjust the static priority of the process:

The value range for nice values is: -20~19

By default, the initial nice value for all user processes is 0; The default priority is 120;


Note: Only Superuser root can use the negative nice value to elevate the priority of the process, and normal users can only use the nice value to reduce the priority of the process;


Vmstat: Displays the virtual memory status ("Viryual memor Statics"), but it can report on the overall operating state of the system, such as process, memory, I/O, etc.


Its execution displays the result:

FIELD DESCRIPTION for VM MODE

Procs (Process)

R: The number of processes running in the queue, this value can also determine whether to increase the CPU. (longer than 1)

B: The number of processes waiting for IO.


Memory (RAM)

SWPD: Using virtual memory size, if the value of SWPD is not 0, but the value of Si,so is 0 for a long time, this situation does not affect system performance.

Free: The size of the idle physical memory.

Buff: The amount of memory used as a buffer.

Cache: As the memory size of the buffer, if the cache value is large, the number of files in the cache, if the frequently accessed files can be cached, then the disk read IO bi will be very small.

Inact: Inactive memory.

Active: Active memory.


Swap (virtual memory)

Si: Writes from the swap area to the memory size per second, and the disk is transferred into memory.

So: The amount of memory written to the swap area per second is transferred from memory to disk.


IO (read-write)

BI: Number of blocks read per second

Bo: Number of blocks written per second


System (Systems)

In: Number of interrupts per second, including clock interrupts.

CS: The number of context switches per second.


CPU (expressed as a percentage)

These is percentages of total CPU time.

US: Percentage of user Process Execution time

Sy: Percentage of kernel system Process Execution (System time)

ID: Percentage of idle time

Wa:io Wait Time percentage

ST: Virtual machine steal time percentage

Options:

-S: Information extracted from the/proc/meminfo file and processed and output;


Delay: Executes the vmstat command repeatedly according to the time indicated by Deley, the default unit is seconds;

Count: The number of times the V-mode tat command was repeatedly executed;

Example:

Vmstat


PMAP: The memory mapping relationship of the reporting process is a good tool for Linux debugging and operation.

Options:

-X,--extended: Display extended information

Example:

Pidof vim

3690

Pmap-x 3690


Htop: A monitoring software that can be viewed as an upgraded version of the top command.

Common options:

-D #:htop Refresh interval time;

-U USERNAME: Displays the process of the specified user;

-S Colume_name: Sorting according to the specified field;

Interactive commands:

L: Displays a list of files opened by the specified process;

T F5: Displays the process tree structure to show the parent-child relationship between processes;

A: Binds the selected process to a specified CPU core operation;

Example:

Htop


Glances: System real-time monitoring tool

Common options:

-B: Displays the data rate of the NIC in KByte;

-D: Turn off the disk I/O module;

-M: Close the Mount module;

-N: Close the network module;

-1: Separate display of data statistics for each CPU core;

-T #: Sets the refresh time interval;

-O {html| CSV}: Specifies the output format for the output data;

-f/path/to/output_dir: Specifies the path to the output file, glances.html


Glances can work in the C/S model;

S: Server Mode

Glances-s-B ipaddr

IPADDR: An IP address that is local to the server;


Capable of communicating between processes; Ipc,inter-process communication

1.signal

2.semaphore Semaphore

3.shared Memory (SHM)

4.socket

Example:

Glances


Dstat: Universal System Information statistics tool.

Common options:

-c,--cup: Displaying CPU-related information

-d,--disk: Displays disk-related information;

-g,--page: Display page related information;

-N,--Net: Displays information related to interface;

-y,--sys: Real-world information related to the system;

--TPC: Displays information about the status of the TCP connection;

--UDP: Displays information about the UDP connection;

--IPC:

--raw:

--socket:

--TOP-CPU: Displays the process that accounts for the most CPU resources;

--top-io: Shows the process that most consumes IO;

Example:

Dstat


Kill: Used to delete a program or work in execution.

Common options:

-L < information number;: If the < information number > option is not added, the-l parameter lists all information names;

Example:

Kill-l (view signal information)

Valid signal representation method:

1. Use the digital code of the signal to represent it;

2. Use the full name of the signal to represent it;

3. Use the shorthand name of the signal to indicate that the short name is the rest of the "SIG" in the full name;


Commonly used signals:

1.SIGHUP: No need to close the corresponding process and let it re-read its own configuration file;

2.SIGINT: Terminates the running foreground process;

9.SIGKILL: No omen of termination of the running process, brutality;

15.SIGTERM: The default signal to terminate the running process;

18.SIGCONT: Let the back-end process continue to run;

19.SIGSTOP: Let the process into the background and stop running;


Killall: Kills a process by using the name of the process

Options:

-e: Exact matching of long names;

-L: Ignoring the difference in case;

-P: Kills the process group to which the process belongs;

-I: Interactive kill process, need to confirm before killing process;

-L: Prints a list of all known signals;

-Q: If no process is killed. does not output any information;

-R: Use regular expressions to match the name of the process to be killed;

-S: Replaces the default signal "SIGTERM" with the specified process number;

-U: Kills the process of the specified user.

Example:

Killall VI


Pkill: The process terminates according to pattern, it is possible to injure other procedures;

Options:

-O: Sends a signal only to the smallest (starting) process number found;

-N: Sends a signal only to the largest (end) process number found;

-P: Specifies the parent process number to send the signal;

-G: Specifies the process group;

-T: Specifies the terminal on which the process is opened.

Example:

Pkill vim


Jobs: Used to display the Task List and task status in Linux, including tasks that run in the background.

Options:

-L: Displays the process number;

-P: The display process number corresponding to the task only;

-N: Shows the change of task status;

-r: Output only the running state (running) task;

-S: Outputs only the task of the Stop State (stoped).

Example:

Find/-name Password &

Jobs-l (Displays the task list for the current system)

Note: To obtain the above output information, you must execute the command before executing the jobs command find/-name password &. Otherwise, the Execute Jobs command does not display any information.


BG: Used to put jobs in the background to run, so that the foreground can perform other tasks.

Example:

BG 1 (Background task with task number 1)

Find/-name Password & (background perform task)

Note: In effect, the use of the BG command is the same as adding the symbol "&" after the instruction. For example, use & to place the Find/-name password in the background execution


FG: Used to put background jobs (jobs that are running in the background or suspended in the background) to the foreground terminal to run.

Example:

FG 1 (convert task to foreground execution)

Find/-name password (foreground execution command)


Nice: Used to start other programs with the specified process scheduling priority.

Options:

-N Nice: Specify nice values

Example:

Nice-19 tar zcf pack.tar.gz documents


Renice: Modifies its nice value for a process that has already started;

Options:

-N Nice: Adjusts the priority of the specified process, on the basis of the original nice value, plus the nice value specified here;

-G: Specifies the process group ID;

-p< Program Identification code: Change the priority level of the program, this parameter is a preset value.

-U: Specifies the user name of the open process.

Example:

Renice 1 987-u Daemon root-p 32 (Stroke ID 987 and 32 for travel and itinerary owner is daemon and root priority number plus 1)


#22 process, priority management commands: Vmstat, Pmap, Htop, glances, Dstat, Kill, Killall, Pkill, BG, FG, nice ...

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.