linux sigint_什么是Linux SIGINT(信号中断)?

linux  sigint

linux sigint

Operating systems like Linux and Windows uses signals in order to communicate with each other and other components. There are different signal types which define different case and message. In this tutorial, we will learn and explain the SIGINT or Signal Interrupt.

诸如Linux和Windows之类的操作系统使用信号来彼此通信以及与其他组件通信。 有不同的信号类型定义了不同的情况和消息。 在本教程中,我们将学习和解释SIGINT或信号中断。

SIGINT或信号中断 (SIGINT or Signal Interrupt)

As its name suggests the SIGINT is named as Signal Interrupt which will interrupt the command. This will interrupt the given processes and stop the process. Interrupt signal is depicted as  INTR.

顾名思义,SIGINT被命名为信号中断,它将中断命令。 这将中断给定的进程并停止该进程。 中断信号表示为INTR

发送SIGINT (Send SIGINT)

There are different ways to send the signal interrupt to the processes. We will use kill command which can send a different signal to the given processes. The SIGINT is numbered as  2 in kill command. So in the following example, we will send SIGINT to the process names firefox.

有多种方法可以将信号中断发送给进程。 我们将使用kill命令,该命令可以向给定进程发送不同的信号。 SIGINT在kill命令中编号为2 。 因此,在下面的示例中,我们将SIGINT发送到进程名称firefox

First, we will learn the process or job ID of the firefox with the pgrep command like below.

首先,我们将使用如下所示的pgrep命令来学习firefox的进程或作业ID。

$ pgrep firefox

Then we will use kill command to send SIGINT to the process 5042.

然后,我们将使用kill命令将SIGINT发送到进程5042

$ kill -2 5042

CTRL + C SIGINT (CTRL+C SIGINT)

As stated previously there are different way to send SIGINT signal. We can use keyboard combinations to send SIGINT to the active process. We will use  Control+C  or CTRL+C in the bash to the firefox process while it is running.

如前所述,有多种发送SIGINT信号的方法。 我们可以使用键盘组合将SIGINT发送到活动进程。 在firefox进程运行时,我们将在bash中使用Control + C或CTRL + C。

CTRL+C
CTRL+C SIGINT
CTRL+C SIGINT
CTRL + C SIGINT
LEARN MORE  What Is Interrupt (Computer)?
了解更多什么是中断(计算机)?

翻译自: https://www.poftut.com/what-is-linux-sigint-signal-interrupt/

linux sigint

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值