Linux commands you NEED to know. PS and GREP

Поділитися
Вставка
  • Опубліковано 5 тра 2024
  • X: / typecraft_dev
    lets kill some processes in linux with the ps command and grep. grep will help you search for items in your process list, and when you found the one you are looking for, you can ... well... kill it with "kill"
  • Наука та технологія

КОМЕНТАРІ • 78

  • @joshdean913
    @joshdean913 28 днів тому +49

    “ps ax” will display processes from all users, useful if it’s launched by a different user than is doing the debugging.

    • @Wink-Wright
      @Wink-Wright 23 дні тому

      Considering the merits of having different services run by unique users, this is very important! This is really important for new Linux admins who want to use their root account to run everything, that is horrifically bad practice. Remember, users have different security access. On principle, these services should run by users that only have access to files they need.
      As an example, if I'm running a minecraft sever on a Linux distribution, I would run server.jar as it's own user, Minecraft
      To further this example, say I instead ran it using the user that runs an email service on the same machine. If the Minecraft user became compromised, those emails would also be compromised.
      So long as the Minecraft user was locked down properly, those emails would be safe because they are only accessible to a non-compromised user.

    • @ShortFilmVD
      @ShortFilmVD 19 днів тому

      -e also does the same

  • @felgenh399
    @felgenh399 28 днів тому +39

    `pkill puma`

    • @johndododoe1411
      @johndododoe1411 27 днів тому +2

      killall puma is the old compatible name . But sometimes you want to use your brain to choose which similar process to kill or signal .

    • @Redyf
      @Redyf 26 днів тому +1

      yeah but that isn't the gigachad way of doing it

    • @felgenh399
      @felgenh399 26 днів тому

      @@johndododoe1411 fair, personally I use pgrep a couple of times first. I started playing around with a nvim rpc plugin and it’s handy to test degenerate failures.

    • @user-ir8oe1hk7v
      @user-ir8oe1hk7v 25 днів тому

      @@Redyf fuser -k 3000/tcp

  • @kylehennkens9578
    @kylehennkens9578 28 днів тому +8

    btop will allow you to search procceses by name, you can kill the command with two keys at that point

  • @ToniCorvera
    @ToniCorvera 27 днів тому +10

    *laughs in zombie process*

  • @maguilecutty
    @maguilecutty 3 дні тому

    Man this type of content is soooo gold! So many little bits.
    I think u should do a whole vid on piping

  • @aiktunx
    @aiktunx 28 днів тому +6

    RIP puma

  • @balazskiss2229
    @balazskiss2229 28 днів тому +6

    Why not pgrep it to get the pID?

    • @johndododoe1411
      @johndododoe1411 27 днів тому

      On good systems, pgrep is grep with Perl style search patterns, unlike regular grep, egrep nsd fgrep . If some joke system uses pgrep as a process grep command that's just cruel .

    • @erichlf
      @erichlf 15 днів тому

      Or `pidof puma`, or `kill -9 $(pidof puma)`, but `killall puma` seems a bit more efficient.

  • @leahfluffytail5623
    @leahfluffytail5623 28 днів тому +7

    neat, but unnecessary
    just do `killall puma` or `pkill -9 -f puma`

    • @Queeebo
      @Queeebo 28 днів тому

      Does not fix the problem, if you want to kill just one of more than one process instances. gtfo

  • @feeditehh
    @feeditehh 8 днів тому +1

    Killall left the chat 🥶

  • @StevenMartinGuitar
    @StevenMartinGuitar 11 днів тому +3

    I just use pgrep and pkill

  •  22 години тому

    pipe the output from grep into awk to get the process id then pipe that into the kill command.

  • @johndododoe1411
    @johndododoe1411 27 днів тому +1

    Congratulations on having a system with longer process ids than the common 15 bits .

  • @Adrian-dl9gw
    @Adrian-dl9gw 11 днів тому

    Hey, nice video. Wondering what keyboard you are using?

  • @Person-who-exists
    @Person-who-exists 27 днів тому

    Are you using the starship gruvbox prompt with custom colors?

  • @nightwolf1966
    @nightwolf1966 28 днів тому

    Nice keep up the great work it’s very helpful

  • @stevenolsen9683
    @stevenolsen9683 2 дні тому

    I always do ps aux | grep search-string and the kill -9 PID, but yeah same thing

  • @aresstavropoulos916
    @aresstavropoulos916 28 днів тому

    what’s the difference between using kill and pkill?

  • @Queeebo
    @Queeebo 28 днів тому +1

    One of my first ones. So ldur!

  • @codedsprit
    @codedsprit 22 дні тому

    Any tips related to battery saving

  • @Frog_Scooper
    @Frog_Scooper 28 днів тому

    A useful way I've implemented is to quick check if I have a certain paclaje installed, like so: `sudo apt list | grep (package)`

    • @tacokoneko
      @tacokoneko 28 днів тому

      be rly careful using apt in pipe instead of apt-get because piping the output of apt not being stable behavior is literally the exact reason why a lot of people say use apt-get instead of apt in scripts. its even completely fine to use apt in scripts, as long as you never pipe or otherwise parse its output other than return code.

    • @Frog_Scooper
      @Frog_Scooper 28 днів тому

      @@tacokoneko If I need it for something complicated I normally do apt-get, but for just a quick package check I use apt

    • @ToniCorvera
      @ToniCorvera 27 днів тому

      No need to sudo though

  • @mistral___
    @mistral___ 28 днів тому

    Genuine question: why not just `pkill puma`? Is there some difference under the hood?

    • @Catterjeeo
      @Catterjeeo 27 днів тому +1

      Ya might have multiple processes with similar names

  • @marinehakobyan7005
    @marinehakobyan7005 11 днів тому

    Please talk about the flags as well

  • @eliacortesi2787
    @eliacortesi2787 28 днів тому

    Noooo, the teasing shorts are cruel. Can't wait.

  • @laszlob3683
    @laszlob3683 6 днів тому

    Is this arch linux?

  • @ohheyemmi
    @ohheyemmi 28 днів тому +1

    Linux newbie here-How do you get your prompt to look so pretty?

    • @typecraft_dev
      @typecraft_dev  28 днів тому

      Check out the channel I have a few videos on that

    • @johndododoe1411
      @johndododoe1411 27 днів тому

      Just set the PS1 variable to what you want it to look like, including escape codes for wanted screen effects, and backslash codes for useful info like current dir, number of running jobs etc. etc.

  • @cookie1816
    @cookie1816 12 днів тому

    use kill but press tab after typing the process name, easy

  • @alastor--radiodemon7556
    @alastor--radiodemon7556 24 дні тому

    Killall puma
    Btop -> presses f -> puma -> presses k

  • @3zRides
    @3zRides 28 днів тому +1

    Puma pants

  • @Sir_Trollman
    @Sir_Trollman 15 днів тому

    Bro what terminal emulator are you using, as I want it

    • @darux268
      @darux268 11 днів тому

      It's called starship, I'd recommend getting it with fish for the autocompletes

    • @Sir_Trollman
      @Sir_Trollman 11 днів тому

      @@darux268 ok, how hard is it moving from bash to fish?

  • @tedmoyses2942
    @tedmoyses2942 24 дні тому

    pgrep -f puma
    Cleaner and you don't t see your own proc

  • @HaiNguyen-cf1ji
    @HaiNguyen-cf1ji 28 днів тому

    "pkill puma" do same thing with less typing

  • @cibulis5347
    @cibulis5347 26 днів тому

    Is all linux users named Chris?

  • @casadogaspar
    @casadogaspar 28 днів тому

    I preffer htop for this.

  • @shizeeque
    @shizeeque 28 днів тому

    you can just say `pkill puma` to do the same thing.

  • @H3cJP
    @H3cJP 12 днів тому

    i prefer to use a flamethrower

  • @AlanBurr25
    @AlanBurr25 26 днів тому +1

    instead of having to copy the PID, you could just do it all in one go:
    “ps x | grep puma | awk '{print $1}' | xargs kill”

  • @freeFHH
    @freeFHH 28 днів тому

    The most things that you really need to know in Linux are man command and -help

    • @mage3690
      @mage3690 27 днів тому

      Or you can do help , or just help for a list of builtin commands, or apropos to search through the man database for entries containing that search term (entry titles + one line summary, technically), or tldr for a shortened version of a man page with some trivial examples using that command (must install tldr but it's in the main repos IIRC), or . . . well, I've gone on long enough.

  • @esamlasheen453
    @esamlasheen453 26 днів тому

    Or u can use pkill puma

  • @ziggyspaz
    @ziggyspaz День тому

    Use pkill instead

  • @theod0r
    @theod0r 25 днів тому

    pedantic ass here:
    Is pipe actually a command? It's just a way of redirecting a datastream, no?

  • @arcj0602
    @arcj0602 6 днів тому

    pkill

  • @caeb-92
    @caeb-92 12 днів тому

    ps -fea | grep explorer.exe

    • @BrknSoul
      @BrknSoul 11 днів тому

      taskkill -im explorer.exe

    • @im_andrei1010
      @im_andrei1010 10 днів тому

      @@BrknSoul windows virgin

  • @habelincoln1665
    @habelincoln1665 28 днів тому +3

    On windows u can use task list and task kill

  • @ekim4926
    @ekim4926 25 днів тому

    pidof

  • @cenkcankaya5728
    @cenkcankaya5728 27 днів тому

    Old trick

  • @CarlsHung
    @CarlsHung 28 днів тому +2

    Task manager is so much easier

    • @itsfkf6106
      @itsfkf6106 28 днів тому +2

      bruh 💀💀💀💀💀💀💀

  • @Sslack_
    @Sslack_ 28 днів тому

    Yea, I prefer my taskmanager 😅

  • @trashbhuwan
    @trashbhuwan 28 днів тому

    Using 'xargs' would be better!

  • @sleepingvalley8340
    @sleepingvalley8340 26 днів тому

    Or I can use a GUI application and not waste 3 minutes of my life or better yet have Kill bound to a macro.

  • @user-oz5ck6bv7l
    @user-oz5ck6bv7l 19 днів тому

    killall -9 puma

  • @MenuActive
    @MenuActive 19 днів тому

    kill $(lsof -ti 3000)

  • @stephenreaves3205
    @stephenreaves3205 27 днів тому

    `ps aux | awk '/puma/ {print $2}' | xargs kill`

  • @setoman1
    @setoman1 27 днів тому +1

    $($(which find) /usr/bin -name *system*monitor)&

    • @setoman1
      @setoman1 27 днів тому +1

      Thank me later.

    • @johndododoe1411
      @johndododoe1411 27 днів тому

      This will run whichever program under /usr/bin that matches the search . Looks like you are trying to trick people into running something they don't want .
      I consider all such obfuscated auto-run tricks as dangerous and potentially malicious .

    • @setoman1
      @setoman1 27 днів тому

      @@johndododoe1411 😂