2

I would expect to see nothing in the 3rd command below, but clearly my expectations are incorrect. Why?

$ sudo fuser -v /dev/snd/*
                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  joeuser   2339 F.... pulseaudio
/dev/snd/controlC2:  joeuser   2339 F.... pulseaudio
/dev/snd/pcmC0D7p:   joeuser   2339 F...m pulseaudio
/dev/snd/pcmC2D0c:   joeuser   2339 F...m pulseaudio
/dev/snd/pcmC2D0p:   joeuser   2339 F...m pulseaudio
$ kill 2339
$ sudo fuser -v /dev/snd/*
                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  joeuser   2339 F.... pulseaudio
/dev/snd/controlC2:  joeuser   2339 F.... pulseaudio
/dev/snd/pcmC0D7p:   joeuser   2339 F...m pulseaudio
/dev/snd/pcmC2D0c:   joeuser   2339 F...m pulseaudio
/dev/snd/pcmC2D0p:   joeuser   2339 F...m pulseaudio
6

The kill command just sends a signal to the process, and the default signal (when you don't select one), is trapped by the process and maybe ignored or handled in some other way. Use signal -9 , which is the non-maskable signal, to ungracefully kill the process. You might check any documentation of the process to possibly find a signal which will tell the process to clean up and terminate, but -9 is the usual "just kill it" approach.


kill -9 2339

should kill it since you own the process. or from the names for the signals (list from kill -l)

kill SIGKILL 2339
| improve this answer | |
  • What exactly would the command using signal -9 be? – Al Lelopath Jul 14 at 15:34
2

While killing it with -9 (SIGKILL) will work, it wouldn't be my first choice. When faced with killing processes I'm not sure about, I do successive kills in this order:

  • kill -15 (SIGTERM) which is the default signal supplied when you don't supply the signal number. Programs are supposed to handle this signal and exit gracefully. Some don't.
  • kill -2 (SIGINT) is what the program would get if you typed in CTRL-C to interrupt it. Some programs that don't have a tty will still handle this.
  • kill -1 (SIGHUP) is what a process gets when you log off your terminal and the tty goes away. This is handled by more programs.
  • kill -9 (SIGKILL) is your last resort as it can't be handled. If your program uses the terminal in non-canonical mode, your terminal will not be reset, so your command line may be screwed up. A simple "stty sane ^j" (control-j to do a direct LF) should fix it back up.

Not all programs handle signals properly, and some will handle some signals but not others. I've found this way is the safest.

| improve this answer | |
  • The ncurses program reset does the same thing as stty sane ^J from coreutils, is usually also installed, and might be more convenient. – yyny Jul 15 at 9:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.