程序猿学英语-Linux的一些进程命令

1.11 Jobs and Processes

Each C program executable, when executed creates a process. Unix can maintain multiple processes at the same time. Each process is a job executed by the shell. To see what current jobs are running in your environment, we type

$ jobs -l 

To see what processes are running in the background of your environment, we type

$ ps
PID TTY          TIME CMD
2265 pts/0    00:00:01 bash
124554 pts/0    00:00:00 ps

Any process can be killed by using the command

$ kill PID --- PID is the process ID 

How to Killing a Process ?

It is very common that as we do programming assignments in this course, we run into situations where program does not terminate. This can be caused by an infinite loop or some weird behavior in the program. In such cases, we need to forcefully terminate the program by using

Control C
1、Ctrl + C
kills the foreground process. If you press (杀死前景进程。如果您按Ctrl + C)

2、Cntrl + Z
then the current process is placed in the background and shell returns a prompt. (然后,当前进程被放在后台,shell返回一个提示符。 )

3、fg
You can bring background processes to foreground by typing (您可以通过键入fg将后台进程带到前台 )

$ fg 

4、Or find the process ID using ps and kill the process.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

码农菌

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值