12 Process Management Commands introduced

Source: Internet
Author: User
Tags pkill
The procedure in progress is called a process. When a program is stored in an executable file and runs, each process is dynamically assigned system resources, memory, security attributes, and the state associated with it. Multiple processes can be associated to the same program, and simultaneous execution does not interfere with each other. The operating system effectively manages and tracks all running processes. In order to manage these processes, the user should be able to: L View all running processes L View process consumption resources L locate individual processes and perform specified actions on them L change the priority of the process L kill the specified process L limit the system resources available to the process Linux provides many commands to enable users to control the above operations efficiently. Next, one by one to explain the next.1. PS' PS ' is a command of the most basic browsing process in Linux. Can list the processes running in the system, including process numbers, commands, CPU usage, memory usage, and so on.  The following options give you more useful information. PS-A-List all running/activating processes Ps-ef |grep-list required process Ps-aux-displays process information, including non-terminal (x) and process for User (U): such as user, PID,%cpu,%MEM, etc.2. PstreelinuxIn Linux, each process is created by its parent process. This command displays the process visually, showing the process's tree graph to show the inter-process relationships. If PID is specified, then the root of the tree is the PID, otherwise it will be init (pid:1).3.top' Top ' is a more useful command to monitor the resources used by different processes in the system. It provides real-time system status information. Data that shows the process includes PID, process owner, priority,%CPU,%memory, and so on. You can use these displays to indicate the amount of resource usage.4.htopHtop is similar to top, but Htop is the interactive text-mode Process viewer. It graphically displays the CPU and memory usage and swap usage of each process in a text format. Use the up and down cursor keys to select the process, F7 and F8 change the priority, F9 kill the process. Htop is not installed by default, so additional installation is required.5.niceWith the help of the Nice command, the user can set and change the priority of the process. To increase the priority of a process, the kernel allocates more CPU time slices to the process. By default, the process starts with a priority of 0.  The process priority can be viewed by the NI (nice value) column displayed by the top command. The process priority values range from 20 to 19.  The lower the value, the higher the priority. Nice <优先值> <进程名> -Start a program with a given priority value 6.reniceThe Renice command resembles the nice command. Use this command to change the running process priority value.  Note that users can only change the priority values of their own processes. Renice-n-P-Change the priority value of the specified process Renice-u-G-Change the process priority value by specifying users and groups 7.killThis command is used to send a signal to end the process. If a process does not respond to the KILL command, this may need to be forced to kill, using the-9 parameter to execute. Note that use forced kill must be careful, because the process does not have the opportunity to clean up the scene, perhaps the write file is not completed.  Killall can come in handy if we don't know the process pid or if we're going to kill the process with a name. Kill Kill-9 killall-9-kill all processes that have the same name if you use Kill, you need to know the process ID number.  Pkill is a similar command, but uses pattern matching, such as process name, process owner, and so on. Pkill <进程名> 8.ulimitThis command is used to control the amount of system resources allocated on the shell and process. It is most useful for system administrators to manage systems that are heavily used and have performance issues.  Restricting resource size ensures that important processes continue to run, and other processes do not consume excessive resources. Ulimit-a-Displays the resource limits associated with the current user 9.WW provides information about the currently logged on user and the process that is being executed.  The information header contains information such as the current time, the system runtime, the total number of logged on users, the last 1, 5, and 15 minutes of load balancing. Based on these user information, users should be careful when terminating processes that do not belong to them. W.H.O.is a similar command that provides a list of currently logged-in users, system boot time, RunLevel, and so on. WhoAmICommand output current User ID 10.pgrepPgrep means "process number global regular match output". This command scans the current running process and then lists the matching results to standard output according to the command matching criteria.  It is useful for retrieving process numbers by name. Pgrep-u Mint sh This command will display the process ID of the user as ' mint ' and process name ' sh '. 11.FG, BGSometimes, the command takes a long time to complete.  In this case, we use the ' BG ' command to perform the task in the background, while the ' FG ' can be transferred to the foreground for use. We can start a program in the background through ' & ': Find.  -name *iso >/tmp/res.txt& A running program can also be run in the background with the "CTRL + Z" and "BG" command combination. Find.  -name *iso >/tmp/res.txt &-Start a program CTRL + Z-suspend current executor BG-put the program in the background we can use the ' Jobs ' command to list all background processes. Jobs uses the ' FG ' command to move background programs to the foreground. FG% Process ID 12.ipcsThe IPCS command reports inter-process communication facility status.  (Shared memory, semaphore, and Message Queuing) are used with the-p parameter federated-M,-s, or-Q to obtain the process ID of the related interprocess communication. Ipcs-p-m lists the ID and process ID of the creator of the process that recently accessed the shared memory segment. In summary, these commands can help administrators fix problems and improve performance. Also, as an ordinary user, there is a need to solve the problem of the process. So, being familiar with so many commands, from being able to manage processes effectively is effective. Free pick up the lamp brother even original Linux OPS engineer video/Detailed Linux tutorials, details Inquiries official website customer service: http://www.lampbrother.net/linux/
  • 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.