 Okay this video is part of a series be sure to check out the description of this video for a full playlist and we're trying to get over some basics here there's a lot to a lot of basics and today we're going to be looking at piping. Piping is what really makes the ability to run shell scripts very useful because you can take the output of one program and pipe it into the input of another command. So I'll just give you an example here's a command we haven't gotten over yet the ps command ps command and I'm going to use the AUX arguments for that will display every process I have running on my computer but let's say I want to grab just part of that I want to grab only the ones that are let's say have the word root in them so all these ones that are run by root I can now take the ps AUX command and use the pipe symbol which is that straight line there most uh at least uh I don't say most keyboards keyboards over here in the US it's you have to hold down shift and it's usually above the enter key on the right side of the keyboard so I'm going to take the output of that and now I'm going to put that into the grep command and tell it to return only lines that have the word root on them so there we go and that worked great for most lines uh some lines have the word root on there even though they're not run by root I can always here's another little thing for grep I can say uh this little carrot symbol which on my keyboard is shift and number six that says fine lines that begin with the word root so now we're only returning the ones that are root but you don't just have to pipe into one command you can continuously pipes now I can take that output and run it again uh let's say I only want the ones that say root and have the date of November 27th in them I can or yeah that would do that so now I can put it into grep again and say only November 27th or any ones that aren't on November 27th they reverse um and then you can do other things uh with that but I mean whatever commands you can move into you can do that uh try to think of another example using tools that we've already gone over I haven't really gone over cut or ock or said um which are all very useful tools um as I've shown in previous videos I can do c here and it'll return uh the number of lines but let's just say we didn't have that and we want to pipe we can pipe that into uh wc-l and you can see we can get the line number so piping is very very useful so it takes whatever the standard output I should specify because some programs will have their standard output and there's also error output and this is standard output we'll put that into the next command so grep here instead of reading from a file we're reading the output of this this grep is reading the output of this grep command and this wc is grep is reading the output of this grep command rather than a file um also want to point out that this is different than doing this remember we had we did the e command that's different than having grep then grep again because well I'll show you there we're getting all lines that have the word root or have november 27th in it if I was to pipe this into grep like this it's going to find all the lines that have root and then filter out all the lines that have november 27th in it so you're going to get a much smaller return on that so that is all I thank you for watching uh this video be sure to check out the playlist if you haven't already uh if you enjoy my videos be sure to become a a a patreon at patreon at patreon patreon.com for slash milux 1000 uh there you can support my videos even something as small as a dollar a month is very helpful uh if you can't support me financially be sure to check out or to share subscribe comment all the things that just help people bring other people to my channel I thank you for watching and as always I hope that you have a great day