LInux Program Management Command Chapter

Source: Internet
Author: User
Tags cpu usage

    • Work Management
& at the end of the command, you can add the command to the background [ctrl]-z the current job into the background "pause" jobs view the current background of the work status

Jobs "Parameters"

Parameters:

-L: List PID numbers in addition to the jobs number and command string

-R: Lists only the work being run in the background

-S: Lists only the work that is paused in the background

FG backstage work get the front desk to handle

Example: FG%number

BG makes the work in the background become operational

Example: BG%number

Work in Kill management background

Parameters

-L: Lowercase L, which lists the current signals that kill can use

Signal: What instructions are represented to the back of the work

-1: Re-read the configuration file of the parameter once

-2: And keyboard [ctrl]-c the same operation

-9: Force deletion of a job immediately

-15: Terminating a job in a normal program manner

Example 1:kill-9 23134 #结束 The process of PID number 23134

Example 2:kill-9%2 #这里的%2 is a job with number 2 in jobs

Offline management

Nohup Working offline-------screen-like programs

Nohup "command or execute file" = = "working in the foreground

Nohup "command or Execute file" & = = "Working in the background"

    • Process Management
PS Select the process run at a point in time

PS "Parameters"

Parameters:

-A: All processes are displayed with the same effect as-e;

-A: All processes not related to terminal;

-U: Effective user-related processes;

X: Lists the more complete information, which is generally used in conjunction with a parameter;

Output format planning:

L: A longer, more detailed list of the PID information;

J: The format of the work;

-F: Make a more complete output;

The usual command

Ps-l only view your bash-related processes

PS aux view system left and right process

PS AXJF together with some process tree states

Pstree Select the process runtime at a point in time to represent it as a process tree

Pstree "-a| U ""-up "

Parameters:

-A: The process tree link is linked in ASCII characters;

-U: Process tree link is represented by UTF-8 code

-P: Simultaneously lists the PID for each process

-U: Also lists the account name of each process

Top Dynamic viewing process changes

Top "-D number" | Top "-BNP"

Parameters:

-D: Number of seconds after

-B: Perform top in batches, usually with data flow redirection

-N: Paired with-B, meaning that a few top outputs are required

-P: Specify some PID for monitoring

Key commands that can be used under the top execution screen:

? : Displays key commands that can be entered

P: Sort display with CPU usage resources (default)

M: The use of memory resources to sort the display;

N: Sort by PID

T: Cumulative sort of CPU time used by the process

K: Give a signal to a PID (signal)

R: Give a certain PID a nice value to re-establish

Q: Leave top

    • Order of execution of the process
The PRI value of the process can be viewed by ps-l or by other commands, and the smaller the lower the precedence of the execution of the PRI + nice = value The smaller the less the more limited the Execute nice execute command give new value

Nice "-N value" command

Parameters:

-N: followed by a value, worth range-20 ~ 19

Root user can give negative value, normal user can only give positive value

Renice The nice readjustment of the existing process

Renice "Number" PID

    • View of system resources
Free to view memory usage

Free "-b|-k|-m|-g" "-t"

Parameters:

-B: Unit. Shown in bytes, K--kb, M---MB, g---GB

-T: Displays the total amount of physical memory and swap in the final result of the output

Uname viewing system and kernel-related information

Uname "-asrmpi"

Parameters:

-A: All system-related information

-S: System kernel Name

-R: Kernel version

-M: System hardware Name

Types of-P:CPU

-I: Hardware platform

Uptime viewing system boot times and workloads

Direct uptime

Netstat Tracking network

Netstat-"ATUNLP"

Parameters:

-A: List all the links, monitoring, and socket data for the current system.

-T: List data for TCP network packets

-U: Lists data for UPD network packets

-N: The service name of the process is not listed and is displayed as a port number

-L: List the services currently being monitored by the network

-P: Lists the process PID for the network service

NETSTAT-TLNP Find the network link and IP that are currently listening

DMESG Analyzing kernel information

Vmstat Detection System Resource change

Vmstat "-A" "delay" total number of detections "" Memory/cpu Information

Vmstat "-fs" memory-related

Vmstat "-S units" sets the units that display the data

Vmstat "-D" disk-related

Vmstat "-P partition" disk related

Parameters:

-A: Memory output information

-F: The number of processes that the system has copied "fork" so far

-S: Description of memory changes caused by some time (boot to date)

-S: After the unit, let the displayed data have units, such as k/m/g

-D: Lists the total amount of disk read and write

-P: Partitions are listed later, which can be used to read and write total statistics of the partition

Example: Vmstat 1 3 Statistics Cup information, once per second, a total of three times

    • Querying open files or open files for executed programs
Fuser a file (or file system) to find the program that is using the file

Fuser "-umv" "-K" I ""-signal "" File/dir

Parameters:

-U: Lists the owner of the process in addition to the PID of the process

-M: The file name next to it will actively refer to the top layer of the filesystem, which is not successful for Umount

-V: Lists the integrity of each file and program and command

-K: Find the PID using the file/directory and try to give the PID a signal with SIGKILL

-I: Must be combined with-K to ask the user for a preference before removing the PID

-signal: For example-1-15 does not add default (-9)

Example: Fuser-uv. Find out the current directory Usage Pid/account/Permissions

Lsof lists the file names opened by the process

Lsof "-auu" "+d"

Parameters:

-A: Multiple data needs "peer set up" to show results

-U: Lists only the socket file types of the Unix like system

-u: followed by username, which lists files opened by the user-related process

+d: Follow the directory, that is, to find the file that has been opened under a directory

Example: Lsof-u root-a-U only lists the socket files opened for all processes on root

Example: lsof +d/dev lists all the peripherals that were started on the system

Pidof to find the PID of an executing process

Pidog "-SX] program_name

Parameters:

-S: Only one PID is listed and not all PID

-X: The process PID that lists the possible PPID of the program_name

LInux Program Management Command Chapter

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.