Debugging & Troubleshooting in Linux || Linux most common issues with solution

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
Hello Everyone this is OpenGyanHouse "O-G-H" And In this video I will talk about most common issue of linux OS And I will also share the debugging and troubleshooting approach for different issues First I will cover the linux disk partition issue suppose your system disk partition got full. And you have to find and deleted the huge size files from system so this video defenatly helps you To find any file and directory and you dont know the path (location) And if you want to grep any error from particular log file. So how to do this And if you want to compare two different files content in linux I will share steps for this And if you are facing any issue related to RAM & CPU so what are all the commands that will helps you in debugging And if you want to debug any network related issue so that will also cover and I will also talk about ssh login related issue and how you can debug it And if you wanna kill any process forcefully so how you can do this as well Here I have mentioned the timing I dont want you guys to keep here and watch all the video if you are looking for some particular issue so you just click on the time stream "bottom of the video" in your youtube video And you can start from there Suppose you want to check for CPU & RAM issue only so you have to go to 09:45 sec OK ! so Hope this info is useful to you guys OK! so let me discuss about one of the most common issue of linux operating system which is related to your disk partition sooo I want to show you the debug approach if you are facing your disk partition issue very frequently in environment And you have no clue like which file or which directory is consuming huge data. So how you can determine the the file and directory and take action accordingly if you want to remove to zip the file so how you can do it So as you can see I have / partition on this system Andddd which is having around 28GB size and out of 28GB 24GB already in used so around 90% (*87%) of disk partition already being used and I have no clue like while file is huge and consuming the disk partition so I just switch to the / path in which I want to find the file. And there I have to execute the command "du -sh *" * for all the file and directory which are presents in / partition if you are running this command very first time in your system so it will may take some time because it's calculate the data from disk here this command worked for me quickly because I have executed this command earlier. so you can see /home partition sorry..... /home directory is having around 17GB of data let me go to the /home path and again.. you can run the command "ls -lrt" to list all the files and directories so you can see there are multiple files and directories and you have no clue In which, file you have to check so again you have to run the command "du -sh *" And here you can see "/opengyanhouse" is having around 13GB of data let's go to the opengyanhouse directory here again you have to run the command to check in while file or directory I have to move further so you can see "logs" directory is having around 12GB of data. So lets cd to the logs directory and here you can see, multiple log files are there which is having data in GB size so you can truncate or delete these files. So suppose the system.log you want to be retain here but system1.log you can remove (no needed) So you remover this file directly using the rm command rm -rf so it will remove this file and it will also reduce the size of your disk so my disk size is around 79% And if you want to truncate a file so you have to run the command like "> filename" Because here assuming !! there might be some realtime application which running and using this file and you dont want to remove the file from the system so I have truncated the file So this file is having no data, but file remain there I am hoping this information is useful to you guys. And it will help you to removed unused files and directory from system to debug disk partition issue.... Now, I want to talk about find & grep commands Suppose... You want to find http.conf file and you dont know where exactly, it is placed You dont know about the path of this conf file so you run the command find find / it will start searching from root you have pass option -name and then <file name> file name is httpd.conf So it search from root and it will show the results.. like where exactly the httpd.conf is placed.. there are two results (output) and path is /etc/httpd/conf and other is placed at tmpfiles.d if you are looking or searching for particular directory so you can run the command find if you want to search from root / so and if you want to search at /home so you can pass /home as well and then you have to pass -type type and if you searching for directory so you have go with the option d again you have to provide the file name so lets search for opengyanhouse in this path so I am searching for "OpenGyanHouse" directory in this /home path so you can see results this is the path for directory. If you wants to search for http so you have to set the path httpd OK.. and lets search for it from root "/" so here is httpd directory and these are all the path for this directory So this is very useful if you dont know about the location and you want to find any particular file or directory So you can use these commands and if you want to grep any error from any particular log file. SUPPOSE i want to search error from /var/log path so here, these are some log files like "lastlog" and "messages" And I want to grep any "error" message from these log files so what are all the error message, which are present in messages log file So I can easily run command grep and then "error" from this file. OK........ if you want to grep error from all the files which are present in "/var/log" [in present location -path] So you can run this command So it will show some results. these are all the error, which are present in these files..... So guys this information is very useful grep any particular error or if you want to find any file or directory so you can use these commands. OKKKKKKKKKKKK So here... I wants to talk about.. if I want to compare two different files. and if I wants to see the difference between two configuration files content. So how I can check Suppose.. I want to check backup and main configuration file content and what are all the difference between these two files. So what are all the things that I have to do So let me check for the httpd.conf file so lets go the path "/etc/httpd/conf" path here you can see.. there are one file is like httpd.conf and the other file is backup file And I want to check, what are all the difference in these two files. so I have to run the command diff httpd.conf and httpd.conf_bkp Sooooo you can see these two lines are extra in this file (httpd.conf) because there is a > (grater-then) sign and second file is httd.conf_bkp if I change the sequence and if i compare httpd.conf_bkp with my httpd.conf Sooooo it will show like, http.conf is not having these two lines. Other than that all the content in both the files are same. So you can use like, this diff command. it is very useful if you are doing and managing any configuration in your Linux box... Or you can also use the command "sdiff" so "sdiff" commands will show you the output in terminal from both the files. So you can see like these are all the lines, which are present in this file last, these three lines are extra here. Hope this information is useful to you... :) OK Guys ! If you are having any CPU & RAM related issues Like your system resource utilization is very high and you want to check like, which process is consuming high CPU or RAM So first & most useful command is "top" "top" command will show you the current status of your system CPU & RAM.. So you can see like, I have 1 CPU here idle status is around 90% which seems to be fine and my system user usages around 10% of CPU and system is using around 3 to 4% So overall this seems to be good and these are all the process which are consuming the CPU and the main process is XORG and GNOME If you want to quit (exit) from the "top" command so you have to press "q" (keyboard) And for checking the status of your system RAM you have to run the command "free". Soooo total size is around 2GB of my system RAM of this linux VM and 1GB is available and you can also see stat for used, free & buffer memory in this command output One more command which is useful is "sar" this command will also give the results of CPU utilization in current time And if you want to see how many CPUs are there in System configured and which model (vendor-driver) is used so you can use the command "cat cat /proc/cpuinfo these are the basis stuff and if you want to kill any thread or process so you can kill using the "kill" command, which I have already shared in this video Hope. this information is useful to you Guys :) If you are debugging and troubleshooting any network related issues sooo let me show you some command. So the first command is very useful, which is "ifconfig". So this command will show you the all the configured interfaces with IPAddress other command which you can use is "ip a" for the ip address information's few more commands, and one command is "dmesg" "dmesg" command is very useful to check all the network interfaces status and if you are getting any packet from outside the network so this command will defiantly helps you. And one more command for network is "dmidecode" and if you want to capture any packet, In any interface so you can also run the command "tcpdump" so "tcpdump" tcpdump -i any (any - for all the interface) and packet size is zero and if I try to login from any other host. Let me try to login from my window machine (system) I am expecting there might be some packets with the "ssh" protocol. Here you can see my window host IP is there so this is a very good command if you want to trace any network related issues Few more commands are "ping & telnet" so you can use these commands for you network related stuff So I have already one video for "ping & telnet" commands I will share the link so you can have a look on that video in details So Guys this is the information, If you are trying to debugging any network related issues. So If you are facing any login related issue if you are not able to login in your Linux machine So few things that I recommend to check first you check, "selinux" status so you can use the command "sestatus" to check like. whether "selinux" is running or not. If there are like "selinux" is already running in your machine So you have manage some boolean configuration and you have set some rules And you can also check your "iptables" like your firewall, using the command "ipatable -l" Again, Like If you are still like want to check like from which host anyone trying to login so you can go-to the path "/var/log/audit" And here you can find one logfile so you have to "tail" this logfile soo once you tail this login so it will show realtime results (log).. And if you try to login from any hosts or any servers so like, that log will print in that audit file (terminal) so here like, from one of my other hosts, I tried to login into my Linux machine.. And you can see like log are already hereeeeeeeeee Anddddddddd theeeeeeeeeeeeee And you can see like, some host like window server and the IP Address is this login successfully, so these are all the information's that you can find in audit log one more thing I want to share, Like if you are "ssh", or doing "ssh" to any other host so you can also use the option "-vvv" It will LIKE..... will show some log details at the time of login Suppose. I want to login into the IP and I used command with "-vvv" so it will show some results or some more logs at the same time of login so you can see the connections is not Established on port 22 on this Host So Guys, This is basic informations about your login so you need to check "selinux" and you need to check your "iptables" and for login related log, you can check "messages" or "audit log" And if you are doing "ssh" so you can also use "-vvv" option for more log HOPE ! This information is Useful So If you want to kill any particular process Or If you want to kill any particular open thread in your Linux machine so how you can do this Suppose.. you are facing issue with your "Apache" or "Httpd" server and you want to kill few threads. So first you have to check what are all the open thread are there so you can use the command "ps -ef" then you can "grep" with the process name so you can see there are three 3 threads are running in "httpd" so if I want to kill so I can use the command "kill -9 <PID>" then I have to pass the PID (Process ID) So let me copy and kill this thread using PID 5666 & 7 5669 once I Killed, so after that, If I run the command "ps -ef" so I can see there is no more open thread after that I can easily like check the status or restart MYYYYYYYYY Apache server. "systemctl status httpd" and it is in failed state then I can takes the stop and start and once I started soooo it will like in "ACTIVE" state RUNNING FINE.................... So this is it about, If you want to kill any thready or process so how you can do this HOPE THIS INFORMATION IS USEFUL TO YOU..... #O-G-H
Info
Channel: OPEN-GYAN-HOUSE
Views: 21,749
Rating: undefined out of 5
Keywords: linux, cloud, learning, tutorials, linux tutorials, cloud tutorials, servers, how to, how-to, how, what is, what-is, ONS, OM, debugging in linux, troubleshooting in linux, debugging & troubleshooting in linux, how to debug linux issue, disk issue in linux, network issue in linux, file compare in linux, cpu & ram issue in linux, kill process in linux, ssh login not working in linux, how to debug a network issue in linux, how to find file in linux, how to find directory in linux, OGH
Id: c9_NFB7eE6Q
Channel Id: undefined
Length: 17min 47sec (1067 seconds)
Published: Sun Sep 20 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.