Linux Interview Questions And Answers | Linux Administration Tutorial | Linux Training | Edureka

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello given a bomb welcome to a Eureka online training session would like to hear from all of you whether you all can view of my screen and able to hear me properly please confirm either by raising your hand or by using chat option which is present in your attendees panel field knowledge means thanks a lot for confirming let me quickly introduce about myself my name is Bhaskar Reddy and I have 14 plus years of experience in IT industry my main expertise into Linux and UNIX administration Storage Management and various other virtualization technologies I've handled many projects in storage but UNIX and Linux administration especially into automation and virtualization technologies like Hetchy and fault tolerance apart from this I have been engaged in in-house training corporate and online trainings as well so today we will have a session on Linux interview questions I hope this session will be very helpful for those audience who would like to take part and attend interviews on linux administration part though we are not covering each and every aspect of linux but we have selected few frequently asked questions in interviews as we all know linux is completely a command oriented operating system and you can expect questions and interviews like in theory and practicals as well so thank you once again for all the attendees for joining today's session so let's get started with it and please let me know if you have any queries and concerns during the session I would kindly reduce you to use the chat option so that I can assist you further so I'll just run through some slides and if any practical question comes I will be using this buddy session as you can see here I just logged into one of my linux server if any practical question comes I can show you practically by using this party session I've just connected to one of my Linux box through but it's offered so this would be practically oriented one so let's get with the interview questions here the first question the basic question would be what does okay so as a layman as an interviewer if I ask this question what is Linux the first answer would be it is an operating system so before I get into Linux first of all let me explain you like what is an operating system every time you switch on your computer you see a screen where you can perform different activities like read and write or browse the internet or watch a video what is it that makes the computer hardware work like that how does the processor on your computer knows that you are asking it to run or mp3 file well it is the operating system of the kernel which does this work a kernel is the program at the heart of the operating system that takes care of fundamental stuff like letting Hardware communicate with software so to work on your computer you need an operating system in fact you are using one as you read this on your computer now you may have used popular OS like Windows Apple OS X but here we will learn what Linux is and what benefits it offers over other OS choices so Linux is an operating system or a kernel which germinated as an idea in the mind of young and bright Linus Torvalds when he was a computer science student Linus Torvalds is considered as father of Linux operating system so when he was as a computer science student he took a Linux kernel and he developed from the scratch he used to work on UNIX operating system which in those days called as a proprietary software and thought that it needed improvements however when the suggestions were rejected by the designers of Unix he thought of launching an operating system which will be receptive to changes modification suggested by its users the benefits of using Linux operating system what are the main benefits and why it gained more popularity compared to other operating systems the main benefits are it offers a free operating system you do not have to shell hundreds of dollars to get the oils like Windows being open-source implicit or Scott the Linux operating system nuf offers millions of programs applications to choose from most of them are free now once you have Linux installed you no longer needed an anti-virus because Linux is highly secure system more so there is a global development community constantly looking at ways to enhance its security with each upgrade the OS becomes more secure and robust Linux is the oil of choice for server environments due to its stability and reliability mega companies like Amazon Facebook and Google used Linux for their service a Linux based server could run non-stop without a reboot for years on end ok this is all about Linux so Linux is just an operating system or a kernel ok which has been developed from UNIX operating system so this is what we have discussed and coming to the next question how different is Linux when compared to UNIX operating system you might face different types of questions when you attend this type of interviews in linux operating system like what is the comparison what is the differences did you find between like Linux and UNIX operating system as I said earlier Linux is the UNIX clone but if you consider it according to the POSIX standards a process is nothing but a portable operating system interface according to this standards Linux can be considered as Unix exactly to code from official Linux kernel readme file Linux is a UNIX clone written from the scratch by Linux turbines with assistance of hackers across the net so I'll just take some strategies here in terms of cost in terms of development and distribution in terms of manufacturer like what are the differences between Linux and UNIX in terms of cost Linux can be freely distributed downloaded freely distributed through magazines books etc there are priced versions of Linux also but they are normally cheaper than Windows operating system when you compare with UNIX in UNIX we have different flavors of UNIX have different cost structures according to the vendors in terms of development and distribution Linux is developed by open source development that is through sharing and collaboration of code and features through forums and it is distributed by various vendors when coming to UNIX UNIX systems are divided into various other flavors mostly developed by AT&T as well as various commercial vendors and nonprofit organizations in terms of manufacturer Linux kernel is developed by the community by Linus Torvalds Linus Torvalds will oversee things and when you talk about Unix three biggest distributions are Solaris which is stuff acquired by Oracle AIX by IBM vendor hp-ux it's by tablet packer and Apple makes OS X which is also a UNIX based operating system okay so I've just taken three aspects here like cost development and distribution and manufacturer like this we have many such differences between Linux and UNIX operating system okay so in case of any questions any queries please use a chat window I will be gladly assist you so this is what we have discussed okay coming to the next question like what is the importance of GNU project GNU project was launched in September 1983 by Richard installment to create a complete operating system which is free software the main intention of GNU project is to create an operating system which is completely open source which is completely freely available for all public users the main licenses of the GNU project are the GNU GPL which is nothing but the general public licenses the name of the GNU project is derived from the recursive acronym which is nothing but GN use not Unix okay the full form of GNU it's a recursive term Jian use not Unix unikz was a very popular operating system in the mid-80s so richard stallman designed gnu to be mostly compatible with unix operating system so that it would be convenient for people to migrate to GNU so the genome project was intended to create a unix-like operating system but it should be freely available for all the public uses and it should be a open-source operating system so this led to the birth of Linux operating system okay the end of Linux kernel and the GNU utilities that is a question from Prakash the question is GNU compatible with physics standards yes okay every operating system like when you talk about Linux and UNIX all are POSIX standards I hope I answered your question Prakash okay the importance of the GNU project the free software movement started by Richard installment ok you see the full form of GNU GNU snot UNIX it's a recursive term ok and coming to the next question the question is like what does Linux kernel okay so this is an important question would be asked in different types of interviews and most of the people will they get confused in answering this question what is Linux kernel let me explain you in a simpler way with over 13 million lines of code the Linux kernel is one of the largest open source projects in the world but what is a kernel and what it is used for a kernel is the lowest level of easily replaceable software that interfaces with the hardware in your computer it is responsible for interfacing all of your applications that are running in user mode down to the physical hardware and allowing the processes which are known as the services to get information from each other using inter process communication technically speaking a kernel is nothing but the core of any operating system and it is responsible for translating the user commands into equivalent language understood by the computer hardware okay so kernel it is nothing but the heart of any operating system it's a code of any operating system which is responsible for translating the user commands into equivalent language understood by the computer hardware okay so if you can see this a pictorial representation on the Left pane okay you see applications on top of kernel you see applications and bottom of the kernel you see the hardware devices the hardware devices like CPU memory and the devices which are attached to the computer okay so in order to interact with the kernel okay applications you see on top of operating system you have applications so in order to interact with an operating system applications you need to have some kind of language right so kernel would be acting as a mediator mediated between applications and hardware devices it just translates the users language to the machine language and machines language to the users language it's a core kernel is nothing but the core the heart of any operating system okay any questions any concerns please let me know and coming to the next question what is a shell and in shell what is exactly called as a bash shell okay so let me explain you what is exactly a shell a shell is a user program or its environment provided for user interaction a shell is a command language interpreter that execute commands read from the standard input device which is called as a keyboard or from a file shell is not part of system kernel but use the system kernel to execute programs like creating files creating directories etc okay so please remember shell is exactly called as a user interface in order to interact with operating system we need one kind of interface right that interface is called as a shell okay shell is a command language interpreter most of the people often confuse between interpreter and a compiler okay please remember interpreter is type of a mechanism that execute commands which are read from the standard input device or from a file okay so when you talk about shell in shell we have different types in Linux and UNIX operating system we have bash shell we have single shell we have console we have facial we have public domain cultural we have different types of shells used in Linux and UNIX operating system but bash is a default shell bash has been adopted as a default shell for most Linux systems okay bash is a shell or a command language interpreter for the GNU operating systems once again I am using the term G and new ok GNU operating systems like Linux in most distributions of Linux operating system bash is incorporated as the default shell okay the name is an acronym for the born again shell bash stands for born again shell okay it is named after a person called Steven born okay he is the author for born again shell now why bash has been incorporated as the default shell because in bash we have many such futures features like command aliasing command completion by using the tab keys and the command history also okay like in order to execute the commands like no need to remember all the commands in Linux operating system okay with lot of ease you can execute all these commands by the features of bash shell okay c'mon aliasing command completion or file completion by using the tab keys and the command history okay in order to execute like previous commands no need to type the commands again and again you can recall those commands by using the up and down arrow keys using that you can recall all those commands okay if I show you practically one particular example we have one command called clear in Linux so this is the terminal I am using the command line interface the terminal where we can gain access to Linux operating system I'm just giving one particular example like by Bosch has been incorporated as a default shell okay let's see what is exactly a command aliasing I am executing the command called clear the command clear which is used to clear the screen so every time you want to clear the screen you run the command clear once you press Enter the screen will be cleared now instead for this lengthy program and what I'll do here I'll just make an alias C is equal to clear now once you press ENTER for that particular command clear has been Aaliyah's to see now instead of running command clear I can run the alias command called C once you press ENTER the screen would be cleared like this for any such programs or applications if you want to do a liasing this is possible with bash shell now these kind of features you cannot see in other shells okay in other shells other shells like sea shell conch shell public domain conch shell you don't see all this types of features in other shells okay there is a question from Prakash so it's just the next version right yes okay in UNIX operating system the default shell was shell okay and what this person has done stiffened born has incorporated some new features okay some features have been incorporated in single shell and this has been renamed as the bash shell okay bash is nothing but the born again shell it is named after an inventor called Steven born okay in Linux if you want to see the types of shells which are supported you can check this configuration file the configuration file called slash EDC slash shells okay this is a configuration file where you can see the number of shells supported by Linux or UNIX operating system if you want to see what is the default shell you can just recall the environment variable called shell this will tell you what is the default shell used in the operating system you see slash bin slash bash okay so that is the importance of Bashan and you must have got an idea like what is shell and what is the importance of bash shell okay and coming to the next question what are demons so this would be a tricky question asked in interviews like what are demons if I put it in simpler format or demin according to my readings demons are services that provide several functions that may not be available under the base operating system its main task is to listen for service requests and at the same time to act on these requests after the service is done it is then disconnected and wait for further requests Adam in process has no controlling terminal it cannot open the terminal for example /dev / tty if you do psi fan AF and look at that PPD tty field all the lens will have question mark for the tty terminal okay I'll give a practical example here if I run a command psi n EF you see for most of the demons usually in Linux and UNIX operating system adilyn would end with D okay you see for example let's take this particular dimension K thread D okay at the end you see the character here D which is nothing but a demon okay as I told you Adam end process has no controlling terminal if you check TP wife field here for this particular dimension mark okay Adam end process is essentially a program that runs in the background and is usually started when the operating system starts up okay if you want me to take one more example a typical Devon process in a male demon that runs in the background checking to see if we have received a new male when you do it notifies you okay so most demons tend to last a long time be owned by a root or do something useful but this is a very tricky question okay what is the difference between a demon and the process okay so please don't get confused between this a demon is a service that provides several functions that may not be available under the base operating system okay the main advantage the main task is to listen for service requests and at the same time it will be act on this request so that is about the demons okay one good example you can always run psi finesse and you check all the demons in the tty field you see the question mark that means we have not initiated this system the operating system has initiated all these demons okay and coming to the next question what is a lil Oh a lil o is a Linux loader it's a boot loader for Linux operating system it is used to load Linux into the memory and stop the operating system lilo can be configured to boot other operating systems as well lilo is customizable which means that if the default configuration is not correct it can be changed the main configuration file for Lila would be /et c / yellow corn okay as I said lil o stands for Linux loader which is just a bootstrap program lilo is a code snippet which loads PC BIOS into the main memory at the time of starting the computer system okay and the main task it handles is locating a Linux kernel identifying other supporting programs and loading them into the memory and starting the kernel okay so lilo is not used nowadays the default boot loader for Linux operating system is now this grub which is called a grand unified boot loader okay when you talk about the latest version of Linux operating system it has been replaced with grub - okay some more features has been added in grub and they have released a new version that is called grub - okay so this is all about lilo it is just a lonex loader it is called as a bootstrap program it's a boot loader which loads Linux operating system into the main memory coming to the next question what are the advantages of Linux being open source okay so we have been discussed in the earlier questions also the advantages of open source operating system Linux was one of the first open source technologies but many programmers have contributed and added software that's completely open-source for any user this means that you can download the source code and change it in any way you like some developers have restrictions on how you can distribute the code for instance some developments allows you to change the code but you cannot distribute it for money one main advantage of open source technologies such as Linux is a wide range of options available to users and the increased security with Linux being open source several distributions are available to the end user for example distribution such as debian fedora Ubuntu and mint are just a few of the distributions available to end-users and these distributions are completely free to download security is the other main advantage several white hat hackers have contributed to the overall security of Linux and by making the source available to anyone security experts can help identify any main security flaws in the operating system there is a question from Prakash it says that is every Linux distro is free technically speaking yes ok but there are some companies ok when we talk about this support when we talk about technical support ok so I was talking about Linux is completely open-source product it's completely available for public users yes the OS is free but if anyone if any organization is looking for support ok you have to pay only for the support not for the operating system operating system is anyhow free okay if you talk about Enterprise Linux okay Red Hat Enterprise Linux this is the commercial stream this is the product which comes from the commercial stream the operating system is available free of course but if you're looking for the support enterprise support you have to pay them okay Prakash does it answer your question is according to my readings like borer and 3/16 and dollars would be charged okay according to the enterprise support the basics are put again in the support you have different types okay for basic support you have to pay 369 dollars when you talk about Red Hat Enterprise Linux you have to pay 315 in dollars no problem Prakash that's fine so shall we move on to the next question yes Prakash when we say open source yes the operating system is open source but we are not paying anything for operating system like Windows right even for getting Windows operating system we will pay some fees to the Microsoft Corporation but unlike Windows we're not paying anything for operating system in Linux here only for enterprise support only for the support we are paying that ok yes if you look the kind of support the support like in case of the new updates or any new releases or any bug you looking for the bug free operating system for that we are just paying support for enterprise solutions ok Thank You Prakash coming to the next question like what are the basic components of Linux operating system ok this is a general question which would be asked in the interviews Linux operating system has primarily three components what we have discussed already is kernel a kernel is the core part of Linux which is responsible for all major activities of this operating system it consists of various modules and it interacts directly with the underlying hardware kernel provides the required abstraction to hide low-level hardware details to system or application programs ok we have ro discuss what is kernan next comes the second part is system library and system utility ok system libraries are special functions or programs using which application programs or system utilities accesses kernel features these libraries implements most of the functionalities of the operating system and do not require kernel modules code access rights like when you compare with windows in Windows we have dot DLL which is nothing but dynamic link libraries in Linux we have something all the libraries which are there to read the file write the file all this coding part ok implementation of the most of the functionalities will be there in the slash USR slash Lib directory or slash Lib directory ok then coming to the next question how to check memory stats and CPU stats as a Linux admin ok so in interviews as I said earlier the questions would be always in tricky format like can expect questions in theoretical or you can expect questions in practical also so you should be well advanced you should be well prepared for the interview in the practical part also so according to this question being the Linux administrator have you can check the memory stats and the CPU stats so there are various commands in Linux here one such command would be free if you want to check memory statistics you can run the command called free - M if you want to see the size in megabytes or free - G if you want to see the size in megabytes and if you want to see the virtual memory statistics you have a command called vmstat a linux vm stock command used to display statistics of the virtual memory you can also see the kernel threads the disks system processes are your blocks interrupts CPU activity and much more ok let me explain you this practically here as I said if you want to see the memory statistics you can run the command called free - M according to my system I just got approx some 10 GB of RAM because by default and sing in megabytes your 9008 38 MB out of which 651 is used 8000 714 is free or if you want to see that in gigabytes you can run the command free - G if you want to see that in gigabytes and when you talk about virtual memory statistics you have a command called vmstat - eh okay so in this example there are six columns here the significant of the columns are explained okay in details here as you can see the first is the processes the memory swap IO system and CPU okay you can just find out with the vmstat - a command you can also check the dynamic activity of your system like for example you see I'm running the command here vmstat - space 6 with this command vmstat execute every two seconds and stops automatically after executing 6 intervals see this practically see the interval here ok interval is every 2 seconds and it will stop automatically after 6 intervals here you can monitor like this virtual memory statistics ok if you want to see along with the time format here you run the command vmstat - P ok 1 comma 5 for example once you press Enter you can see along with the time format ok so like this we have many such options in vmstat the based on the requirement the based on the performance and monitoring you can execute those and coming to the cpu you have a command called Tsar the system activity report okay with Tsar - you you can display the CPU usage see exactly you can see the CPU stage ok Tsar - you displays the CP usage for the current day that was collected until that point ok if you want to see the real-time CPU usage the same like vmstat Tsar - you 1 space 3 ok every once I get but 3 intervals here you can see ok Tsar is very very very important command it is used by every administrator to monitor the day-to-day activity ok inside also we have many such arguments here if you want me to discuss more Tsar - are to see the memory free and used I'll give one comma three you can also see the desert you see the KB memory free KB memory used and memory used in percentage you can see all that with the SAR command also ok this is all about the system monitoring and the performance yes Prakash each and every system in the network be it windows or beep Linux operating system every system would be monitored by using some monitoring tools for example Nagios Nagios is one such tool which is used for monitoring and for performance wise ok like for example in real time if any such server going beyond threshold ok according to my requirement now what I want is I would like to notifies all the users ok if the CPU usage threshold crosses like 80 percent ok I would like to notify all the users if my CP usage is going beyond 80 percent threshold I can set all that in the monitoring tool to just ensure my system performance and the monitoring is under threshold ok we have many such monitoring tools Nagios we have clone we have many such monitoring tools ok yes Prakash nag yours will be hosted on the server and on the client we have NR PE which is nothing but Nagios remote plugin executors which will keep on communicating with the server and it will notify if anything goes beyond the threshold ok so coming to this light so these are some programs we have just given in the slide here we have discussed about the free vmstat to see the virtual memory statistics and when you talk about CPU statistics you can always use the program SAR which is that input system activity report ok so give you some basic examples but if you dig more into this commands you have many such options okay and the frequently asked questions in interviews would be how to reduce or shrink the size of an LVN partition okay this is a frequently asked question in interview C the main advantage if you just compare between a partition and a logical volume okay the storage management can be created like whenever you want to create a partition partitions can be created by using the tool called fdisk but if you create a partition using fdisk it is the fixed partition size later it is not possible for us to modify or resize or shrink the partition size that flexibility is not available using fdisk partitioning tools now using advanced partitioning tool like a VM which is called as a logical volume manager we have a flexibility of either resizing the logical volume or reducing or shrinking the size of a logical volume so let's see practically how you can do that in Linux operating system I am talking about advanced partitioning tool called LVM which is nothing but the logical volume manager okay so I've already created a logical volume manager here as you can see with the command dfi sin H capital P you can see for example there is a logical volume here the logical volume is zoom Linux and the type of the file system is ext4 the size is 4 point 8 GB and currently this logical volume is mounted on the mount point called slash LBM so now I got a requirement of reducing this logical volume size okay in other file systems and running out of space I would like to reduce this logical volume and I want to increase the logical volume for other file systems so let's see how exactly we can do that okay so there is a question from Prakash so ext4 indicates partitions No ok the cache like after creating a partition in Linux operating system we make a 5 - so ext4 is one such kind XD for ext3 when you talk about rhel7 x surfaces the default file system when you compare with Windows Windows has a default file system called NTFS unlike NTFS in Linux also it is called as ext4 and ext3 file system see each and every opting system maintains its standard in order to read and write data okay fetch data from disk to RAM or Ram to hard disk read so unlike windows we have NTFS in Linux we have ax t3 and ext4 as a default file system so let me take one example here there is a logical volume which is of 5 GB currently I would like to reduce to 3 GB now okay so that that 2 GB I can accommodate to other file systems the first thing is online shrinking is not possible so first you need to unmount a logical volume the command is you mount and specify either the device name or the mount point and then you can check whether you have any problem with this particular file system you run the command E - f ck - f and specify the device name okay so this is must ensured before you reduce the logical volume you just need to scan your filesystem ok e to F f ck is the command to check the particular file system whether you have any problems or not now once you press enter so exactly you should find this ok so we have no problems with this particular file system now we can reduce by using the command resize - SS specify the logical volume name I would like to reduce from Phi GB to pre GB the current size is 5 GB I would like to reduce to 3 GB and the remaining 2 GB I would like to accommodate through other file system enter now you see the logical volume size has been reduced okay so now we can run the command LV reduce - capital L 3 GB and specify your logical volume name now once you press Enter it will be reduced to 3 GB now 5gb to 3gb as you can see some information here and then you can mount your logical volume to the mount point called LVM now you can see the logical volume size now it has been reduced from 5 gb to 3 GB ok this is us you can reduce or you can shrink the size of a logical volume okay so this flexibility is not available in fixed disk partitions once you create partition that's it now you don't have a flexibility of modifying the partition size or shrinking the partition size so this is possible only by using advanced partitioning tool called lvl which is nothing but the logical volume manager there is a question from tracker SH this means that even the new partition will have its own route ok Prakash if you know the Linux standard filesystem hierarchy standard there would be one root filesystem under root you have all the sub directories sub directories like us are MNT VAT boot like that have created one directory as mounted under root ok so we don't have again another root for this particular logical volume ok there would be only one root under root you have all the logical volumes mounted under it ok so let's get back to these slides here so we were discussing about like how to reduce or shrink the size of our LVM partition or a logical volume it's a five-step process first you have to unmount run SS again run the resize - SS - 3 GB or whatever required size you want and then you run the command lv reduce to reduce the logical volume then you can mount that particular file system ok the next question being explained the functionality of a root user okay so in computing world the super user is a special user account used for system administration depending on the operating system the actual name of this account might be root or if we talk about Windows we call as an administrator or admin or supervisor in unix-like computer operating system root is the conventional name of the user who has all the rights or permissions to all the files and programs in all modes okay the root user can do many things which an ordinary user cannot such as changing the ownerships of files binding to network ports numbered below thousand 24 so root is the default account every time Linux is installed okay correct yes Prakash seabass told you in the beginning of the session because this is the operating system which is completely command oriented yes you can create a folder in graphical also you have access to graphical mu yes you can create a following you can mount to that particular fine system yes you can do that okay so there comes your question again what does CLI and what does GUI okay see you like there's nothing but the command-line interface is a console or x2 based representation in which the user types the commands to operate the software or devices the main advantage of C Liars multiple steps can be executed by specifying the single command which is not possible in graphical mode okay so a GUI which is nothing but the graphical user interface is a graphical representation in which the users can interact with software or devices through graphical icons okay simple definition what is CLI and what is GUI so how can you find out how much memory used in Linux operating system again a same question here so how exactly you can find out there are many such programs here the command would be free okay the free command is the most simple and easy to use command to check memory usage on Linux operating system so here is an example free - n or free - G or you can also cap the contents of /proc /mm info this will also give you the complete information about your memory you can see here the total memory okay memory in free and memory available and you see the used in everything here okay you use this command also you can just cap the contents of /proc /mm info okay or better the simple command would be free - gee okay what is swap space and what is the typical size for a swap partition under the next operating system so this is also one of the most frequently asked questions in interviews so what is the swap space swap space in Linux is used when the amount of physical RAM physical memory which is also called as a ram okay it's full if the system needs more memory resources and the RAM is full in active pages in memory are moved to the swap space why swap space can help machines with a small amount of RAM it should not be considered as a replacement for more RAM okay so people often get confused between main memory and swap memory okay so if the CPU doesn't find free space in the physical RAM so what CPU does is it just moves all inactive processes all inactive pages from the main memory to these wrap space the sub space which is created on to the disk okay to ensure it improves your system performance okay so the preferred size for swap partition is twice the amount of physical memory okay amount of physical memory available on the system if this is not possible then the minimum size should be the same as the amount of memory installed okay swap is used in normally desktops and laptops okay not in service because in service we have equipped with more RAM we have 32gb 64gb 128 GB on those systems there is no need to create a swap space okay swap space only for low-end machines where we don't have enough RAM available okay so swap is just to improve the performance of the computer nothing more okay so any questions any queries please use a chat window okay and how do you access partitions under Linux what is the naming convention four devices in Linux operating system okay as you can see here I am running the program fdisk - l and you see the first device I got two drives connected to my Linux system the first drivers slash dev slash SDA and the second drivers slash dev slash s DB C the naming conventions here the conventions used for sketchy drives in case you have ID hard drives the first convention would be slash dev slash HD a HD be something like that if it got sketchy drives or SAS drives the naming conventions would be SDA and s DB and under this first hard drive here if you see you have the partition starting from SDA one - SDH so team the first partition slash dev slash SDF 1 and the second partition is de 2 like that ok so these are the naming conventions used for your storage devices and this is a exactly you can access partitions under Linux operating system ok you see here ID hard drive starts with H in case you got sass and CSE starts with S SDA SDB go on how our hard drives and floppy drives referred in Linux just am I told you right s das DB and for floppy drives it would be FD 0 FD 1 nobody owes nobody accessing floppy drives but it would be a question in interviews half floppy drives would be referred in Linux slash dev slash FD 0 slash dev slash FD bun based on the number of connections you have in your system in case of hard drives h ta h TB in case of ID if we have sky C or SAS drives SDA s DB something like that ok these are the naming conventions used for floppy drives and hard drives similarly in Linux how are names assigned to different serial ports what we also called as communication ports the communication ports are identified as slash dev / TT bytes s 0 to T device s 1 SC practically here LS - L / - / T TV yes star you see here the communication ports okay 85 s 0 TT 5 s 1 okay what we normally called as communication ports in windows communication Wan communication - like that ok coming to the next question asking about printer ports how exactly you can I defy the printer ports Ingenix same thing / - / LP star LP 0 LP 1 LP through these are the names to use for printer ports ok and the very basic question asked in interviews is what are the kind of permissions available in Linux okay what are the basic file permissions are the directory permissions available in Linux so there are basically three levels of file and directory permissions in Linux one is read read like users only read the files or list the directory contents and the second permission would be right as the name suggests users can write information to the file or create files inside the directories of a subdirectory and the third permission would be execute the users can run the file or look up a specific file within a directory okay so besides these you can have a combination of all the three levels of permissions and two of them or one of them some combinations read write execute or read write or read execute the based on the requirement as an administrator I can change permissions okay basically there are three permissions the three permissions what we see here that is read write and execute okay coming to the next question like how do you change permissions under Linux so there is a command called chmod chmod is a command to change permissions for files and directories and the permissions can be changed in two formats one a symbolic mode another one would be absolute mode symbolic mode is nothing but using numbers and absolute mode is nothing but like using characters okay like rwx or seven five five or six four for the Delp of chmod you can change permissions okay in order to change ownerships you have a command like CH own and chgrp in order to change ownerships for files and directories okay see here the command chmod is to change permissions and if you would like to change the ownerships you can use the command CH own and chgrp okay on the left pane you can see some representation here user groups others and the permissions are read write and execute okay bless is to add permission - is to revoke permission and is equal to to overwrite the existing permissions okay the permissions can be changed in two different modes symbolic mode and absolute mode symbolic using like characters or debris X absolute is using numbers okay combination of numbers the read value is for write value is to execute value is one you can either use characters or you can use numbers okay symbolic mode or absolute mode yes you're right Prakash chmod 7 what is 7 read/write/execute applicable for owner 0 means none permissions applicable for group 0 again none and this is applicable for others okay and coming to the next question what are symbolic links very interesting question ok symbolic links so in Linux basically we have two types of links one is symbolic link which is also called as the soft link so symbolic link you can always compare if you take an example like in Windows we have shortcuts ok we always create a desktop shortcuts now if instead of going to the lengthy part or navigating into directories into directories and directories we can better create a shortcut on the desktop ok for easy access in and easy way of interacting with the operating system similarly in Linux it is called as a symbolic links or soft links so this is one special kind of file that points to another file that gets compared with Windows red we have shortcuts but please remember symbolic link does not contain the data ok symbolic link will not have the data all the data we have in the target file but not in the shortcut ok and what are the benefits of using symbolic link it just allows instant access easy of access of application or a program ok without having to navigate to multiple directories here let me show you one practical example here for example I just want to see the configuration file of my LAN card network interface card the command would be cat slash EDC slash this config network - scripts and the configuration file would be starting like this this is my configuration file for male LAN card en p0 s3 see the path here EDC's this config network - scripts under this directory we have a file called IFC FG - e and p 0 f3 now instead what we'll do here I'll create a symbolic link see Ln - s is a command l n stands for link now what type of link I'm creating here I am creating the symbolic link the bath would be EDC Siskin fit network - scripts IFC of g - e np0 s3 for this particular file i am creating a shortcut under my root directory with the name called IFC FG enter the link has been established now instead of viewing the land information instead of going to this lengthy path better I can read from the shortcut now which one is easy to access either this one or this from the shortcut I know it is from the shortcut C the properties here LS - l / is CFG because this is exactly pointing to the original file the target file this is a linker file the symbolic link file which is pointing to the target file now instead of using this lengthy part here I can better use my shortcut okay so these are called symbolic links please remember symbolic link does not contain the data all the data we have in the target file we don't have anything over here okay what are the qualities of symbolic link now both the files will have different inode numbers will discuss about eye notes both files the source file and the target file will have different inode numbers will have different permissions and the different size also okay soft link will always have different name same content both will be having same content but the different name okay and remember soft links can be created only for files and directories when you compare with hard link hard link can be created only for files but not for directories soft links can be created for files and directories and soft link can cross the five systems also you can establish a link between five systems where as hard link you cannot span across five systems ok I hope you got me about symbolic links here see the qualities of soft links what we have discussed ok both files will have different inode numbers different permissions different size but the same content but with a different name ok what are hard links now in computing a hard link is a directory entry that Associates a name with a file on a file system all directory based file systems must have at least one hard link giving the original file for each directory ok the hard link is usually only used in the file system that allows more than one hard link for the same file ok hard links can be created only for files but not for directories and hard link you cannot span across partitions it should be created within the file system ok so these are some of the differences between the symbolic links and hard links here ok and coming to the next question like what is the maximum length of a file name under Linux this is also one of the important question which is frequently asked in Linux interviews Linux has the maximum file length of 255 characters ok for most file systems like ext3 ext4 in those file systems you can have a file up to length of 255 characters ok and the maximum path of 4 0 9 6 characters ok so what we have discussed here the maximum path you can have up to 4 0 9 6 characters and one particular filename you can have up to 255 characters okay coming to the next question which type of files are prefixed with a dot so generally in Linux and UNIX operating system if any objects starts with dot or prefixed with dot those are called hidden files I am on the super user home directory if I want to see all the files here you can run a command LS - a including all the files you see one particular file prefixed with the dot so this is exactly a hidden file this is a regular file which is not starting the dot and this is the file which is prefixed with dot this is the hidden file okay and you see a directory also which is prefixed with dot and you see the regular directory public is a regular directory dot cache is the hidden directory so these files can be sometimes called as the configuration files also which holds some important data if you see one example here cat Bashar see some aleosis has been mentioned here for that particular environment right so mostly in Linux and UNIX operating system if any objects begins with dot those are called hidden files and hidden directories coming to the next question like what is a virtual desktop which will desktop like whenever a user's desktop environment when I talk about users desktop environment like icons wallpapers windows like folders toolbars okay is stored in a remote server rather than on a local PC then it's exactly called as a virtual desktop okay the desktop virtualization software separates the physical machine from the software and presence and isolated operating system for users desktop virtualization tools include like Microsoft Virtual PC VMware Workstation and parallel Desktop for Mac operating system the main benefits of desktop virtualization it just includes like cost savings because resources can be shared and allocated as a needed basis and more efficient use of resources and energy improved data integrity because backup is centralized and centralized administration okay this is about the virtual desktop but we have discussed the benefits of virtual desktops okay and what does the nameless empty directory represents empty directory as you know empty directory name serves as a nameless base for the Linux file system deserves as a attachment for other direct files drives and devices okay empty directory how can you create folders and files using the terminal so in Linux operating system if you want to create a directory you can use the command mkdir and to create files we have many such programs for example like VI cat command or you can use graphical base editors like G edit and edit Pico nano you have many such programs to create files okay you even have line editor screen based editors graphical base editors to create files in Linux and UNIX operating system ok but if you want to create a directory you want to create a folder use the command mkdir ok and next question would be what is the different ways to weave the contents of the file ok to remove the contents and file once again we have many such programs here we have many such inbuilt Linux programs you can either use graphical based editors or text based editors something like cat VI VI M G edit you have Pico Nano you have many such programs ok what our environment variables one important and interesting question what our environment variables environment variables are global settings that control the behavior of a shell ok software packages installed in Linux and other processes the path where the various software's are installed will be stored as a environment variables environment variables are used to pass information into processes that are spawned from the shell shell variables and variables that are contained exclusively within the shell in which they were set or defined while interacting with your server through a shell session there are many pieces of information that will come pies to determine its behavior and access to resources some examples if you want to see in environment variables also we have different types we have system variables and we have user defined variables in the case if we want to see the system variables you can run the command env env is a command to display all the environment variables which are set by default with the operating system okay one good example of an environment variable would be path okay this is a system variable which has the information about the path of all your binaries all your executables okay if you take one more example you see the environment variable called home what is the superuser home directory which is slash route okay these are some examples here environment variables okay system variables and user defined variables what is the functionality of a tab key in see a light we were discussing above the features of bash shell right I was talking about c'mon aliasing command completion by using tab keys and command history let me show you practically here in the current working directory called slash root I have a file called anaconda Keys dot CFG let's take one example here there is a file called anaconda J's dot C of G if I want to see the contents of this file I can run a program called less or more or cat you can do anything here but I have to type the complete file named cave dot CFG rather what I will do here I'll simple type few letters I'll use the tab key here automatically the file name would be completed same cat anaconda cave store TFG I am not typing the complete file name I am just using a few letters and then I am using the tab keys enter to see the contents of this particular file similarly there are many programs in Linux starts with the character C albeit free here I'll use the tab key I can see with the C letter I have 162 possibilities that means I have 152 programs here you see one such program called cat if we want to see ca use the tab key here with the ca we have this many possibilities here one good example is scat one good example would be calendar okay so these are the features of the bash shell okay too need a commander to complete a file name or the directory name okay so please let me know if you have any questions any queries okay what is redirection in Linux is this is also one of the frequently asked questions in the next year okay so what is exactly a redirection so in Linux redirection is used to pass the output of one operation as input to another operation in the same command if you see one example here as an administrator I would like to find out like the users who logged in with my operating system who currently using my operating system I can run the command called W with the W I can have all this information okay since when my PC is up and running okay for how long the PCs up and running how many users are connected and what is the load average of my computer and you see the remaining information here the users the terminal they logged in from bit system they logged in you see the login time you see the idle the J CPU P CPU and what exactly they're doing what commands they're executing okay I just want to send this report through one of my lead manager so that he can have this information here W and I would like to save this particular information in one particular file so this is exactly called as a redirection okay so redirection is nothing but which is used to pass the output of W command okay output of one operation will be the input for another operation okay W will display all this information and this will pass to this particular file see catalog all this information has been passed here this is exactly called as a redirector the greater than symbol okay it is called as the redirector the redirector symbol the greater than symbol okay they give one more examples here the cat file file1 file2 the contents of file1 file2 will be in 5/3 okay if 5/3 already exist the 5/3 would be overwritten and if you don't want to overwritten if we want to append you use double redirecting to okay and what is grep so this command is used for searching for a particular string or you can also call it as a word searching for particular word in a text file okay it also supports pattern based searching the pattern based searching is done by including options and parameters in the command okay one such example is the command is grab I have a file here the file called testing in this particular file I have some words and characters and numbers here I would like to grab this word the command is grip the word you want to search for from the file called testing see grep the string or the word you want to search for from the file called testing here okay if we want to see with the line on this you can pass an argument called - n at line number 17 I have the word called SD if we want to see the count of the word you can use an argument called - see I just have only one bird called SD in the file called testing the count like this we have many such arguments and grip okay the pattern based searching is also possible in grep command okay and coming to the next question like how to terminate on ongoing process in Linux here so in Linux every process in Linux operating system is identified by a UNIX process which is called as a PID number okay PID is nothing but the process ID to terminate any process we can use the command kill you can either use the process name or you can use the process ID okay you see the command kill and if you want to terminate all bosses at once you can use the command kill zero okay it shouldn't be executed on production environments kill zero not recommended command but only for information sake and how to insert comments in command prompt so this is a very basic question carbons are inserted by using the hash symbol before they come in text you see any such configuration file for example if you take /et see slash grab gone or slash EDC slash profile for example okay you see the comments here the comments can be provided by using the hash symbols so these are the commented lines and these are called uncommented lines okay so can you insert several commands in a single command line entry if so then house it's a very good question so this is also called as a command chaining like you can execute multiple commands one by one okay by using a semicolon okay if I give you one practical example here the first thing is I would like to create a directory called directory 1 and then I want to go to this directory then under this directory would like to create all this files so this is called command chaining one after the other the commands would be executed the first command is to create a directory and the second command to execute a directory under this directory I am creating all this files with the names called JK and L ok this is exactly called the series of commands in a single entry you go to this directory see the files has been created here ok write a command that will display all the txt files along with its permissions ok write a command that will display all the txt files means we have to use the regular expressions and the common extension we have to use this dot txt so I'll use a command LS - al star dot txt ok so in this particular directory I don't have anything here that's a dot txt but this would be the command the command is LS - al star dot txt it would display all the files including hidden files with the properties ok see here I got Geetha dot txt report dot txt along with the properties here ok and the next question would you write a command that will look for files with dot txt extension and has the occurrence of the string a dareka in it ok so we have to use combination of commands here and that combination would be I'll give an X sample here of find /search from the complete directory here I would like to search the txt files here from the txt files I would like to search for a word pattern called ed Eureka okay the combination of commands fear first it would find all the files which has the extension txt and then using the advanced command called X arguments I am running a command called grep - I I am searching for the word path and called a Eureka okay fine will list all the files with extension dot PHP and grep is used to search for the string a Eureka this is how you can do it same thing how to find the status of a process if you want to find the status of a process in Linux operating system you can run the command called PS - aux ok so you see the status here the status of a process if it is s it is interrupt ability state that means it is waiting for an event to complete ok if you find be somewhere here B that is uninterruptible sleep state usually it is waiting for ru operation to complete if it is R that is a running state if it is Z that is nothing but the defunct process which is also called as a zombie process okay the process which is terminated but not reaped by its parent if it is T all of you that is it is a stop the state either by a job control signal or anything it can be okay you can also see some code meaning here you have the greater than symbol and you have n you have L there a greater than symbol is nothing but the process which is of high priority you see here okay intercept able sleep state which is of high priority if it is n here somewhere you see n here n is nothing but the low priority if it is L means the process where the pages have been logged into memory okay like this you can find out the process states by using the comma PS - aux the status of a process you should look into this column the stages of the process okay and what is the command to calculate the size of a folder this is also one of the important question and you can find out with the command D U which is nothing but the directory usage and with the arguments - SH of the directory boot you see for the directory boot it is occupied 135 MB okay the command bu is to find out the directory usage of a particular directory okay how to check the memory status of the system it is a repeated question again the command is free - M or free - G okay same thing and how to login as root in Linux from the terminal I have already logged in as a root here let's say for example I have a user called ed Eureka this is a user logged in with the user ID Eureka I want to gain access to super user okay I want to log in as root simple I can run the command sudo su - and I think I don't have Suda's configured here as simple run the command su - and then I need to provide a super user password then I can login as a root say here the brunt has been changed from the dollar sign to the hash prompt dollar sign is the prompt provided for all users and the hash prompt is the prompt only provided for super user ok the command su su stands for substitute user with the user ID Eureka I gained access to the operating system as root user okay like this you can do the command su and the next question is how can you run a Linux program in the background simultaneously when you start your Linux server this is a very very important question and this is frequently asked in interviews and the command would be no hop ok the command is no hop by using the no hop command the process will run in the background ok any process which receives the no hop signal ok will terminated when you log out the program okay until then the process could be running in the background all the time okay please remember the command would be no hub okay by default it just placed the process in the background which demand tracks events on your computer events on a Linux system okay we have the demons like syslog B we have domestic arses log we have so many tracking events in Linux and UNIX operating system okay the answer should be syslog B or ours this lock okay so what is partial back so partial backup is nothing but a type of backup where the complete operating system is not taken as a backup okay only certain files certain folders have been backed up but not the complete file system that is exactly called as a partial back ok so when you select only some portion of a directory okay in a single partition that is exactly called as a partial by partial backup is not the complete backup only certain files and folders have been backed up okay so in Linux we have many such backup programs like tar cbio dump restore ok using this you can take a back either complete file system backup or the selected files and folders based on the requirement and next question would be I note very very important one inode is nothing but the contents of any file will be stored in data blocks whereas information about that file will be stored in I note so when we talk about data data has two parts the contents the contents will be stored in the data blocks and information about the file what we called as metadata that metadata will be there in the inode ok so information of what type of information is stored in I note like the file size the permissions the user ownership the group ownership the link count then exactly the file was last accessed or last modified ok all that you can see in I note so an inode number points to an inode table which is the data structure that stores all that information the size of the file the device ID the user ID group ID the file mode permissions everything okay so which command is used to set a processor intensive job to execute less CPU time very very important question and the answer would be the command nice andrey nice okay these are the programs which are used to set a priority okay you can change the process priority using nice and renoise programs so nice command will launch the process with an user-defined scheduling priority three nice command will modify the scheduling priority of a running process okay so the process scheduling priority ranges from minus 20 to 19 keep this in mind this is very important okay the process scheduling priority range from minus 20 to 19 we also call this as a nice value okay a nice value of minus 20 represents the highest priority and the nice value of 19 represents the least priority of a process okay if I show you one practical example here let me just create one particular file cat redirecting file one I am creating a file okay so in the back end when process would be invoked because I'm creating a file here let me open other session here let me show you by just running the command psi n SL and the process name called cat ok see this particular process by default you see the nice value the nice value is d is 0 whenever you submit a process by default every process will have a nice value 0 ok see you similarly if I submit a program with the less priority for example minus 10 ok minus 10 cat redirecting file 1 here now you see the nice value let me open the other sir this one let me recall the same command now you see the nice body for cat command the next value is 10 ok the nice value ranges from minus 20 - 19 - 20 being the high preppy and 19 Bing d-list pratik see I launched a program with a nice value with the least value called 10 okay if you want to launch a program with the highest priority I'll give minus 10 okay do not get confused here it is not - - it is minus 10 now you see now it is minus 10 okay that means this command requires more CPU time okay similarly unlike nice if there is already a running process that can be changed by using the command called renoise okay the command is real nice - n the priority you want okay and you can give the process name or the process ID you can do with the renoise 3 nice can be used if the program is aldeen used ok very important programs see here the priority ranges from minus 20 to 19 - 20 being the highest and 19 being the lowest priority and the last question is like what our shadow passwords and half they are enabled so shadow passwords are given for better system security every users passwords will be stored in slash EDC / password file and by implementing shadow passwords all passwords will be stored in encrypted format in a new file called / z DC / shadow ok the passwords in the original file will then be replaced with X in multi-user environments it is very important to use a shadow passwords ok if I give one small example like in Linux we have two such database files here one database file will have information about users and other database file will have information about users passwords / EDC / shadow ok we have two such database files here which keeps information about users and users passwords okay so this is to improve the security in earlier days in earlier versions of Linux and UNIX operating system there used to be only one particular file which has everything user and the users file see an example here example calls password converts cat / etc' / password used to have everything like this in one particular file you have uses the users passwords and everything but the problem is this particular file is readable by everyone see you / ATC / password is owned by root he got full permissions here even others got read permissions okay which does not impose security on this particular file okay so that is the reason there are two database files maintained one is EDC password and EDC shadow finds now you see the shadow file is only has three permissions for root for others you see we have none permissions okay so this is us we have two database files your EDC password which has information about users and EPC shadow which has information about users passwords okay not only pass which we also have information about the password age also for how long we can use this password when password would be expired all this information can be used in EPC shadow fight okay so this is all about Linux interview I hope the session is useful for everyone in case if you have any questions any queries you can always ask me I hope you enjoyed listening to this video please be kind enough to like it and you can comment any of your doubts and queries and we will reply to them at the earliest do look out for more videos in our playlist and subscribe to our ready Rica challenge learn more happy learning
Info
Channel: edureka!
Views: 584,862
Rating: 4.8754411 out of 5
Keywords: yt:cc=on, linux interview questions and answers for experienced, linux interview questions and answers for freshers, linux interview questions and answers, linux admin interview questions and answers, linux tutorial for beginners, linux tutorial, linux administration tutorial, linux tutorial videos, linux training, linux administration training videos, linux commands, linux command line tutorial, linux admin interview videos, linux course videos, linux edureka, edureka
Id: p3tvtXOg5rg
Channel Id: undefined
Length: 81min 39sec (4899 seconds)
Published: Tue Jun 13 2017
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.