This question already has an answer here:

Is some kind of signal emitted when an earphone/headphone is plugged in? I want detect when they are plugged in and run a script accordingly.

marked as duplicate by Jakuje, don_crissti, EightBitTony, Archemar, roaima Mar 12 '16 at 17:42

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • You used confusing tags. Which are you running? debian, ubuntu, or lubuntu? – Seth Mar 12 '16 at 15:58
  • @Seth It should work with any Linux version I guess. – ott-- Mar 12 '16 at 16:09
  • It depends on what Linux distribution you're using, and what type of hardware you are running it on. – Interesting... Mar 12 '16 at 16:22
  • Hi, yes it should work on all distros. I tried the solution given in the question of which this is a duplicate. i.e. if fired the command cat /proc/asound/card0/codec#0 However, the command shows no difference between the outputs when the headphone is connected to the jack and when it's not. I even did a "diff" between the two outputs to be sure. What could be the problem? (commenting here as I don't have reputation enough to comment there) – RodrikTheReader Mar 15 '16 at 2:01

Browse other questions tagged or ask your own question.