EX200 Red Hat Certified System Administrator RHCSA – Linux command line
1. File system navigation. Commands “ls, cd, pwd” part 1.
Welcome everybody to this tutorial. Today I will begin using the command line interface but before I do, let me just share a few things with you from my own personal experiences with the command line. First of all, it can seem a little bit complicated especially to Windows users and in the beginning it might seem like you will never be able to learn it or something of a kind but believe me, that is not the case. Thousands of people, millions of people have learned it before you who had the exact same mindset. I don’t want you to worry about that if it seems complicated or if you make mistakes or if something doesn’t work immediately don’t worry about it.
It happens to everybody. Most important of all, do not get frustrated by it. If you do get up, go make a cup of coffee, drink a cup of water, go for a walk, whatever. Make a five minute break, whatever calms you down, do it because if you are frustrated you won’t be able to do it. You won’t be able to do much, I guarantee it to you anyway if you just stick with it. By the end of this course you will master the Linux command line and you will successfully be able to use Red Hat without any problems.
You will have full knowledge of the terminal in Red Hat and you will command it to the fullest of extents. You will be able to do whatever you want with it without any bigger difficulties. But as I said, if there are problems along the way and there will be problems along the way if you encounter bumps, don’t stop. Just stick with it and eventually you will figure it out. Of that I assure you it is not as complicated as it seems. It’s very simple, straightforward, no problems.
Anyway, that being said, let’s just go ahead and click on Application, move on down to Utilities, scroll to the bottom and there is a terminal icon here. We’re just going to go ahead and click it. Excellent. So I have already changed my terminal here to an extent but if you just go ahead and click on Edit and you say Profile Preferences here you can customize it to a good extent. So there are just a few things that you need to customize here other than that you can just leave as it is. So profile name? It’s random guy. That’s my username for this account. So I have changed the profile name to Random Guy.
It will probably be by default untitled or something of a kind. But even if you don’t change it, it won’t make any significant differences down below. This will be ticked, so use system fixed with font and if you untick this, you will be able to select a custom font for you and you will also be able to configure the font size, which is very nice. So if I say 20, this is going to get even bigger. I’m probably going to say 22. For the purposes of this tutorial, I generally wouldn’t use it, but I want you to be able to see everything that goes on here. Down below you have the cursor shape. So just take a look at the terminal in behind at the top and see how the block changes to an eye beam and then how it changes to an underline. I personally like to use a block. You can use either of the three, any of the three, whichever suits your needs or preferences. You can also configure the default terminal size. You can resize it basically now to anything you want with an arrow, with your mouse. However, this default terminal size refers to every time you open up a terminal.
What size do you want it to be then? But after you have opened it up, you can change it to whatever you want. Anyway, the next thing that I want to configure is colors. So under colors you can say, what sort of scheme do you want? It says use colors from the system theme. Do you want that? No, I do not want that. Okay. I generally choose blue on black. For this particular tutorial, I’ve chosen green on black. I think you’ll be able to see things a lot better that way. But you can choose whatever you want. So you’ll look here, you have text color. You can choose your text color to be anything. It can be yellow or whatever this color is. And look, it changes in the background. No problems. Can be is this crimson or red? This is red. Just changed the color plate. Sorry. We’ll just put it red here and you can see that it immediately changes. But I’m just going to go ahead and select was it this green or this green? Yeah, it was this one. Excellent. So I’m just going to go ahead and select this one here. Okay, so bold filler no, I don’t want bold color to be that. Sorry, just cancel. Same as the text color. Don’t alter that. I thought for a moment it was something different.
So the bold color is basically bold letters. What sort of color do you want for that kind of text? Or something of a kind, if I’m not mistaken. Anyway, down below you have built in schemes so you can, I don’t know, use different ones there’s like the Linux console or, I don’t know, tango. I’ve honestly never used that one. Or X term, I don’t know. I really wouldn’t use that one either. You have the color plate down here, which you can play around with if you want. But there really there really is no literally no need for you to do that. You can just say custom and then choose whatever you want. But there is not even a need to play with palette at all. You can change color of different things there, but no need. You’re just going to confuse yourself. Rather instead just change the text color and the background color to whatever suits you. I would personally recommend that you change it to something that is suiting for your eyes. Anyway.
Do we have anything here? Okay, yes, the scroll bar. How many lines do you want to be able to scroll back to? This is a pretty good thing actually. It might not seem important to something of a kind, but more often than not you will want to scroll back and you will want to see what have you done or what has been done. So it’s not about to keep this number high. I think 8192 is plenty. So there’s no need to change that. But sometimes it’s a good idea to click on unlimited. Although all these things cost, resources, compatibility. Okay, so no need to change anything actually here. By default this is all fine. Title and command, this is all also fine. You can run some additional scripts or something of a kind. Custom made says run a custom command instead of my shell. Don’t change that, just leave it as it is. There is no real reason to change anything here. We will be changing things in the terminal anyway. If you want something to run on boot up, we will place it in the Chron tab and there things will run. You don’t need to put anything here or anything of a kind anyway.
I’ll just go ahead and close this. Expand the terminal across the board and I’m going to switch to full screen. Okay. There we go. So it’s across the whole screen. And now we can begin with some basic concepts. So first of all, let me introduce you to the CD command CD. It stands for change directory. With it you are able to navigate the file system. In a sense I can. Now CD to home, you can type in two letters, two, three letters or even one. And then press tab to complete it here. Observe. I can type in CD stands for root. So this is the root of the directory. You can see that this part here has changed from this to this. Excellent. So as I said, if I type in Space and I type in H tab, it immediately completes and it says it’s home. It knows how to go there.
And then inside of home I have my username which is Random Guy. I can just type in R and then press tab again and it’s going to auto complete the whole command. So sometimes you need to type in more than one letter or press tab twice. There you go. So it completed. Just go ahead and clear that if I slash Home it’s going to complete. And if I even don’t type anything in here because there is only one possibility, if I press tab, it’s going to finish and it’s going to type in Random guy, the username. And if I type in tab again, nothing is going to happen. But if I type it twice really fast actually I’ve typed it in twice here, but it doesn’t really matter. You are able to see from here, you see this is the command I’ve typed in tab twice, tab twice. And now I got a list of possible folders that I could navigate to directories actually, that I could navigate to. Very simple. And if I type in capital T, that’s for templates. Is there anything else with T? No, there is. Okay, let’s use the P. So there are two things with P as far as I can see, pictures and public. If I type in tab, nothing. But if I type it again, it’s pictures and public. So it gives me the two possibilities. Very easy way of navigating through the entire file system. But you might ask yourselves how does he know where to go? That’s a pretty good question actually. And we use our preexisting knowledge of course, but we also use another command which helps us navigate and figure out where we are at the moment.
Now, before I go into that, there is this command which I’ve used previously. It’s called clear. It’s spelled like this. And if you type it into the terminal it’s going to clear pretty much everything that is there. You see, I just typed in Clear and it literally does what it says, what the name says it does. It clears the screen completely. It clears the terminal quite in handy. Very helpful to stay in focus with what you are doing at the moment. Now there is this command LS. If I press it, you see, if I just type in LS without adding any arguments of whatsoever, it’s going to list all the folders and all the files and it’s going to list pretty much everything within my current working directory. It’s not going to give me the hidden files, but you don’t really need those at the moment. I will explain shortly what those are and how you can see them. But if I just type in LS it’s going to show me everything in my current working directory. So for example, if I want to go to boot, dev bin, Etsy, home, lib, whatever, I would type in CD space, Etsy, press Enter and then I would type in a list again. And you see I have a whole ton of load of files here, folders, files here, directories and so on and so forth.
I have a lot of stuff here in general. So let’s just go ahead and clear. You will too. But there is another key thing with this CD command. Actually there are a few shortcuts that you can use and there is one key thing. So let’s just go back to root directory. To go back to root directory, just type in CDSpace. This is pretty much the same concept that is on Unix Linux type systems. That also is the same concept that works on a PSD or on Mac. The only operating system that this concept is not valid the command CD is. But the concept of a slash is not on Windows. So Windows machines would use something like this, a backslash. This would be their point of reference. This would be how they would navigate backslash. So you would say, I don’t know, program files and then backslash, I don’t know, something here, something. And then again, random stuff.
Anyway, this is how they would navigate. This is how you would navigate in Windows with backslashes and then typing in the whole path. Also, the tab option that I’ve showed you a moment ago works a bit differently there as well. Just go ahead and clear the screen and see. I don’t need to because you can also see where you are here. It’s going to tell you generally where you are in this section that I have selected now. So slash just represents root. But look at this, I can CD to home, and let’s say I’m in home, and let’s say that I want to go exactly actually, let’s go to random guy and then clear, and let’s say I want to go exactly one step backwards. How would you do that? You don’t want to type in CD and then root and then home, and then you would go back there. Okay, in this particular example, it’s relatively simple, but you could be somewhere deep in the file structure and to type this path in again can be a bit tedious just to go one step backward. It’s not very practical. So symbol for the previous directory is if I type in dot dot, I’m going to go back one directory, I can go back again.
So CDC, I’m going backwards. The current directory is CD. Well, there wouldn’t be a point type in CD, but the markation for the current directory is a dot. Anyway, another thing that you can type in after you have cleared is PWD print working directory. So if I press Enter, okay, so it’s root, if I CD, home, PWD, I’m in home now, clear CD, random guy, clear, PWD I am in home, root, home, random guy. Excellent. So if I type in CD and again PWD, you can see that this path here, not path, but this current working directory is different from this one. It’s different by exactly one single step here, and that is the dot dot, which signifies the previous working directory. Simple as that. You go forward, you go backward, you go forward, you go backward.
Very simple to navigate. There will be a few more things in regard to the CD command in the follow up tutorial, as this will be a miniseries within this course, where we shall learn the basics of the terminal, how to use it, what commands you need on your day, what basic commands and more advanced commands and stuff of a kind. And then later on, we will get into the actual stuff that you will need for the Red Hat certified administrator exam. But you cannot really do any of those things without learning these fundamental basics. Anyway, I bet you farewell and I hope to see you in the next tutorial.
2. File system navigation. Commands “ls, cd, pwd” part 2.
Welcome back everybody. Let’s just continue. So the last time we used change directory command and there are a few tricks to it. One of them is basically using this marketation. So if I type in this and if I press Enter, okay, I’m already in that directory. But let’s say that I was in route, boot, grub, don’t know, whatever unless I am there anyway, how would I get back to my home directory where my username is? What would I do? What would I need to type in? Well, one of the first things that comes to mind is Cdhomerandomguy and I would be there and if I want to go to the downloads folder I would have to type in Downloads. So this whole command I would need to type in in order to go back to my home directory. Is there a shorter way? Yes.
So basically there is a shortcut. I know it doesn’t seem too significant here but when you are deep somewhere in the system, deep on the file tree, typing in these commands to go back and forth can be a tedious task and knowing these shortcuts can help you a great deal to basically preserve your nerves and save time. So just type in tilda. There you go. And if I type in Downloads there you go. I’m going to go straight into the Downloads folder from here. Or I could just type in this. There you go. PWD. I indeed am in my home directory of the current user. Keep in mind that the CD tilde will only take you to the current home directory of sorry not to the current home directory. There is no such thing to the home directory of the current user. It won’t take you to the if you for example had let’s go back a step. Let’s do an LS. So this is my user but you can have practically an infinite amount of users here and if I typed in CD tilde it would take me back. It would basically take me back only to this folder as that is my current user name. This is my host name.
So this is the host name here and this is my username. Just so you know. What is signified here and this is my current directory. So to say the entire path is not listed but the current one. The name of the current directory is which is very very nice. Let’s go ahead and clear the screen and let’s go back to the LS command. Now LS command has a large amount of arguments. So what are arguments to commands? Basically it’s an additional instruction that you give to a command which modifies the way that particular command behaves. So if I just type in LS, let’s change the directory to root because I’m going to have more stuff to list there and if I type in LS here okay, so you see what happens. I get a list of directories in this fashion but that’s about it I get a list of not just directories I get a list of everything that is within this directory which is root so what? It doesn’t tell me any information. It doesn’t tell me the size. It doesn’t tell me the last date, when it was modified. It doesn’t give me the permission. It doesn’t give me the ownership, nothing. Okay, let’s try to change that. Let’s type in LS space l. So this L is an argument to a command which will modify its behavior.
Press Enter and there you go. You can see how this particular listing this particular listing is completely different from this listing. Why? Well, the lower listing or the later listing is far more verbose in comparison to the first one it gives you a lot more information and it’s really useful so this is the basically the owner this is the ownership group size last date when it was modified how do you know? Is this a directory? Or is this a text file or something of a kind? Or is this a file or a directory or whatever? So it says here basically the first letter says directory d the first letter l it’s a link do we have anything that’s not a link or directory here? I’m afraid we do not let’s go into VAR shell do we have anything here? No log. There’s bound to be something here. And there we go. So if it’s just a dash, basically like this it says secure then you can go ahead and open it.
It’s basically a text file. It’s basically a file. It doesn’t necessarily have to be a text file. Everything is a file in Linux, but it’s not a directory which contains other files. Let’s put it so let’s open it up. There is another command which you can use. It’s called less ketchup. Speak more about text editing commands and the commands which you can use for test displaying. But here I just want to demonstrate how you can confirm that indeed it is not a directory, rather it’s Ups, not some secure instead it’s for Ups. What does it say? Permission denied what could that be? What could the reason be? It doesn’t actually allow us to list the contents of the secure of the file name secure what is the problem?
Well, let’s take a look the owner of this file is root root group that is and the root user because this column here it tells you who the owner is, which user is the owner and this column here actually tells you to which group which group does own that file? Two different things let me just explain this further to you. Let’s say that a company has a Linux system running and that you have within that company management department and you have accounting department so there will be users in accounting department which would belong to an accounting group and there will be users in the management department that would belong to management group. So you would have, I don’t know, Kevin Smith, who belongs where it says Root here. You would have, I don’t know, Kevin Smith. That belongs to the group accounting. You also have this group which I am displaying here, which is Root.
That is fundamentally for control of all things on the system roots. Root pretty much is almighty. There is nothing that is beyond the grasp of Root. Anyway, let’s just go ahead and clear the screen here. As I said, I will deal later on more with text editing commands and how you can create files, edit them and less for the time being. I just want to show you the LS and explain it further. So LS LH and a Excellent. So what has changed? What can you notice that has changed? In the output of this file? It says 4 again, 12 KB. These files are pretty small. There’s nothing in megabytes here to show, but it doesn’t matter. This is basically a human readable format of file sizes. Look at the difference. Okay, so how easy is it to read this? You have to compute basically figure out the file size.
It’s pretty small here, so you can say it’s 4 KB. But I mean, imagine if, I don’t know, 4. 5gb were represented in Kilobytes. That would be hilarious because you would have a huge number here and you would basically need to compute how much is that in gigabytes, which is absurd. Rather instead you can just add h to the LS command, the argument age, and you will immediately get the file sizes for pretty much all the file here. One more thing. You have A, which enables you to list pretty much everything that if there are some hidden folders, they will be listed, rest assured. You can also say that it omits these two if you want, but that’s not a big deal. Rather instead, this is your current directory. It represents your current directory. And this one, it represents the directory which precedes this one. So dot and double dot. I’ve shown that with the CD command. Anyway, let’s go ahead and clear the screen now and type in LSpace help. This is a universal way to get more information on what a particular command does and what sort of arguments can you actually pass to that command. You can also try typing in H, but that’s not going to work for LS. You see, it just prints things. Rather instead, just type in Help. Most of the commands will accept h, but Help is more universal. Let’s put it so if I press Enter, I don’t have a listing of the current directory.
Rather instead I have a Help menu which pretty much gives me the list of all arguments. It tells me what each of those arguments does. And on top, let me just show you on the top, it gives me the example of usage. Very nice, right? So LS and then I pass in the option which is one of the arguments below. And you might notice that there is also a file here. So what could this mean? Let’s have a look. But before we do, I would strongly recommend to all of you these things are pretty simple. Just feel free to read through this. Through some of them. You don’t have to read through all of them. The ones that you will be using on daily basis will be the A. Hold on the H of course it’s the dash which is right here. Also you have the long version of the argument. So instead of dash you can also pass this long version of it. But I don’t think that there is ever a need for such things.
It doesn’t print group names to shorten the output if you want. So what else are we going to need? Let’s see if there’s anything else. There is definitely something. There we go. I knew I was looking for something that I wanted. dashr is basically recursive. So list sub directories recursively. Now we’re going to try to use that as it’s going to come quite in handy. Look at what I’m going to do. So clear if I type in from here lshome sorry I don’t need home, I’m already there. Let’s go to downloads. There we go, downloads. And there is literally nothing there. Forget about that. Let’s go. LS just of the root directory and then type in VAR. Okay, so I have just told it to list the contents of the directory VAR press enter. There we go. Even though my current working directory is VAR log, I have stated that I want the directory to be listed. The contents of some directory should be listed.
So here you can actually specify a path direct to the directory you wish to see. So you can see the contents of any directory on the system from any location on the system as long as you have the proper permissions to do so. Let’s try something else. Let’s try lsrboot. This is going to give you a lot of information. Where is it? Where is it? LS should be around here somewhere. There we go. So there we go. LS space R for recursive output. Space path to the file, path to the directory. Okay. The first thing that it does it gives me the listing of boot. Second thing that it does, it gives me the listing of boot grub two and then it shows me what is in that directory.
And then you see the directory grub two has a sub directory of fonts. The next thing it does, it does boot grub two and then fonts and then it shows me the listing of that particular directory and so on and so forth into as long as there are subdirectories to the current directories it shows the entire listing of pretty much everything. A fantastic way to go about things and you are able to see pretty much anything anywhere. Anyway, I shall call the tutorial here and then we will continue in the followup.
3. Finding files. Commands “find, locate, updatedb, man.”
Welcome everybody to this tutorial. Today I’m going to go over a few more commands with you. The first one that we shall deal with is the command man. So man actually is basically a manual or man pages for a specific command. So for example, you can type in Man LS and it’s going to tell you everything that there is to know about the LS command. Sometimes they help the help part of the command. So LS Help is not formulated to the best and you get a list of arguments, but for example, you don’t get the description of what each one of those arguments does. You only get the syntax of the command and how you should type it in. But you don’t really know how it actually what will a certain argument do to the command? How will it modify it. Man pages also have a help menu. So if I just type in Manhatelp, you see that I have a lot of options here. Most of these things are actually related to the search part, to searching through Manpages, or to searching for the right portions of the man pages and formatting their output. But I didn’t really find it necessary over the course of the years to use most of these. Basically man and a certain command will suffice anyway. Aside from that, I would recommend that you just go ahead and read through them just to see what options you have.
You don’t need to memorize them as you always have them in the help bar, but just have a look at it and that will be sufficient. It’s a good thing to know how to use man pages and just to know that they are there so that you can refer to another source. If the help menu doesn’t actually suffice, let’s just go ahead and clear the screen. The next command which I wanted to deal with you is Touch. Touch is used for creating files and in combination with this I will also teach you how you can actually search through your system for a certain file. Now usually there are two methods. One is preferred over the other. For example, you have locate. So very simple plain English language and you have Find. Now Locate is a lot faster than Find, but it does require the database to be updated. And don’t get intimidated right away. There is not the process of updating the database is basically one word command. That’s it. Anyway, before we get into that, let’s just go ahead and see how Touch works. Touch and let’s say that I want to create file one. File One. So this is just a reference name that I’m creating. You can basically smash your keyboard here and name your file. There are some limitations as to how you can name your file, but generally you can pretty much name it to anything within pretty much anything that suits you. So let’s create let’s use file One.
Let’s do it like this, file one if I press Enter and then if I list it, you can see that the file one is there. But look, there is a shortcut to the LS. If you don’t want to do this LSpace, l for the long listing, which is generally more preferable than just the LS, you can simply use the Ll command. And if you use the Ll command by default, you will be given a long listing for that directory. Ll works pretty much the same as LS. So you just type in Ll. You can also specify a path. So let’s say the root, simple as that. And you can also say Llrroot. You see it gives the recursiveness here, so it works in the same way, except you just tap l twice and press Enter and get a log listing. It saves you a ton load of time, trust me on that one. Anyway, we have created file one, but we can also create multiple files like this. It is a rather fast way of doing that. So we just do touch. And you can also specify a directory where you want the files to be created. For example, I can go ahead and type in Downloads and then I can say file two, sorry, file three. And then I can change the directory path. I can say, okay, now I want you to go to Documents and I’m going to say file, file, I messed it up with three, I’m going to fix it shortly. I can say here file four. So it gives you the ability to create files pretty much anywhere in your system where you have a permission via the single command line. Very useful.
We press Enter and there we go. It has indeed created them. You can confirm it by doing the listings. So downloads, there you go. So file two and three. And you can see there’s another file. It says Find me. I have used it to conduct some tests previously. If I go ahead and type in Documents, here you go. You see that the file four is indeed there. Just go ahead and clear the screen and deal with the subject of two more commands, which is Find and Locate. We’re going to deal with Find first. You will use Find only if you know where something is in specific. You definitely don’t want to use Find to search through your entire system because that’s going to take a while. Not a pretty site, I can tell you that. Not a pretty weight. But here you go. You can type in find. That’s why we use Locate, the TSA database that’s much faster, that can search through the entire system at practically no time. So just you type in Find and then you’re going to specify the directory in which you want it to search. You don’t need to specify the directory. You can just go ahead and type in your search pattern here with an argument, but whether instead I want to specify the directory because it would be highly inefficient to actually just say go ahead and search through the whole system. Although sometimes you need to do that and that’s why locate is so nice. I personally always use Locate instead of Find, but I just figured I would show it to you. Anyway, let’s say that I want to go into my home directory and there I will conduct a search. So if I type in name, then space quotation marks, I will say file one search. Excellent. So it has found it relatively fast. It says home, random guy, file one. It has been found indeed. But what if I did this? What if I changed this letter to lowercase letter? Guess what? Nothing is found.
It does not exist. Linux is case sensitive. I believe that I’ve mentioned this previously, if not Ol and two files having the same name, the only difference being lowercase letters and upper case letters are two completely different names for the Linux system. So it is case sensitive to the point of extreme and you should all be very much aware of it if you want to ignore the case. The usual argument for the commands which deal with text formatting is I. So you just add I to the name and you see it has indeed found it. Usually dashi is to ignore something generally in all commands. Anyway, I could have just said if I don’t specify a folder path, it’s going to let’s see, where am I at the moment?
So PWD, okay, so I’m in home and random guy and if I just and if I am in the current working directory where the file is located and if I do this, it’s going to find it. But suppose I am not. Suppose I do go and change it to root. What has happened here? Well, first of all, we have been issued permission denied for a download of folders. If I do Ll, we are unable to access most of these folders as our current users, so the Find will not even be able to look for them there.
That’s the first problem. The second problem is that even though it can access the home directory, it hasn’t actually found it because it is only looking here. There you go. So all of these things are permission denied. Permission denied. You are unable to access it. Be sure that you execute a Find command from a place where you have access to other folders and their subfolders. Please be aware of that. Otherwise you will not be able to actually execute Find at all. You will just get the same error that I have gotten. So here we go. I typed in Find and it says in Aim and says file zero one. Excellent. So it has immediately found it here in the home, even though I’m in my root directory, no problems. So it does jump in to the folders recursively, which is very nice. But look here where it tries to look for the file says permission denied. Permission denied. Permission denied.
You cannot access these files or folders and provided that your file is in one of those places, it will not be able to find it at all. That can be extremely problematic. That’s why we need root permissions, pseudo and su. Later on we will deal with that. But for the time being, I just want to show you this. Anyway, if I go ahead and clear the screen, there is another command which we can use, which is very nice. I personally prefer to use it. It’s called locate. If I just type in locate so file one oh, what is this? It hasn’t found anything what could be the problem? Well, as I said, Locate uses a database and that database is updated on daily basis which is resource inexpensive but also inefficient. However, the beloved Linux creators and the Locate creators developers have left us with a very nice option here. You just type in update, update, DB, press Enter. Cannot open temporary file. Yeah, okay. So one more thing. You cannot do the update without the root permissions. In order to obtain root permissions, well, you just type in su, press Enter. Type in your root password. You’re not going to see anything here. It’ll be blank. This is done as a precautionary measure. And of course, I’ve typed in the wrong password. You see when I type in my password. Nothing is shown in Unix Linux like systems, every time you type your password into the terminal, usually 99% of the cases the length of the password will not be shown. It will not show as though you’re typing anything? Don’t worry, it’s not broke.
It’s just a security precaution so that if somebody’s watching across your back, over your back, they won’t be able to see the length of the password on the screen. Which is? A very nice feature and I would very much like for Windows to implement it as well, although it is not really practical. As I say, you just have to get used to it because even though you’re typing something you can’t see anything on the screen. I would also like some other services, for example, like Gmail or Amazon as well for cloud hosting and stuff like that, to actually implement that version of authentication so that the lengths of the password are not shown because if somebody has the length of your password, the amount of possible combination reduces drastically. Anyway, now that we are root, let’s go ahead and clear the screen so you can see that I am no longer a random guy. I am root at this is my host name. I’m going to change the host name later on, but for the time being, this is the one. So I am logged in now as root at this host name at this machine. Let’s type in update DB. Excellent. And let’s type in locate again. So Locate and what do we need? We need file one.
There we go. It has found it immediately. But look, you can type in help and there is an ignore option here. There you go. Look, it is the same, exactly the same as with the find command. So I clear. Type in locate i, file one. Okay, let’s kill the capital letter. Excellent. So let’s just change the name a little bit more. Type in like this. It’s still going to find it. So no problems. But let’s say you don’t know the whole name of the file. You just know the fragment of the name or the portion of the name or something of a kind. Well that can be problematic. So what you want to do is type in locate I space and here you can actually just type a fragment of the file name. So I don’t know, let’s say it’s late, this is going to give me too much stuff, but let me just show you. So file, look at how much stuff we got. And I don’t want to sip through all of this, but I can assure you that the name is actually within this. However, you do need to actually filter it a little bit more.
So let’s say underlied and a zero. There we go. It has indeed found what we were looking for. And in addition to that what we were looking for, it has also found anything else containing this particular pattern. Anyway, the file is actually contained here as well, somewhere God knows where. But if you don’t actually know anything, if you just know a fragment of the name, then you’re actually going to have to manually sip through this. Unless you are able to learn more or guess more about the name of the file, eventually if you sip through all of it, you will find it God knows where somewhere I guess. But if you’re looking for libraries or something of a kind, you generally know that they were in user share lib somewhere of a kind. Or if you know where you’ve approximately saved something. You don’t need to search through the entire file system. You can just specify a path and then a name to the path. You can just specify a path. Hold on, I didn’t show you how to do that. But locate, let me just do this. So locate file zero, and if I say home. Okay, so has it actually been able to find anything?
Yes. There we go. So in addition to a ton load of stuff which is basically your home directory, as it has taken that as a search pattern as well, it has actually managed to find this. But this is not what we’re looking for. This is not good enough because it is taking the folder path as a search parameter. So it’s giving us more results than we generally need. So this is no good. What we need is the help menu help. And we need to actually find a way to exclude the path to the file. I’m sure it is here somewhere, so let’s take a look at it. I’m approaching. I have an approach so that I am putting myself in your shoes and this is how you would do it. If you wouldn’t know how to do it in the first place, this is how you would learn how to do it. So basically what do we have here? You always go to the help and you figure out from there we have a what does that do? Only print entries that match all patterns. Nope, that’s not really match only the base name of the path names.
This could be it. Only print number of found entries. Use database only print entries. No ignore for backward patterns. No, let’s just use the B option. So B and let’s go to Home and then space file I don’t know zero. We’ll play around with it more. Excellent. So what have we gotten here? It says in the Ups, mike seems to be running away a little bit. It says B base name match only the base name of the path names. Very simple. It will just go down to the last entry and that will be it. Excellent. So within Home folder and within all sub directories of that folder, please look for anything, any pattern that contains please find any file that contains this particular pattern which we have given it. So if you compare, let’s say this to this, it’s a lot shorter, right? You have significantly downsized the amount of possibilities. Very useful command people use it on a daily basis. Just don’t forget to update the database.
It is necessary for you to do so if you want to find stuff because it is updated once a day and it’s not enough. You just need to update it manually and you will solve the problem. There are ways to configure it to update on more frequent basis, but there is no need. You’re just consuming resources. Rather instead just type in update DB and it’s going to be done in mill seconds. Then find whatever it is that you are looking for without any problems whatsoever. Anyway, I bid you all farewell. Until next time.
Interesting posts
The Growing Demand for IT Certifications in the Fintech Industry
The fintech industry is experiencing an unprecedented boom, driven by the relentless pace of technological innovation and the increasing integration of financial services with digital platforms. As the lines between finance and technology blur, the need for highly skilled professionals who can navigate both worlds is greater than ever. One of the most effective ways… Read More »
CompTIA Security+ vs. CEH: Entry-Level Cybersecurity Certifications Compared
In today’s digital world, cybersecurity is no longer just a technical concern; it’s a critical business priority. With cyber threats evolving rapidly, organizations of all sizes are seeking skilled professionals to protect their digital assets. For those looking to break into the cybersecurity field, earning a certification is a great way to validate your skills… Read More »
The Evolving Role of ITIL: What’s New in ITIL 4 Managing Professional Transition Exam?
If you’ve been in the IT service management (ITSM) world for a while, you’ve probably heard of ITIL – the framework that’s been guiding IT professionals in delivering high-quality services for decades. The Information Technology Infrastructure Library (ITIL) has evolved significantly over the years, and its latest iteration, ITIL 4, marks a substantial shift in… Read More »
SASE and Zero Trust: How New Security Architectures are Shaping Cisco’s CyberOps Certification
As cybersecurity threats become increasingly sophisticated and pervasive, traditional security models are proving inadequate for today’s complex digital environments. To address these challenges, modern security frameworks such as SASE (Secure Access Service Edge) and Zero Trust are revolutionizing how organizations protect their networks and data. Recognizing the shift towards these advanced security architectures, Cisco has… Read More »
CompTIA’s CASP+ (CAS-004) Gets Tougher: What’s New in Advanced Security Practitioner Certification?
The cybersecurity landscape is constantly evolving, and with it, the certifications that validate the expertise of security professionals must adapt to address new challenges and technologies. CompTIA’s CASP+ (CompTIA Advanced Security Practitioner) certification has long been a hallmark of advanced knowledge in cybersecurity, distinguishing those who are capable of designing, implementing, and managing enterprise-level security… Read More »
Azure DevOps Engineer Expert Certification: What’s Changed in the New AZ-400 Exam Blueprint?
The cloud landscape is evolving at a breakneck pace, and with it, the certifications that validate an IT professional’s skills. One such certification is the Microsoft Certified: DevOps Engineer Expert, which is validated through the AZ-400 exam. This exam has undergone significant changes to reflect the latest trends, tools, and methodologies in the DevOps world.… Read More »