Transcript for:
Essential Linux Utilities and Applications

hey everyone welcome back to another video here on try hackney i am john and today we're going to be taking a look at the linux fundamentals part three room power up your linux skills and get hands on with some common utilities that you're likely to use day to day this room is the third and final room in the linux fundamental series and with that being said let's go ahead and dive right into task one introduction welcome to part three and the finale of the linux fundamentals module so far throughout the series you have got hands-on with some fundamental concepts and use some important commands this room is going to showcase some useful utilities and applications that you are likely to use day to day you're also going to advance your linux fuse skills by learning about automation package management and service slash application logging let's proceed we'll go ahead and mark this as completed and move into task 2 and deploy our machine so i'm gonna go through this since we've already covered this in part two in order to proceed with this room we need to start but the machine that's attached to this task and the information about that machine is going to appear at the top and then we also want to shut the attack box with this blue button up here we'll go ahead and glaze through this looks like we are going to be sshing into this machine with the credentials of try hack me and then a password of try hack me so we'll work this as completed and i will pause the recording once the machine is up we will go ahead and ssh into our target box and we're back so i've gone ahead and let the machine load and then we have also pulled up a terminal here let's go and ssh into our target machine now one note uh there is an ip address that will populate down here the try hack me rooms wherever you see that machine ip that will be replaced once the box is actually live and it has that ip address assigned and you can just see it in uh in line with the text and that was the case right here that being said let's go ahead and ssh in with the credentials try hack me at 10 10 231 247 and make sure that you are not using my box ip this will not work for you you need to make sure that you're typing in the one that you are targeting and there we go if you have any difficulties with this please jump back to part two right at the beginning of that uh i go through how to uh ssh into a machine like this into in further detail that being said let's go ahead and move on to task three terminal text editors throughout the series so far we have only stored text and files using a combination of the echo command and the pipe operators so a single greater than which is the redirection operator and then the pension operator double greater than this is an inefficient way to handle data when you're working with files with multiple lines in the sorts introducing terminal text editors there are a few options that you can use all with a variety of friendliness and utility this task is going to introduce you to nano but also show you an alternative named vim which try hackman is a room dedicated to this is worth checking out that room is very educational nano it's easy to get started with nano to create or edit a file using nano we simply use the command nano and then the file name replacing file name with the name of the file you wish to edit and if that file does not exist and you have permissions to write that to that directory you can use nano and then the file that you want to create for the file name and then as long as you save when you exit that file will be created otherwise it will just either overwrite or start modifying whatever file you select as long as you have permissions to write to it once we press enter to execute the command nano will launch where we can just begin to start entering or modifying our text so here we can see that after running that we are greeted with the nano text editor this is a little bit small on my screen however going through and playing with this you'll become very used to using nano very quickly it's very intuitive and it's the text editor that i use pretty pretty regularly on the command line that being said while we're going to go over nano it's worth having at least a minimum comfort level with a couple of the other uh text editors just because nano won't always be installed and the other editors are not too tricky to learn either that being said let's go ahead and move on you can navigate each line using the up and down arrow keys or sort a new line using the enter key on your keyboard so very similar to less and we'll be reviewing the man pages uh very very similar to that where we can navigate with the arrow keys and here you can see we have a bunch of shortcuts here at the bottom nato has a few great features that are easy to remember and covers uh the most general things you would want out of a text editor including searching for text which you can see right here with the control w copying and pasting and you should be able to see i'm not seeing it oh there we go right there jumping to a line number and then finding out what line number you're on very basic things and they're very nice especially if you need to edit a program edit a script or you're just taking notes in nano you can use these features of nano by pressing the ctrl key which is represented as a carrot or an up arrow on linux and you can see that right here and a corresponding letter so for example if we wanted to exit we would want to press ctrl and then x to exit nano now one thing to note if you've modified a file it will prompt you to press y or n to confirm if you want to keep those changes or discard them and you can see the exit command over here in the corner in case you ever forget it let's talk briefly about vim vim is a much more advanced text editor whilst you're not expected to know all advanced features it's helpful to mention it for powering up your linux skills and you here you can see this is the basic vim text editor some of them's benefits albeit taking a much longer time to become familiar with include customizability you can heavily modify the keyboard shortcuts to be of your choosing i believe you might be able to do this in nano as well however vim it's just a lot easier and generally speaking if you need advanced features you're probably going to moving on to using them anyways syntax highlighting this is useful if you are writing or maintaining code making it a popular choice for software developers very common to be using vim especially if you are in a developer environment and you are just remoted into whatever machine is running your test web server if you want to try a sample change in your test environment changing into vm is probably your best option vim works on all terminals where nano may not be installed nano is not always installed vm will typically always be installed it's very rare to not have vm available there are lots of resources such as cheat sheets and i recommend bookmarking this tutorials and sorts available for you to use and again try hack me as a room just on vim i highly recommend going through this uh we've mentioned previously in part two that there is a fine command room i recommend going through that and the vim room it they are both very helpful an expression of the find command it was very insightful when i went through it create a file using nano let's go ahead and do that right now so we'll do nano and then let's call it hello so here we have the nano text editor very straightforward we saw this earlier in the task if i type something in here such as hello world we can do control x and we can see that it wants just to confirm the changes that we've made to the file and in this case since we can write to it we can write just press y and we save our file and we confirm that the name of the file is going to be hello press enter and there we go we've exited and if we run ls we can see that we have hello available there and if we track it as well using file we can confirm that we created an ascii text file pretty cool edit task 3 located in tri hackme's home directory using nano what is the flag let's do nano task 3 and we can see that our flag is thm text underscore editors and there we go cool let's go ahead and close out of that and note because i didn't make any changes nano did not prompt me to confirm those changes let's move on to task 4 general slash useful utilities downloading files a pretty fundamental feature of computing is the ability to transfer files for example you may want to download a program a script or even a picture thankfully for us there are multiple ways in which we can retrieve these files we're going to cover the use of wget this command allows us to download files from the web via http as if you were accessing the file in your browser http is just the basic web protocol for a website that's uh running without encryption you've probably interacted with a website like this before you don't need to know too much about the actual web protocols just know that this is one way that websites can respond we see the other way or the other major way i should say is https uh the s stands for encryption so there is the ssl socket layer running there don't worry too much about that it's outside of the scope of this room just know that that is there this is in clear text but it's useful if you just want to download things we simply need to provide the address of the resource that we wish to download if we want to download something in this manner for example if i wanted to download a file named myfile.txt onto my machine assuming i knew the web address it is at it would look something like this and you can see an example down below where we have wgent and then we have the file that we're actually going to download that downloads the file to our current working directory so just wherever we're running this command from transferring files from your host using scp via ssh secure copy or scp is just that a means of securely copying files unlike the regular cp command this command allows you to transfer files between two computers using the ssh protocol to provide both authentication and encryption very very helpful and this is uh this may be overwhelming at first but i promise you that the syntax on this is very intuitive once you've used it a couple times working on a model of source and destination scp allows you to copy uh files and directories both to and from your current system and remote systems as long as you have ssh access you can go through and copy files very cool and very straightforward provided that we know usernames and passwords for a user on your current system and a user on the remote system we can go ahead and copy files from our machine to a remote machine and here we can see that the command has already been laid out in this table i'm gonna go ahead and walk through it in the full command down below and let's break this down now first we have the command scp which specifies that we're using secure copy we are copying a file from our computer here so the source is here this would be flipped around if we wanted to grab this from a remote machine however we're grabbing something from our local machine named important.txt and we're transferring it to a machine where we are logging into as ubuntu and then again note this is the same syntax as ssh with the ip address here and then we have a con with the actual location of where we're going to transfer that to so very straightforward think of this as ssh and cp if they were combined together again if we wanted to transfer something from the remote system to our local system it will be reversed and we can see that down here below where we have scp the command which is just ssh and then the actual location of the file and then we're copying it to our current working directory and having it named as notes note we can rename things as we copy again this is very straightforward and very similar to what we saw with the cp command the normal copy command serving files from your host with web ubuntu machines come pre-packaged with python 3. python helpfully provides a lightweight and easy to use module called http server this module turns your computer into a quick and easy web server that you can use to serve your own files but they can be downloaded by another computer using commands such as wget and curl python 3's http server will serve the files in the directory that you run the command from but this can be changed by providing options that can be found in the man pages simply all we need to do is run python3 m for the module that we're going to run and then http dot server now note there's an extra space here you don't need these two spaces it's just one space and even then python should just ignore that extra space so running that will start the module and note that this will occupy your terminal because it's a running process this is an example where having this running in the background can be very helpful especially if you want to work in one terminal and you're not working with something like tmux tmux and other multitasking solutions are again outside of the scope of this room however just know that they exist and there are other ways that you can accomplish these tasks in the screenshot below we are serving from the directory called web server which is a single file named file so we are in on this computer the web server directory in this user's home directory and then we can see that there's this file file and then we run the python 3 server or the python 3 web server rather and note that it searched by default on port 8000. you can specify this by using the dash lowercase p switch and you can see more in the man page for this there's a bunch of different options and it's very very cool by and large this is going to be one of your best friends as far as tools go especially if you are going further into pen testing and need to transfer things to and from a remote machine now let's use wget to download the file using the computer's ip address and the name of the file one flaw with this module is that you have no way of indexing so you must know the exact name and location of the file that you wish to use and the author talks a little bit about updog here this is actually what i use as well it is a very nice python module outside of the scope of this room but i definitely recommend looking into this as it is incredibly useful just for file transfers in general that being said here we have an example broken down we are running ls to confirm that there's nothing in this current working directory of files and then we are running wgant this is on our same host so we're just downloading something from one part of our machine to another but it's just an example and we specify the full web url specifying that it is on port 3000 and that we want to or 8 000 rather and that we want to pull the file named file we can see that it is in the process of downloading it here and this will actually move as you are running this command so if it's pretty big it will show a progress bar down here and it's nice it's very intuitive to use once we've completed that we can see we've downloaded the file here in the screenshot above we can see that the wget has successfully downloaded the file named file to our machine this request is logged by simple http server much as any web shaver would which i have captured in the screenshot below and here you can see that this is an example of the web server logs we saw a little bit of this in the linux fundamentals part 1 room and you can see that that log is very much real that was i believe in apache 2 log however you can see an example of even how this as a simple http server is able to actually do this ensure that you were connected to the deployed instance we've gone ahead and done that we've ssh in if you have not i recommend backtracking and making sure that you are asset your ssh into it now use python 3's http server module to start a web server in the home directory of the try acme user on the deployed instance let's go ahead and do that now so i've cleared the screen with control and l and we want to do python3 dash m http.server and there we go again like i said this consumes your terminal so running this in the background can be really helpful or running it in another tab which you can see up here however let me go ahead and not kill my process there we go and i'm going to go ahead and open up another tab like so we'll mark this as completed since we've gone ahead and pulled that file or inserted the web server rather now we want to download a file hosted at this address we can go ahead and do that now with wget http and then 10 10 231 247 and then we need to do colon 8000 again because this is running on port 8000 and we're going to grab the dot flag file from flag.txt file and we're just downloading that to our current working directory and there we go it's pretty fast we can see now if we do lstack l to show or ls attack a rather and let me clear the screen we can see that we have this dot flag file now if we go ahead and cat dot flag dot txt we can see that we have our flag for the web server which is thm wget underscore web server and there we go create and download files to further apply your learning so play around with this a little bit try uploading and downloading some files or downloading some files rather it is good to get some practice with this and this is something that you will use very regularly so just keep that in mind once you're done with that we'll go ahead and go back to our remote machine and use ctrl and c to interrupt that process and close it out and again i've clicked the screen after that with control now let's go ahead and mark that as completed and move into task 5 processes 101 processes are the programs that are running on your machine they are managed by the kernel where each process will have an id associated with it known it also knows it as its pid or process id the pid increments for the order in which the process starts so for example the 60s profit or process will have a pid of 60 and so on and so forth viewing processes we can view the friendly or we can use the friendly ps command short for process to provide a list of running processes as our user session and some additional information such as its status code the session that is running it and how much time of the cpu it is using as well as the name of the actual programmer command being executed and we'll dive into this in just a little bit to get more information on what's actually running in this system note how in the screenshot above the second process ps has a pid of 204 and then the command below it has the 205. this is just incremented and it's showing that each process is going to have a subsequent pid number incremented by one to see the processes run them by other users and those that don't run from a session so for example system processes things that are started when your computer search and they're just running on the computer without any user attached to them we need to provide aux to the ps command like so and we can see by running that we have a lot more information as well as commands that aren't being run by our current user so quite a bit of information the user that's running over here the pid cpu and memory usage a couple other bits of information which i won't worry too much about the start time and date here and then the command that's actually being run note that we can see a total of five processes note how we now have root and cmnatic here so we can see that over there another very useful command is the top command top gives you real-time statistics about the processes running on your system instead of a one-time view these statistics will refresh every 10 seconds but will also refresh when you use the arrow keys to browse the various rows another great command to gain insight into your system is via the top command or h-top which will give you a colored version of this and you can see an example output of the top commit there now one thing to note that is a process that you have to use ctrl c to exit i will take up your current terminal and you just need to close it once you are done looking at what's actually running managing processes you can send signals that terminate processes and there are a variety of types of signals that correlate to exactly how cleanly the process is dealt with by the kernel to kill a command we can use the appropriately named kill command and the associated pid or process id that we wish to kill so for example we can use to kill the process id one three three seven would use kill and then the process id number below are some examples of signals that we can send to a process when it is killed so we have sig term sig kill and sig stop this is kind of the varying levels of niceness that you can stop things with so sick term we kill the process but don't we do allow it to do some cleanup tasks so we're telling it hey you need to stop but you can clean up after yourself sid kill kills the process and it doesn't do any cleanup and then sig stop just stops it it doesn't allow it to do anything it doesn't actually end the process it's just pausing it or suspending it in a specific case how do processes start let's start by taking or talking about namespaces the operating system or os uses namespaces to ultimately split up the resources available on the computer uh to processes so those resources specifically we're looking at are cpu ram and then the priority at which they run uh priority is how important they are for the system and if there is contention for that cpu time this is outside of the scope of this room just as a heads up if there's contention for the cpu and ram usage the higher priority process will get that the priority there think of it as splitting up your computer into slices similar to a cake processes within that slice will have access to a certain amount of computing power however it will be a small portion of what is actually available to every process overall namespaces are great for security as it is a way of isolating processes from each other only those that are in the same name space will be able to see each other so think of it as just kind of sections of like a cake if you have a section of a cake and you hand it to someone else and they walk away with it they don't know what the rest of the cake looks like and that's kind of how a namespace works in this specific way they might be able to guess but ultimately they have no idea we previously talked about how pid works and this is where it comes into play the process with an id of xero is a process that is started when the system boots this process is the systems in it on ubuntu such as systems which is used to provide a way of managing a user's processes and stitch between the operating system and the user so what does this actually mean this is the process that is the manager it handles how the other processes actually run and it's ultimately kind of the overlord of the process realm for example once a system boots and it initializes systemd is one of the first processes that are started any program or piece of software that we want to start will start as what's known as a child process of system d this means that it is controlled by system d but will run as its own process although sharing resources from sharing the resources from systemd to make it easier for us to identify and the likes and here you can see that it has the pid of one in this example and that's just taking a look at this with top getting processes services to shirt on boot some applications can be started on the boot of the system that we own for example web servers database servers or file transfer servers this software is often critical and is often told to start during the boot up of the system by administrators generally speaking if you're running a web server and you want to have that web server constantly running on that machine whenever you reboot it you want it to start up automatically and that's where this can be really useful this is also very useful if you're hosting game servers and other things like that in this example we're going to be telling the apache web server to be starting apache manually and then telling the system to launch apache 2 on boot don't worry too much about what this is again outside of the scope of this room just know that this is a general a very common web server that we will see in the wild enter the use of system ctl or system control this command allows us to interact with the systemd process slash daemon and continuing on with our example systemctl is an easy to use command that takes the following formatting so we have systemctl the actual option that we want so for example these options down below and then what service we're actually targeting very straightforward once you do this a couple times this is very intuitive and something that's very very easy to guess at what the service name is for example to tell apache to start up we'll use the system ctl start as the actual option and then we're targeting the apache 2 service seems simple enough right same with if we wanted to stop apache 2. we just replaced the option right here with stop instead of start like we provided and here are the four options that we have so minus status there are a couple more options here status will tell you what the actual status of that processes is if it exited with an error or if it's running so on and so forth then we have start stop enable which enables it to actually run at startup and then disable which tells it hey i don't want you to run at startup an introduction to backgrounding and foregrounding in linux processes can run in two states in the background and in the foreground for example commands that you run in your terminal such as echo or things of that sort will run in the foreground of your terminal as it is only the only command provided that hasn't been told to run in the background and again i prefaced this a little bit earlier when we were talking about having things running in your terminal and kind of consuming that space running things in the background especially if you're doing a file transfer that's going to take a while it's easy just to background them and then forget about them until they're done echo is a great example as the output of echo will return to you in the foreground but it wouldn't in the background uh so here we can see that we're running echo and this is without it being backgrounded and we run it again so normal output there run again again with it being backgrounded and it gives us back our input or the actual echo here later on after it's started this background process with this process id here we're running echo high thm where we would expect the output to return to us like it is at the start but after adding the ampersand or the background operator to the command we're instead just given the id of the echo process rather than the actual output it is it is running in the background this is great for commands such as copying files because it means that we can run the command in the background and continue on with whatever further commands we wish to execute without having to wait for the file to finish copying first we can do the exact same when executing things like scripts rather than relying on the background operator rather we can use control and then z to force a process to background this is an effective way of pausing the execution of the script or command like in the example below so we have this process that's running on loop and it's just permanently running on loop until we cancel it or just tell it to sig kill or something like that we are going to go ahead and force it into the background with ctrl and z and it's just raining in the background it's no longer consuming our terminal and we have our terminal teletype prompt back up this script will keep on repeating this will keep on looping until i stop until i stop or suspend the process by using control and z as indicated by the uh carrot and then z right there we've gone ahead and background it and our terminal is no longer filled up with these messages until we foreground it which we'll discuss right now foregrounding a process now that we have a process running in the background for example our script background.sh which can be confirmed by reusing the ps aux command we can back panel and bring this process back to the foreground to interact with as this is just going to keep running in the background until it finishes or until we kill it with our process backgrounded using either control and z or the ampersand background operator we can use fg that command to bring this back to focus like below where we can see the fg command is being used to bring the background process back into use on the terminal where the output of the script is now returned to us so we've run the foreground command fg and now our terminal is filled with garbage but we've brought it back to the foreground read me we've gone ahead and done that some homework that is complete if we were to launch a new process or a process where the previous process id was 300 what would the id of this new process be that's going to be 301 again that increments by one every time we run a new process if we wanted to cleanly kill a process what signal would we send it that should be sig term and that gives the process time to clean up after itself and end things locate the process that is running on the deployed intra instance what flag is given so we're going to go ahead and run ps aux and then i'm going to use a couple other things that we haven't necessarily learned to make this easier for the sake of the video i'm using the pipe operator which takes the output from this psa ux command and passes it straight into another command called less less is like cadding things but it gives us the ability to scroll through the output and it's much easier for the sake of the video so we can go ahead and scroll down and at some point we'll be able to see a flag just kind of hanging out in here and it might take a moment but we should be able to find it there we go so here we can see and it's a little bit squished because i have everything zoomed in on my screen but we have thm and then processes for our flag assassins there we go what command will be used to stop the service my service and that would be the let's see we want system ctl stop my service took me a moment to think about that what command will be used to shirt the same service on boot up of the system that would be system ctl enable because we wanted to run on boot and then my service and then what command would we use to bring a previously backgrounded process back to the foreground that will be fg short for foreground let's go ahead and move into task six maintain your system with automation users may want to schedule a certain action or task to take place after the system is booted take for example running commands backing up files or launching your favorite programs on such as spotify or google chrome we're going to be talking about the cron process but more specifically how we can interact with it via the use of cron tabs cron tabs are one of the processes that are sorted during boot and it's responsible for facilitating what are known as cron jobs think of that as just auto shielding things they're tasks for example i believe windows it's called test scheduler i haven't used in a little bit but that is the same way that you would do that on windows and i'm sure that os x has a similar way to do this as well a cron tab is simply a special file with formatting like so and we'll walk through this in a moment that is recognized by cron or by the crown process to execute each line step by step crown tabs result or require six specific values and we can see that these values these first five are so we can specify when we want this to run and then the actual command we want to run pretty straightforward i won't walk through this i recommend adding those to your notes though let's use the example backing up files you may wish to backup cmnatix documents every 12 hours and we would use the following command formatting to do exactly that so here we see that we have our full command written out an interesting feature of crontabs is that we also support the wildcard asterisk and this can be found on the 8 key to actually specify that we want this to run at every single interval in that specific field if we do not wish to provide a value for that specific field i.e we don't care what month day or year it is executed only that it is executed every 12 hours we simply place an asterisk and here we can see that in this first field that we're specifying this is going to happen at the start of the hour every 12 hours and every day of the month on every uh month of the year and every day of the week so and then we have actually our command here at the pod or at the end of that this can be a little bit confusing to begin with and don't worry too much about this this is something that you just need to have a general knowledge of um however there are some great resources online such as the cron tab generator recommend bookmarking that and that allows you to use a friendly application or it's a friendly application rather to generate formatting for you as well as a sitecron guru so if you know what you want to do but maybe you're not the most comfortable with this formatting you can use crontab generator to get it all whipped up for you pretty straightforward crown tabs can be edited using crontab dash e specifying edit where you can select an editor such as nano and it will prompt you for this on your first time using this to edit your cron tab and here you can see an example of the crontab generator there and we can see editing it with nano down below ensure you're connected to the deployed instance and look at the running crown tabs so let's go ahead and use cron cron tab dash e and we can see all the cron tabs on the system and if i scroll down we can see that there is one process how frequently does this cron tab run this is a special uh instance of how we can run this with at reboot specifying that every time the system reboots we want to run this process and there we go we can go ahead and use ctrl x to now exit nano and exit editing that cron tab let's move into task 7 maintaining your system with package management introducing packages in software repos when developers wish to submit software to the community they will submit it into an apt repository if approved their programs and tools will be released into the wild two of the most redeeming features of linux shine delight here user accessibility and the merit of open source tools when using the ls command on ubuntu 20.04 don't worry too much about this release number it's just the same as like windows 7 or windows 10 in specific sub versions of that rather linux machine these files will serve as the gateway registry don't worry too much about this this is just so that you have a general idea of how you can add different sources in if you ever install something such as sublime text the sublime text website will give you the command to do this and just having a general idea of where this is actually taking place is the important part so here we can see that we have our sources.list file this is the directory that all this information is stored in and then we have the sources.list file here this shows all of the sources that we're pulling things from whenever we want to go through and update things so for example when using the app command which we'll go into in just a moment this is what it's actually looking at whilst operating system vendors will maintain their own repositories you can also add community repositories to your list this allows you to extend the capabilities of your operating system additional repositories can be added using the add app repository command or by listing another provider for example some vendors have or will have a repository that is closer to their geographical location and that's fairly common to see this is also something that if you install docker you will probably have to add in a new repository for this as the default installation of the default one that's available in these repositories is usually out of date managing your repositories via adding and removing normally we would you can use the app command to install software onto our ubuntu system the apps command is a part of the package management software also named apt apps contains a whole suite of tools that allows us to manage the packages and sources of our software and to install or remove software at the same time let's walk through adding or removing a repository using add app repository or the add app repository command we illustrate it above whilst you can install software through the use of the package installer such as dkg or debian package this uh the benefits of apt means that whenever we upgrade our system the repository that contains the pieces of software that we add also gets checked for updates so think of this as just a more automated way of doing uh installing new things to our system in this example we are going to add the text editor sublime text great example as i mentioned above to our ubuntu machine as a repository as it is not part of the default upon ubuntu repositories i believe this might have changed i think it might actually be in there now however this is still a great example when adding software the integrity of what we download is guaranteed by the use of what is called gpg or new privacy guard keys if you ever are communicating securely with email finding a gpg key like this is very common and this is something that if you are interested in privacy on the internet i definitely recommend looking a little bit more into it's a very fascinating topic these keys are essentially a safety check from the developers saying here's our software and this is kind of a digital fingerprint that verifies hey this is coming from who we think it's coming from if the keys do not match up with what your system trusts and what the developers used then the software will not be downloaded so to start we need to add the gpg key for the developers of sublime text uh three note that the try hack me instances don't have access to the internet so we're not actually expecting you to follow along here this is just so you understand what this process looks like and a lot of times whenever you're installing something like this you're going to be given the commands anyways so don't worry too much just feel free to sit back and just follow along let's download the gpg key and use apt key to trust it so here you can see we're using wget to download this gpg key and then we are piping it like i used before to sudo add your app dash key add and then dash don't worry about the breakdown on that we're downloading the key and just adding it to our trusted sources now that we've gone ahead and done that uh what we can go ahead and do is add that uh repository to our app sources list and our a good practice is to have a separate file for each different community slash third-party repository that we add let's create a file named sublime text.list in etsyaptsources.list.d and enter the repository information like so so we're going to put a file in this folder and here we can see that we've created that and we're going to go ahead and edit it with a similar formatting to what we saw above this is just the repository that we're adding it is good practice to add a comment here saying hey i used this repository for this this is why it's here just to have a little bit of backup information there it's pretty straightforward with uh sublime text but when you start adding a lot of these in which you might do it just depends on your use case for linux it is good to have these all annotated especially at the time of downloading it because you know what you're using it for after we've added this repository we need to update app to recognize this new entry and we can do this with the app to update command once we've successfully left that complete we can now use app to install software from that repository such as using the command apt install sublime text and then we can reverse that for uninstalling things if we want to remove a repository and we can see just an example of that there and this will automatically remove the repository and then if we wanted to remove the software package we can do that like so and here's an example if we wanted to uninstall sublime text since triac instances do not have an internet connection just make sure that you've understood what's going on here as a general process that we are adding the key so that we know what to trust and then we're adding where we're actually downloading things from and then we have the ability to install new software let's mark that as completed and move on to task 8 maintaining your system with logs we briefly touched upon log files and where they can be found in linux fundamentals part one however let's quickly recap located in the var log directory these files and folders contain logging information for applications and services running on your system the operating system or os has become pretty good at automatically managing these logs in a process that is known as rotating i have highlighted some logs from three services running on an ubuntu machine we have an apache two web server log right over here a phil to ban log service if you ever do cyber defense clubs filter band is going to be your best friend this is a way that you can prevent brute force logins don't worry about this too much but if you ever do cyber defense or things like that this is a great thing to know about and then ufw or uncomplicated firewall which as it sounds is just a firewall service also very useful if you're doing a cyber defense competition these services and logs are a great way of monitoring the health of your system and protecting it not only that but the logs for services such as a web server contain information about every single request allowing developers or administrators to diagnose performance issues or investigate an intruder's activity for example the two types of log files below are of interest where we have an access log and an error log this is what people actually do and what errors are generated and you can see that we have examples of that here in the apache 2 directory there are of course logs that store information about how the operating system is running itself and actions that are performed by users such as authentication attempts if you go into the defensive side of information security this is something you will look into pretty heavily especially using monitoring sources such as splunk or any other sim there are a whole bunch of rooms on that if that's something that interests you i recommend going through the beginner pathway and then moving into a defensive pathway which if it's not released at this time it will be released fairly soon afterwards so just keep that in mind look for the apache 2 logs on the deployable linux machine so we can go ahead and cd to var log apache 2 since we know where it's at from the example you can also look in the var log folder and just find it that way mark that as completed and then we need to find the ip address of the user that visited the site now if we take a look at the ownership permissions of these files we'll find that there are only two files that we can actually read we have this error log which gives us permissions right there and then we have the access log since we're looking for someone that successfully visited the site we're going to take a look at this access log.1 let's go ahead and use less and then access dot log 1 and we can see that we have our ip address right over here and that is going to be 10 9 2 32 1 1 1 and then what file do they access that is going to be cats and dogs.jpg cats and dogs.gpg and there we go we can press q to close out of less and then i'll do control l to clear the screen let's move into our final task conclusions and summaries welcome to the end of the linux fundamentals module your familiarity with linux will improve as you interact or get to interact with it over time practice makes perfect as you use it and you'll probably start using it on a daily basis even if you're not using it now as you practice you'll get used to this very quickly linux has the potential to do very powerful things with relative ease as you have hopefully discovered throughout this module to recap this room introduced you to the following topics using terminal text editors such as nano and vim general utilities such as downloading and serving contents using a python web server and i do recommend looking into updog it is worth your time it'll take like five to ten minutes a look into processes and then finally maintaining and automating your system by the use of cron tabs package management and reviewing logs continue your learning in some other triac me rooms that are dedicated to linux tools or utilities and there's a couple things that we mentioned here first we have the fine command excellent room this is one of my favorite rooms on tri hackme just to give you a general idea and very comprehensive understanding of how to use this in your daily workload and especially as a someone working in information security or even just general it then we have a room about bash scripting and then another one about regular expressions terminating the machine deployed in this task from task two let's go ahead and scroll up we'll terminate that there work that as completed and then continue your learning in other linux dedicated rooms we'll work that is completed and that's gonna do it for this video if you have any questions as always we have the try hack me discord and try hackme subreddit linked in the video description below but until next time happy hacking