 I'm going to slaughter this name, but it's D'Ivan Norak. He asks for a script for creating dictionaries of words, 10 characters, symbols into a text file. And I clarified that he wasn't just looking for a list of words, 10 characters long. He wants randomly generated stuff, some of you like randomly generating something for a password. There is a number of ways of doing this. First off, let me start to spike because someone will comment below. In the digital world and computer world, and some people will argue in the real world as well, there is no such thing as a true random number. But we can get pretty close because everything's on computers are based on math. There's got to be some sort of input. So there's different ways of kind of coming up with random stuff. So I'm going to show you different ways of doing this. I'm going to show you two main ways of doing this. There's lots of different ways, but one's going to use the date command, and this is not the most efficient, but it's a simple command. So the date command will give us the date and time. We can then pipe that into MD5 sum, and that will give us a hash for that file. But what we can do now is he wants specifically to be 10 characters long. We can use the head command with dash C meaning characters, and we can say 10. So we'll cut it off at 10 characters. Now be advised that this particular command, again, not truly random because we're doing it based on the date. So it's very, very not random. And if you were to issue this command twice in a row or multiple times in less than a second, then you're going to get the same output each time. I'll try to give you an example of this by running it multiple times and didn't put any new line characters at the end of these. But if you look, if you go 10 characters, we've got 70 here, and it goes to here. Then we've got the same number again, same number again. And even if you were to wait a half a second, as long as you're still in the same second as far as the date and time is concerned, then it is going to generate the same number. So not the best option, but a quick and easy way. I can remember this command in my head. Now another option we can do is we can use one of the random devices. So in your dev folder, you probably have a u-random file, which will, if we were to cat it, output random data. Now if this ever happens to your shell, by the way, right there, it's kind of messed up, just type in reset and hit enter, and it will reset your shell. What happens when you cat out binary files sometimes, it garbles up your shell. So as I just stated, there's some binary data in there. So instead of catting it out, we're going to use the string command, which will take that and output only ASCII characters, alphanumeric stuff, so we can do that. And sorry, yes, strings, not strings. So there we go. There are some characters in there, but it's ignoring the binary data, if you will. So I'm going to control C to kill that. So now we can take that, and let's say we just wanted to be alphanumeric. We can now grep, and we can do dash O, and then inside quotations, inside double braces, and then inside colons, we can type in alnum for alphanumeric, and if we hit enter, it's going to only output letters and numbers, ignoring those other characters that aren't part of the alphanumeric language, whatever language is on your system there. Now again, we want this to be 10 characters long. So we're running that command again, this time putting it into head, but instead of characters, we're going to say dash N10 for 10 lines, because we're getting one character on each line in this case. There we go, we got 10 individual characters. What we can do now is use TR dash D to delete, and what are we going to delete? Inside quotations, we're going to say backslash N, meaning remove all new lines, and there we go, we can see that we got a 10 character randomly generated alphanumeric word that we just created. We can take this, and let's see what happens if we run this a couple of times in a row. You can see it does not repeat, because it's not based on seconds, it's regenerating random stuff pretty fast here, and it's grabbing 10 lines, and then it's grabbing the next 10 lines and the next 10 lines of alphanumeric characters, so therefore it's not going to grab the same thing twice in a row. So this is a much better command than the previous one, but a little bit longer, a little bit harder to remember, although you could remember it. So now he wanted to put this all into a folder, so what we can do is we can put this in a while loop, I can say, or I can say for IN, and then I can say sequence, so in this case that's a back tick, not a single quote there, saying run this command, and I should be able to say 1 through 10 or 1 through 100 I'll say, back tick, do, and then I'll paste in our command here, so let me just copy that, and we will redirect the output into a file, and append to it, so double greater than symbol, and this is still all one line even though it's showing up as more than one just because I'm looping around here. We will say, what was the career file called, words, and we'll say done. So we'll hit enter, give it a moment to run, and if we cat out our file words now, oh you know what our problem with that is, is that we don't have any new line characters in there, that's simple to fix. So it did what we wanted to, but it did it all on one line with no spaces, so we didn't divide it up. We'll just add another command into here, we'll change this, we'll say echo nothing, this is just a simple way of doing it, and I'll put my command out here to write to the words, so this time I'm overwriting it, instead of appending to it because I'm using only one greater than, but since that's outside the loop it's going to just do it once to dump the output of everything from the loop, so if I do that, I believe in my head I'm going to cat out words, this is why I do stuff on the fly here, I don't test it out before I do these videos, there we go, we've got a file full of randomly generated passwords or characters, whatever you want to call it, and if I do word count dash L and I say word, I hit enter, it says that there's a hundred lines, so in this case a hundred randomly generated passwords just create ten characters long, and again if you want to change the lengths of those we can change this to whatever we want, we want it to be twenty-five characters long, we change that to twenty-five, and now I can cat out word and they're now twenty-five characters long. So that's how you can generate randomly generated characters or passwords, whatever you want to call them and put them into a file and get a whole big long list of them, and if you want more than a hundred in your list you can just change this to a higher number, if I want a thousand or ten thousand I can do so, might take a few seconds, shouldn't take too long, ten thousand generated passwords, and actually the longest part of this might be just that it has to write to the disk, but it's actually faster than outputting it to the screen. If you were to output this to the screen, either while writing or just to output to the screen it would take much longer, but it still is taking quite a bit, but again we're generating ten thousand passwords. Anyway if you like this video be sure to like, subscribe, share, and comment if you enjoy my videos in general, think about becoming a supporter over at Patreon.com, there's a link in the description at Patreon.com forward slash metal x one thousand, I appreciate, even if you have a dollar a month you can spare, it helps out a lot, and be sure to check out my website filmsbychrist.com, that's Chris the K, there should be a link to that in the description as well, and as always I hope that you have a great day, and before we leave I'll just, I'm going to press control C to kill this, and we'll say word count line, word, and well we generated almost five thousand, four thousand eight hundred and fifteen was what we were at when I killed it, so almost half way to our ten thousand mark, and that was what thirty seconds, forty five seconds, so figure three minutes on my computer it would have taken to generate ten thousand random passwords. Anyway, thanks for watching, and as always I hope that you have a great day.