Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the skill command in Linux

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly shows you "how to use the skill command in Linux". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn how to use the skill command in Linux.

The Linux common command skill command is used to signal the selected process and freeze the process. This command is not commonly used by beginners and may be used after it involves system service optimization.

Skill sends a signal to the selected process to freeze the process

Syntax skill (option) option-f: fast mode;-I: interactive mode, each operation needs to be confirmed;-v: redundancy mode;-w: activation mode;-V: display version number;-t: specify the terminal number to start the process;-u: specify the user to start the process;-p: specify the id number of the process;-c: specify the instruction name to start the process. Instance what if you find a process that takes up a lot of CPU and memory but don't want to stop it? Consider the following top command output:

Top-c-p 23:00:44 up 12 days, 2:04, 4 users, load average: 0.47,0.35,0.31 1 processes: 1 sleeping, 0 running, 0 zombie, 0 stopped CPU states: cpu user nice system irq softirq iowait idle total 0.06% 8.7% 2.2% 0.0% 88.3% 0.0% Mem: 1026912k av, 1010476k used, 16436k free 0k shrd, 52128k buff 766724k actv, 143128k in_d, 14264k in_c Swap: 204119k av, 83160k used, 1958032k free 799432k cached PID USER PRI NI SIZE RSS SHARE stat% CPU% MEM time CPU command 16514 oracle 19 4 28796 26M 20252 D N 7.02.5 0:03 0 oraclePRODB2... Now that you confirm that process 16514 takes up a lot of memory, you can use the skill command to "freeze" it instead of stopping it.

After skill-STOP 1, check the top output:

23:01:11 up 12 days, 2:05, 4 users, load average: 1.20,0.54,0.38 1 processes: 0 sleeping, 0 running, 0 zombie, 1 stopped CPU states: cpu user nice system irq softirq iowait idle total 2.3% 0.03% 0.03% 0.03% 94.8% Mem: 1026912k av, 1008756k used, 18156k free, 0k shrd 3976k buff 770024k actv, 143496k in_d, 12876k in_c Swap: 204119k av, 83152k used, 1958040k free 851200k cached PID USER PRI NI SIZE RSS SHARE STAT% CPU% MEM TIME CPU COMMAND 16514 oracle 19 4 28796 26M 20252 T N 0.02.5 0:04 0 oraclePRODB2... Now, CPU has gone from 0% idle to 94% idle. The process has been effectively frozen. After a while, you may want to wake up the process:

Skill-CONT 16514 is useful if you want to temporarily freeze processes to make room for more important processes to complete.

This command has a wide range of uses. If you want to stop all processes for the "oracle" user, you only need one command to do this:

Skill-STOP oracle can take a user, PID, command, or terminal id as a parameter. The following command stops all rman commands.

Skill-STOP rman as you can see, skill determines the parameters you enter (process ID, user ID, or command) and acts accordingly. This can lead to problems in some cases where you may have users and commands with the same name. The best example is the "oracle" process, which is usually run by the user "oracle". Therefore, when you want to stop the process named "oracle", you can execute the following command:

All processes for the skill-STOP oracle user "oracle" are stopped, including sessions that you may want to use. To execute the command very explicitly, you can choose to use a new parameter to specify the type of the parameter. To stop a command named oracle, execute the following command:

The skill-STOP-c oraclesnice command functions like skill. But it is used to lower the priority of the process, not to stop the process. First, check the top output:

PID USER PRI NI SIZE RSS SHARE STAT% CPU% MEM TIME CPU COMMAND 3 root 1500 00 RW 0.0 0:00 0 kapmd 13680 oracle 150 11336 10M 8820 T 0.01.0 0:00 0 oracle 13683 oracle 150 9972 9608 7788 T 0.00.9 0:00 0 oracle 13686 oracle 150 9860 9496 7676 T 0.00.9 0 Oracle 13689 oracle 150 10004 9640 7820 T 0.00.9 0:00 0 oracle 13695 oracle 150 9984 9620 7800 T 0.00.9 0:00 0 oracle 13698 oracle 150 10064 9700 7884 T 0.00.9 0:00 0 oracle 13701 oracle 15022204 21M 16940 T 0.02.1 0:00 0 oracle now Lower the priority of the oracle process by four points. Note that the higher the value, the lower the priority.

Snice + 4-u oracle PID USER PRI NI SIZE RSS SHARE STAT% CPU% MEM TIME CPU COMMAND 16894 oracle 20 4 38904 32M 26248 D N 5.5 3.2 0:01 0 oracle notice that the NI column (nice value) is now 4 and the priority is now set to 20 instead of 15. This is very helpful for lowering priorities.

The above is all the contents of the article "how to use skill commands in Linux". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report