🐧 What does kill %1 do

🐧 What does kill %1 do

It means to kill job number 1, not process number one.

$ kill %1

Jobs can be listed with the jobs command.

More broadly, it relates to whichever shell you are using, and the syntax could differ from shell to shell.

Using the bash shell, a user can have several processes (jobs) executing simultaneously, whose parent process is the shell you are using. Google bash job control basics

The builtin kill command is used to send a signal to one of those job pipelines. If the specific signal is not specified, SIGTERM is used, which typically ends (kills) the job, hence the name kill. But any signal can be specified some of which might somehow reset the process or cause non-killing behavior.

Finally, the %1 is one way (of many!) of specifying which job you wish to send the signal to. %1 refers to the job on top of the stack of background jobs.

Stefan Pejcic
Join the discussion

I enjoy constructive responses and professional comments to my posts, and invite anyone to comment or link to my site.