this post was submitted on 01 Sep 2024
370 points (95.3% liked)

linuxmemes

21211 readers
119 users here now

Hint: :q!


Sister communities:


Community rules (click to expand)

1. Follow the site-wide rules

2. Be civil
  • Understand the difference between a joke and an insult.
  • Do not harrass or attack members of the community for any reason.
  • Leave remarks of "peasantry" to the PCMR community. If you dislike an OS/service/application, attack the thing you dislike, not the individuals who use it. Some people may not have a choice.
  • Bigotry will not be tolerated.
  • These rules are somewhat loosened when the subject is a public figure. Still, do not attack their person or incite harrassment.
  • 3. Post Linux-related content
  • Including Unix and BSD.
  • Non-Linux content is acceptable as long as it makes a reference to Linux. For example, the poorly made mockery of sudo in Windows.
  • No porn. Even if you watch it on a Linux machine.
  • 4. No recent reposts
  • Everybody uses Arch btw, can't quit Vim, and wants to interject for a moment. You can stop now.

  • Please report posts and comments that break these rules!

    founded 1 year ago
    MODERATORS
    all 43 comments
    sorted by: hot top controversial new old
    [–] palordrolap@fedia.io 99 points 2 months ago (2 children)

    Linux has at least four levels of decreasing pleasantry: -1, -2, -15, and -9, aka HangUP, INTerrupt, TERMinate and KILL or "Please stop", "Hey! Quit it!", "Stop it! NOW!" and *loud gunshot*.

    Sometimes processes will clean up after themselves and leave when asked nicely. Or sternly told off. Of course, if you don't need or want that, load up your, uh, -9 shooter.

    [–] Fillicia@sh.itjust.works 42 points 2 months ago (2 children)

    To be fair, even in Linux it's really hard to kill a zombie process. You have to tell the parent to own up to their kid, and then kill the parent.

    [–] palordrolap@fedia.io 12 points 2 months ago

    You can try asking a process to round up its dead children, but unlike the quit signals, the number varies by platform. For most Linux users it's -17, but using the text version -CHLD is probably a better choice (unless you're on a really old system that absolutely has to have a number, in which case check the local documentation.)

    If it's a well-behaved process, that can do away with the need to kill it. In other cases, there might be some kind of restart mechanism built in that can be called instead - assuming sending it a SIGCHLD doesn't trigger that behaviour anyway.

    Case in point, the Cinnamon DE has at least a couple of ways to restart it, and at least one of those gets rid of its zombie child processes. It's fairly rare that I need to do that, and I haven't tried sending it a -17. I might do at some point.

    [–] cley_faye@lemmy.world 3 points 2 months ago

    "Stalled I/O" has entered the process list :D

    [–] JackGreenEarth@lemm.ee 14 points 2 months ago (1 children)

    Why did I hear Viva La Dirt League in your

    "Please stop", "Hey! Quit it!"

    I totally read that in Adam's voice

    [–] palordrolap@fedia.io 2 points 2 months ago

    I think I've seen a couple of their videos, and have no idea which of them Adam would be (can't even call any faces to mind right now to be fair), so I'm pretty sure those phrases are in my head from elsewhere.

    The "Please stop" is pretty generic, but got a lot of traction that time Hyperbole and a Half told a story involving it. "Hey! Quit it!" is probably Lisa or Bart from some episode of The Simpsons. "Stop it! NOW!" is probably something that was actually said to me at some point as a kid.

    Never got shot though, so I must have started behaving at that point.

    (For legal reasons, that last part is meant to be tongue-in-cheek. I am also using "for legal reasons" mostly humorously. Mostly.)

    [–] mlfh@lemmy.ml 60 points 2 months ago (2 children)
    [–] azertyfun@sh.itjust.works 25 points 2 months ago

    ls -l /proc/xxx/{fd,syscall}

    Camera pans down to resource locks hiding under the floorboards

    [–] possiblylinux127@lemmy.zip 14 points 2 months ago

    I'll only been able to kill init once

    [–] lemmyvore@feddit.nl 43 points 2 months ago (3 children)

    I mean, the process is not dying in either gif, so...

    [–] stupidcasey@lemmy.world 30 points 2 months ago (2 children)

    Tap for spoilerIRON MAN dies dude….

    [–] bobs_monkey@lemm.ee 9 points 2 months ago (3 children)

    Is it really a spoiler if it's been 5 years?

    [–] stupidcasey@lemmy.world 14 points 2 months ago

    Tap for spoiler

    spoiler Tap for spoiler

    Tap for spoiler

    spoiler Tap for spoiler It’s Been 5 Years. :::

    :::

    :::

    :::

    [–] SpaceNoodle@lemmy.world 8 points 2 months ago (2 children)

    Bruce Willis was dead the whole time

    [–] icerunner_origin@startrek.website 3 points 2 months ago* (last edited 2 months ago) (1 children)

    Explains the wooden acting in Hudson Hawn

    • Edit: I'm leaving the typo because it's funnier than the film
    [–] SpaceNoodle@lemmy.world 2 points 2 months ago

    *Goldie Hahn

    [–] lemmyvore@feddit.nl 2 points 2 months ago

    Jesus gets crucified.

    [–] corsicanguppy@lemmy.ca 1 points 2 months ago

    STILL TOO SOON !! ;-)

    [–] acockworkorange@mander.xyz 5 points 2 months ago

    Not in that scene, thought.

    [–] mvirts@lemmy.world 5 points 2 months ago

    Accurate. Zombie tasks continue to haunt me to this day.

    [–] QuazarOmega@lemy.lol 5 points 2 months ago

    Bro thought SIGTERM was enough

    [–] possiblylinux127@lemmy.zip 25 points 2 months ago* (last edited 2 months ago) (3 children)

    That is not how it works.

    On Linux you can "ask" a program to close. That's what happens when you press close. (Sigterm)

    However, you can also use sigkill which really should not be used. That just tells the kernel to stop execution of that process. That won't do things like remove resource locks. All it does is free up the memory and remove the process from the scheduler.

    On Windows, there is no such thing as signals. There is a equivalent system however. If you want to gracefully close a program you can simulate the pushing of the close button. This is pretty much equivalent to a user pushing the close button. If you want kill a program you can use terminate process which tells the Windows kernel to stop running the process and to clean up memory. However, this doesn't clear any resource locks and will also cause issues.

    The big take away is that it is a really bad idea to kill applications instead of letting them terminate. This will create things like zombie processes and locked files no matter what system you are on.

    Also just a little bit of Windows foo:

    taskkill /IM process.exe ask a process to terminate. Runs cleanup code and gracefully exits

    taskkill /F /IM process.exe kills the program. Exits uncleanly and will break things.

    [–] mr_satan@monyet.cc 6 points 2 months ago

    From my experience, killing a process from task manager does free up any file locks held by the process. However, I wouldn't consider it being graceful, any in-app cleanup is lost this way.

    [–] TriflingToad@lemmy.world 4 points 2 months ago (1 children)

    I have to use the terminate program thing SO OFTEN on my steamdeck. The browser just freezes.

    [–] possiblylinux127@lemmy.zip 18 points 2 months ago (1 children)

    That's not good and sounds like a side effect of a different issue

    [–] acockworkorange@mander.xyz 2 points 2 months ago

    Hardware caput. Finito.

    [–] steventhedev@lemmy.world -1 points 2 months ago (1 children)

    What the duck Microsoft bullshit is this?

    There is no concept of locked files in extfs, much less inside the kernel. Resource locks and unkillable processes is some windows bullshit that no sane operating system would touch with a ten foot pole.

    [–] possiblylinux127@lemmy.zip 20 points 2 months ago* (last edited 2 months ago) (1 children)

    You need resource locks to prevent race conditions. Linux has locks as well as every other OS.

    [–] steventhedev@lemmy.world 2 points 2 months ago

    Locks are only held during system calls. Process termination is handled on the system call boundary.

    You're projecting windows kernel insanity where it doesn't belong.

    [–] jet@hackertalks.com 15 points 2 months ago

    https://psdoom.sourceforge.net/

    process management intensifies

    [–] camr_on@lemmy.world 8 points 2 months ago
    [–] Illecors@lemmy.cafe 5 points 2 months ago* (last edited 2 months ago) (2 children)

    killall -9 processname works well when you can't be asked to get the pid.

    kill -9 $$ is my favourite way to save face when I enter something into shell that shouldn't be in its history. Usual situation - switching panes and forgetting a recently used sudo session. Switching to root and getting there without a password prompt, but still typing it in. Wouldn't be helpful in situations where shell history is monitored remotely, but hey ho.

    [–] 2xsaiko@discuss.tchncs.de 9 points 2 months ago (1 children)

    Keep in mind that some killall implementations do not take arguments and instead literally kills all processes. You might want to use pkill instead.

    [–] Illecors@lemmy.cafe 2 points 2 months ago (1 children)

    I did not know that! Thank you!

    What do you mean by implementations? Is this closer debian vs rhel or more like linux vs bsd?

    [–] 2xsaiko@discuss.tchncs.de 3 points 2 months ago (1 children)

    Looking it up, seems like it's something you will only find on original UNIX. So probably nothing you have to worry about in reality tbh.

    [–] AnUnusualRelic@lemmy.world 2 points 2 months ago

    It's still a good habit to get into as this kind of thing could potentially bite you nastily if you ever end up on the wrong machine (which can happen).

    [–] possiblylinux127@lemmy.zip 1 points 2 months ago

    That's pretty smart. However, you might want to make sure there are no child processes first

    [–] daggermoon@lemmy.world 5 points 2 months ago

    Open System Monitor > right click > KILL

    [–] Pieresqi@lemmy.world 3 points 2 months ago

    Skill issue

    [–] toynbee@lemmy.world 2 points 2 months ago
    [–] iamjackflack@lemm.ee 2 points 2 months ago* (last edited 2 months ago)

    Start using the detail tab only and kill the actual image name. It will always kill it immediately. The first tab is a joke in task manager. In the ultra rare case it doesn’t for some really really crazy reason, tasklist / task kill by name or pid

    [–] Fakebelieve@programming.dev 1 points 2 months ago

    One of the only things I still miss after switching to Wayland is xkill. I even had it set to a keybind in early Plasma 5. To be fair I have less applications freeze on me these days since I'm not using ancient hardware.