Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #171780

Re: How to forcibly abort a command in a terminal window?

From Nicolas George <george@nsup.org>
Newsgroups linux.debian.user
Subject Re: How to forcibly abort a command in a terminal window?
Date 2016-09-05 17:20 +0200
Message-ID <se3QJ-5u6-1@gated-at.bofh.it> (permalink)
References (1 earlier) <se1ce-3Hh-21@gated-at.bofh.it> <se1YC-4eB-41@gated-at.bofh.it> <se2i3-4lH-13@gated-at.bofh.it> <se2L0-4LX-53@gated-at.bofh.it> <se3H4-5qz-41@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Le decadi 20 fructidor, an CCXXIV, Charlie Kravetz a écrit :
> I open a second terminal, then use ps -A to find the command. I can
> kill it with "sudo kill ????" which kills the job number. It is not
> always instant, but faster than ctrl-c for some things, including rsync
> and cp .

Not true.

The only difference between your method and kill is that kill will send
SIGTERM (number 15) by default while Ctrl-C sends SIGINT (number 3) by
default. But both have the same default action of interrupting the process.

cp does not handle signals explicitly, leaving them to their default
behaviour. rsync catches signals, but with the same handler for SIGINT and
SIGTERM. Therefore, the effect of Ctrl-C and kill on both is exactly the
same. The difference you observe is certainly only psychological.

Note that the same does not apply to "kill -9": SIGKILL, number 9, can not
be caught by processes. Yet, since cp does not catch signals, Ctrl-C, kill
or kill -9 will have the same effect. On rsync, "kill -9" will prevent it
from cleaning up temp files, which can be a life saver if you forgot the -P
option and already copied a big chunk of data over a slow link.

Also note that other applications may behave differently. I have noticed
that Python applications using Qt ignore SIGINT for no apparent reason
except annoy developers. Knowing ^\, i.e. SIGQUIT, is useful in that kind of
cases, even though this is not the purpose of SIGQUIT.

Regards,

-- 
  Nicolas George

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to forcibly abort a command in a terminal window? Richard Owlett <rowlett@cloud85.net> - 2016-09-05 13:50 +0200
  Re: How to forcibly abort a command in a terminal window? Henrique de Moraes Holschuh <hmh@debian.org> - 2016-09-05 14:30 +0200
    Re: How to forcibly abort a command in a terminal window? Richard Owlett <rowlett@cloud85.net> - 2016-09-05 15:20 +0200
      Re: How to forcibly abort a command in a terminal window? Jonathan Dowland <jmtd@debian.org> - 2016-09-05 15:40 +0200
        Re: How to forcibly abort a command in a terminal window? Richard Owlett <rowlett@cloud85.net> - 2016-09-05 16:10 +0200
          Re: How to forcibly abort a command in a terminal window? Charlie Kravetz <cjk@teamcharliesangels.com> - 2016-09-05 17:10 +0200
            Re: How to forcibly abort a command in a terminal window? Nicolas George <george@nsup.org> - 2016-09-05 17:20 +0200
              Re: How to forcibly abort a command in a terminal window? Dutch Ingraham <stoa@gmx.us> - 2016-09-05 18:20 +0200
                Re: How to forcibly abort a command in a terminal window? Nicolas George <george@nsup.org> - 2016-09-05 18:40 +0200
              Re: How to forcibly abort a command in a terminal window? Charlie Kravetz <cjk@teamcharliesangels.com> - 2016-09-05 18:30 +0200
                Re: How to forcibly abort a command in a terminal window? Vincent Lefevre <vincent@vinc17.net> - 2016-09-05 21:40 +0200

csiph-web