The Commands about the Processes

本文介绍了Linux环境下常用的进程管理命令,包括ps、top、jobs、bg、fg、kill、killall和shutdown等。通过这些命令可以查看系统进程状态、控制进程运行、发送信号给进程以及系统重启或关闭。同时,文章还解释了进程的工作原理及其内部结构。

Here will introduce some commands about the Processes:
● ps – Report a snapshot of current processes
● top – Display tasks
● jobs – List active jobs
● bg – Place a job in the background
● fg – Place a job in the foreground
● kill – Send a signal to a process
● killall – Kill processes by name
● shutdown – Shutdown or reboot the system

How a process work

When a system starts up,the kernel initiates a few of its own activities as processes and launches a program init(/etc/init),and the init will start all system services, and many of them are implemented as daemon process(sit in background and just do their own things without having any user interface).
A program can launch other programs is expressed in the process scheme as a parent process producing a child process.
Each process has a PID,the init always getting PID 1.

ps

ps
ps x ##will show all of our processes  no matter which terminal
ps aux ##will give us more information about the CPU/MEM usage,virtual memory size and so on.

top

top will give us dynamic view of the machine’s activities.

top

Controlling processes

jobs will list the jobs that have been launched from our terminal and every job has a number.
if you want to change a process from background to foreground,using fg,like:

fg %num     ##num is the number that the command of jobs shows

bg is similar

kill

kill is used to send signals to programs,the common pattern is like:

kill [-signal] PID

the signal introduces:
- 1:HUP,Hangup
- 2:INT,Interrupt,just like ctrl+c
- 9:KILL
- 15:TERM,Terminate
- 18:CONT,Continue
- 19:STOP

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值