One final thing that I want to show you guys in this video, is how to redirect
the output of a command. So, how we do that is simply we write a command, for
this instance it's going to be "ls" and then we're going to use the ">"
and this is the key just to the left of the question mark key on most keyboards,
and then we're going to tell it what file we want to put it into. So, rather
than outputting the result of "ls" it's going to put the result into "outfile.txt"
So, we can type "nano outfile.txt" and we can see the output of that command, which
is pretty neat. Now I'm gonna use the "find" command to find all files with a
size of less than 10 kilobytes, and I'm going to use "-exec grep -i -n" and we're
going to look for "sandwich" and then " +" We're going to
redirect the output to "> .txt". We're only looking in .php files here, there. Now
if we open up "f.text" we see these two sandwich functions that I
found, but that didn't print it out on the screen. So, the final command that I'm
going to share with you guys in this video is "tee", and what this does if I
type previous command out again, "find . -type f -size -10k -iname "*.php" -exec grep -i -n "function +
we can actually pipe this across to "| tee" and make an "of.txt". So, before I
run this i want to break this command down. We're using "find" to find all files of less
than 10 kilobytes in size, and with the .php extension. We're then going to
execute "grep" ignoring case sensitivity and numbering lines. We're going to search
for function in these files, and then we're gonna pipe it over to "tee' and the
second argument of this "tee" command is the out file that we want to write the
results to. What this command will do is it will return the results on the
screen, but it's also going to put them into of.txt. This is gonna be useful if
you want to copy down the results of the command while seeing them in real time.
So, that was a pretty big video. I hope you guys found it informative and I hope I
explained it well. In the next video we're going to be going over processes,
and what they are and how to manage them.