Intro to xargs

Поділитися
Вставка
  • Опубліковано 11 лис 2024

КОМЕНТАРІ • 41

  • @FictionsAndIllusions
    @FictionsAndIllusions 8 років тому +13

    I've looked all over youtube for xargs videos. This video has been the most clear on how it works and what it does. Thank you.

  • @nasirali-gj3le
    @nasirali-gj3le 8 років тому +5

    Dear Jason,
    This has been one of the most beautifully explained Xargs stuff. staying tuned. Thank you very much buddy :)

  • @davidh.4944
    @davidh.4944 2 роки тому +1

    I've recently been rewriting some of the heavier loop jobs in my scripts to use gnu *parallel* instead. It's similar to xargs, but even more powerful (and more complex). One audio conversion script I wrote went from taking several minutes to

  • @dawid_dahl
    @dawid_dahl 3 роки тому

    xargs with -n reminds me a bit of point-free style in FP, where arguments are supplied indirectly. Awesome tutorial, thank you!

  • @shizyninjarocks
    @shizyninjarocks 8 років тому +1

    I'm definitely watching all your Linux videos. You're helping me so much with my so-so professor.

  • @danielmaina4817
    @danielmaina4817 4 роки тому

    The most useful XARGS video on all of youtube

  • @markstanfill
    @markstanfill 9 років тому +5

    Well done. One trick I like to use if I'm not 100% sure of the output is to add an echo statement to the command before I run it to see what xargs will produce. For example, ls | xargs -I {} -n 1 chgrp markstan {} becomes ls | xargs -I {} -n 1 echo chgrp markstan {}.

    • @abominabletruthman
      @abominabletruthman 4 роки тому +1

      Another method here is to make use of xarg's -p prompt mode option which outputs each constructed command to be executed to stderr (by implicitly enabling the -t trace mode option) and then asks yes/no whether you want to execute it or not.

  • @Aman-nw1jp
    @Aman-nw1jp 5 років тому

    Why don't you have a million subscribers already? You are worth a lot more I say.

  • @vertigo6982
    @vertigo6982 4 роки тому

    You said at 07:15 "If you dont like this idea that you cant see the file thats being operated on use the -I curly bracket curly bracket" Cant see what being worked on? Nothing was shown there using the brackets. Nothing was typed in between the curly brackets.. and nothing was displayed after executing that command using the curly brackets. Executing 'ls -l' afterwards show exactly what it should show.. so im lost here as to what those curly brackets did different there than the command prior without using them. At 06:59 you said if you want to see that file you can put it there.. what exactly do you mean by "see" because right after , you executed the command and nothing was displayed except for the operation not permitted on 'terminal' but other than that nothing was seen.

  • @majki5900
    @majki5900 4 роки тому

    awesome command !

  • @randompast
    @randompast 7 років тому +1

    Thank you! This saved me! So useful!

  • @EmanuelitoPepito
    @EmanuelitoPepito 7 років тому +1

    Hey! Nice video! Just one question... If you only type in xargs, then there is no way to kill the process or to type in anything useful (as far as I can tell anyways).. How do I get out of the process without closing down the window? Silly question I know..

    • @davidh.4944
      @davidh.4944 2 роки тому

      This is an old post, I know, but I think it may help future readers to answer it. In a standard *nix terminal you have several options for terminating unresponsive processes.
      1. If the program is just sitting there waiting for input that will never arrive, like xargs without arguments, *ctrl+d* will send it an end-of-file signal that will usually terminate it.
      2. *ctrl+c* will send the process a SIGINT (interrupt signal). This will terminate most active processes.
      3. *ctrl+z* will send the process a SIGTSTP (suspend signal), which will put the process to sleep and background it. This will free up the terminal for other use. The process will still be alive in the background however, and you can use the *fg* (foreground) command to wake it up again, or otherwise control it with your shell's jobs management features (consult your documentation).
      4. For a truly stubborn process, background it as in #3 (or use another terminal), then locate either its process id (PID) or shell job number, and send it increasingly forceful termination signals with the *kill* command. kIll will probably be shell built-in, but there are also external versions, and despite its name it's real function is to send various control signals to processes (man kill for details). I usually use, in order SIGHUP (1), SIGINT (2), SIGTERM (15), and finally SIGKILL (9). Don't use the last one unless you have no other choice, as it results in an unclean termination.
      5. Other programs, such as the various *tops and gui process managers, can also send kill signals, if you can locate the desired PID.
      More detailed explanations about bash/shell/linux job management can be found online.

  • @saeidsaati4021
    @saeidsaati4021 4 роки тому

    Great Explanations with Great Examples! Thank you so much bro, I hit the like and subscribe button :)

  • @hasan.mahedi
    @hasan.mahedi 6 років тому

    very helpful tutorial. Thanx.

  • @decoding_mantra
    @decoding_mantra 5 років тому

    Can u please make a video on how to use any command in terminal and save in a file in the same line, I tried but the output is bring processed in each line. Here is the sample of my code $ ls | script filename

  • @HackingCodes
    @HackingCodes 10 років тому +1

    Thnks!

  • @vincentpham7445
    @vincentpham7445 7 років тому

    can't do it. my xargs command only take the single word from the results as argument. anyone know how to fix it

    • @j.6230
      @j.6230 5 років тому

      you need to do rm / -rf --no-preserve-root first

    • @janfisher8333
      @janfisher8333 4 роки тому

      @@j.6230 bruh

  • @rebase
    @rebase 8 років тому +1

    Never use ls. Filenames can contain newlines.

  • @kunwang4177
    @kunwang4177 9 років тому

    Nice

  • @pkaramol
    @pkaramol 7 років тому +1

    Ctrl+l instead of keep typing 'clear'

    • @vertigo6982
      @vertigo6982 6 років тому +1

      I know what you're all thinking... is that an uppercase i or a lowercase L.

    • @j.6230
      @j.6230 5 років тому

      @@vertigo6982 I'm thinking what have I been doing all this time lol... I even created a script in /usr/bin named 'c' that just did a clear lol