An ad-free and cookie-free website.
Learn to build and execute commands at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux xargs Command Summary with Examples (3:41)
Our ninetieth word, or command to memorize is
xargs from our category
xargs allows you to build and execute
||Print help screen|
||Run in interactive mode|
||Use maximums of ARGS arguments|
Recall from videos (tutorials) #87 through #89, we're building a script to tie together what we've learned here, and now we'll build and execute commands.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s).
xargs command has
20 options and the argument is the name of a command,
with options, and if you don't supply a command by default it will use
echo and print the results.
Like most commands, help is available with double-dash
-p runs in interactive mode and
-n limits the arguments.
So why is
xargs an important command?
Well, we need a way to use output from one command, like
find for example, as standard input to
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go. So let's play with
xargs first, then add it to our
So by default,
output what came from another command, like a
tail -3 of our
And you can see the output there.
Next, let's see how
arguments from another command,
ls files created in videos in the
fifties, for example. And then count only the lines.
That's an example of passing from one to the next.
And then, let's add
xargs to a script
nano, from video (tutorial) #20,
and the file is called
located in our
(Below is the screen from within
And I added these lines (the comment for video 90 and below). It will
search for files later than the date of the latest
tar file and then count lines and
then show a message with it. Okay, please pause if you'd like to catch
up on your end and then we'll try it out.
Ctrl-x to leave
y to confirm saving.)
And last, explicitly run with this pointing to the
And it takes a second here, but you'll see, there's our reminder.
Okay now you know how to use
And you know the syntax for commands, options and arguments.
One last tip about the
command. So if
xargs is tough, don't
worry, it is a tricky but can be a time saver, so please spend some
time with it.
Okay, thanks for visiting today. I hope this was a helpful
introduction to the
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Now that we're nearing the end of this tutorial series for Linux beginners, check out our YouTube Channel and other links at this site for more advanced programming content, particularly with Python.
readcommand, hit Back.
teecommand, click Next.
A newly-updated free resource. Connect and refer a friend today.