{"id":13534,"date":"2019-04-03T09:37:38","date_gmt":"2019-04-03T09:37:38","guid":{"rendered":"http:\/\/www.appservgrid.com\/paw92\/?p=13534"},"modified":"2019-04-03T09:37:38","modified_gmt":"2019-04-03T09:37:38","slug":"linux-interview-questions-answers","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/03\/linux-interview-questions-answers\/","title":{"rendered":"Linux INTERVIEW QUESTIONS &#038; ANSWERS"},"content":{"rendered":"<h1 class=\"post-title\">11 Basic Linux Interview Questions and Answers<\/h1>\n<p>Theories apart, we are proud to announce a new section on\u00a0<strong>Tecmint<\/strong>, dedicated to\u00a0<strong>Linux Interview<\/strong>. Here we will bring to you\u00a0<strong>Linux Interview Questions<\/strong>\u00a0and all other aspects of Linux, which is must for a professional in this cut-throat competition world.<\/p>\n<div id=\"attachment_4785\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Basic-Interview-Questions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4785\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Basic-Interview-Questions.png\" alt=\"Basic Linux Interview Questions\" width=\"425\" height=\"276\" aria-describedby=\"caption-attachment-4785\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-4785\" class=\"wp-caption-text\">Basic Linux Interview Questions<\/p>\n<\/div>\n<p>A new article in this section (<strong>Linux Interview<\/strong>) will be posted on every weekend. The initiative taken by\u00a0<strong>Tecmint<\/strong>\u00a0is first of it\u2019s kind among other\u00a0<strong>Linux Dedicated<\/strong>\u00a0websites, along with quality and unique articles.<\/p>\n<p>We will start with\u00a0<strong>Basic Linux Interview<\/strong>\u00a0<strong>Question<\/strong>\u00a0and will go advance article by article, for which your response is highly appreciated, which put us on a higher note.<\/p>\n<h6>Q.1: What is the core of Linux Operating System?<\/h6>\n<ol>\n<li>Shell<\/li>\n<li>Kernel<\/li>\n<li>Command<\/li>\n<li>Script<\/li>\n<li>Terminal<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0Kernel is the core of Linux Operating System. Shell is a command Line Interpreter, Command is user Instruction to Computer, Script is collection of commands stored in a file and Terminal is a command Line Interface<\/div>\n<h6>Q.2: What Linus Torvalds Created?<\/h6>\n<ol>\n<li>Fedora<\/li>\n<li>Slackware<\/li>\n<li>Debian<\/li>\n<li>Gentoo<\/li>\n<li>Linux<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0Linus Torvalds created Linux, which is the kernel (heart) of all of the above Operating System and all other Linux Operating System.<\/div>\n<h6>Q.3: Torvalds, Wrote most of the Linux Kernel in C++ programming Language, do you agree?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0No! Linux Kernel contains 12,020,528 Lines of codes out of which 2,151,595 Lines are comments. So remaining 9,868,933 lines are codes and out of 9,868,933 Lines of codes 7,896,318 are written in C Programming Language.<\/div>\n<p>The remaining Lines of code 1,972,615 is written in C++, Assembly, Perl, Shell Script, Python, Bash Script, HTML, awk, yacc, lex, sed, etc.<\/p>\n<p><strong>Note<\/strong>\u00a0: The Number of Lines of codes varies on daily basis and an average of more than 3,509 lines are being added to Kernel.<\/p>\n<h6>Q.4: Linux initially was developed for intel X86 architecture but has been ported to other hardware platform than any other Operating System. Do you agree?.<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes, I do agree. Linux was written for x86 machine, and has been ported to all kind of platform. Today\u2019s more than 90% of supercomputers are using Linux. Linux made a very promising future in mobile phone, Tablets. In-fact we are surrounded by Linux in remote controls, space science, Research, Web, Desktop Computing. The list is endless.<\/div>\n<h6>Q.5: Is it legal to edit Linux Kernel?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes, Kernel is released under General Public Licence (GPL), and anyone can edit Linux Kernel to the extent permitted under GPL. Linux Kernel comes under the category of Free and Open Source Software (FOSS).<\/div>\n<h6>Q.6: What is the basic difference between UNIX and Linux Operating System.<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Linux Operating System is Free and Open Source Software, the kernel of which is created by Linus Torvalds and community. Well you can not say UNIX Operating System doesn\u2019t comes under the category of Free and Open Source Software, BSD, is a variant of UNIX which comes under the category of FOSS. Moreover Big companies like Apple, IBM, Oracle, HP, etc. are contributing to UNIX Kernel.<\/div>\n<h6>Q. 7: Choose the odd one out.<\/h6>\n<ol>\n<li>HP-UX<\/li>\n<li>AIX<\/li>\n<li>OSX<\/li>\n<li>Slackware<\/li>\n<li>Solaris<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0Slackware is the odd in the above list. HP-UX, AIX, OSX, Solaris are developed by HP, IBM, APPLE, Oracle respectively and all are UNIX variant. Slackware is a Linux Operating System.<\/div>\n<h6>Q.8: Is Linux Operating system Virus free?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0No! There doesn\u2019t exist any Operating System on this earth that is virus free. However Linux is known to have least number of Viruses, till date, yes even less than UNIX OS. Linux has had about 60-100 viruses listed till date. None of them actively spreading nowadays. A rough estimate of UNIX viruses is between 85 -120 viruses reported till date.<\/div>\n<h6>Q.9: Linux is which kind of Operating System?<\/h6>\n<ol>\n<li>Multi User<\/li>\n<li>Multi Tasking<\/li>\n<li>Multi Process<\/li>\n<li>All of the above<\/li>\n<li>None of the above<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0All of the Above. Linux is an Operating System which supports Multi User, Running a Number of Processes performing different tasks simultaneously.<\/div>\n<h6>Q.10: Syntax of any Linux command is:<\/h6>\n<ol>\n<li>command [options] [arguments]<\/li>\n<li>command options [arguments]<\/li>\n<li>command [options] [arguments]<\/li>\n<li>command options arguments<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0The correct Syntax of Linux Command is Command [options] [arguments].<\/div>\n<h6>Q.11: Choose the odd one out.<\/h6>\n<ol>\n<li>Vi<\/li>\n<li>vim<\/li>\n<li>cd<\/li>\n<li>nano<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0The odd one in the above list is cd. Vi, vim and nano are editors which is useful in editing files, while cd command is used for changing directory.<\/div>\n<p>That\u2019s all for now. How much you learned for the above questions? How it helped you in your Interview? We would like to hear all these from you in our comment section. Wait till the next weekend, for new set of questions.<\/p>\n<h1 class=\"post-title\">Basic Linux Interview Questions and Answers \u2013 Part II<\/h1>\n<p>Continuing the\u00a0<strong>Interview Series<\/strong>, we are giving\u00a0<strong>10 Questions<\/strong>\u00a0here, in this article. These questions and the questions in the future articles doesn\u2019t necessarily means they were asked in any interview. We are presenting you an interactive learning platform through these kind of posts, which surely will be helpful.<\/p>\n<div id=\"attachment_4823\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Basic-Interview-Questions-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-4823\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/11\/Basic-Interview-Questions-2.png\" alt=\"Basic Linux Interview Questions\" width=\"425\" height=\"276\" aria-describedby=\"caption-attachment-4823\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-4823\" class=\"wp-caption-text\">Basic Linux Interview Questions \u2013 2<\/p>\n<\/div>\n<p>Upon the analysis of comments in different forums on last article\u00a0<a href=\"https:\/\/www.tecmint.com\/basic-linux-interview-questions-and-answers\/\" target=\"_blank\" rel=\"noopener\">11 Basic Linux Interview Questions<\/a>\u00a0of this series, it is important to mention here that to bring up a quality article to our readers. We give our time and money, and in return what we expect from you? Nothing. If you can\u2019t praise our work, please don\u2019t demoralize us from your negative comments.<\/p>\n<p>If you find nothing new in a post, don\u2019t forget that for someone it was helpful, and for that he\/she was thankful. We can\u2019t make everyone happy in each of our article. Hope you readers would take pain to understand this.<\/p>\n<h6>Q.1: Which command is used to record a user login session in a file?<\/h6>\n<ol>\n<li>macro<\/li>\n<li>read<\/li>\n<li>script<\/li>\n<li>record<\/li>\n<li>sessionrecord<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0The \u2018script\u2019 command is used to record a user\u2019s login session in a file. Script command can be implemented in a shell script or can directly be used in terminal. Here is an example which records everything between script and exit.<\/div>\n<p>Let\u2019s record the user\u2019s login session with script command as shown.<\/p>\n<pre>[root@tecmint ~]# script my-session-record.txt\r\n\r\nScript started, file is my-session-record.txt<\/pre>\n<p>The content of log file \u2018my-session-record.txt\u2019 can be views as:<\/p>\n<pre>[root@tecmint ~]# nano my-session-record.txt\r\n\r\nscript started on Friday 22 November 2013 08:19:01 PM IST\r\n[root@tecmint ~]# ls\r\n^[[0m^[[01;34mBinary^[[0m ^[[01;34mDocuments^[[0m ^[[01;34mMusic^[[0m $\r\n^[[01;34mDesktop^[[0m ^[[01;34mDownloads^[[0m my-session-record.txt ^[[01;34$<\/pre>\n<h6>Q.2: The kernel log message can be viewed using which of the following command?<\/h6>\n<ol>\n<li>dmesg<\/li>\n<li>kernel<\/li>\n<li>ls -i<\/li>\n<li>uname<\/li>\n<li>None of the above<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0The kernel log message can be viewed by executing \u2018dmesg\u2019 command. In the list kernel is not a valid Linux command, \u2018ls -i\u2019 lists the file with inode within the working directory and \u2018uname\u2019 command shows os.<\/div>\n<pre>[root@tecmint ~]# dmesg\r\n\r\nInitializing cgroup subsys cpuset\r\nInitializing cgroup subsys cpu\r\nLinux version 2.6.32-279.el6.i686 (mockbuild@c6b9.bsys.dev.centos.org) (gcc version 4.4.6 20120305 (Red Hat 4.4.6-4) (GCC) ) #1 SMP Fri Jun 22 10:59:55 UTC 2012\r\nKERNEL supported cpus:\r\n  Intel GenuineIntel\r\n  AMD AuthenticAMD\r\n  NSC Geode by NSC\r\n  Cyrix CyrixInstead\r\n  Centaur CentaurHauls\r\n  Transmeta GenuineTMx86\r\n  Transmeta TransmetaCPU\r\n  UMC UMC UMC UMC\r\nDisabled fast string operations\r\nBIOS-provided physical RAM map:\r\n...<\/pre>\n<h6>Q.3: Which command is used to display the release of Linux Kernel?<\/h6>\n<ol>\n<li>uname -v<\/li>\n<li>uname -r<\/li>\n<li>uname -m<\/li>\n<li>uname -n<\/li>\n<li>uname -o<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0The command \u2018uname -r\u2019 display the kernel release information. The switch \u2018-v\u2019 , \u2018-m\u2019 , \u2018-n\u2019 , \u2018o\u2019 display kernel version, machine hardware name, network node, hostname and operating system, respectively.<\/div>\n<pre>[root@tecmint ~]# uname -r\r\n\r\n2.6.32-279.el6.i686<\/pre>\n<h6>Q.4: Which command is used to identify the types of file?<\/h6>\n<ol>\n<li>type<\/li>\n<li>info<\/li>\n<li>file<\/li>\n<li>which<\/li>\n<li>ls<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0The \u2018file\u2019 command is used to identify the types of file. The syntax is \u2018file [option] File_name\u2019.<\/div>\n<pre>[root@tecmint ~]# file wtop\r\n\r\nwtop: POSIX shell script text executable<\/pre>\n<h6>Q.5: Which command locate the binary, source and man page of a command?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The \u2018whereis\u2019 command comes to rescue here. The \u2018whereis\u2019 command locate the binary, source, and manual page files for a command.<\/div>\n<pre>[root@tecmint ~]# whereis \/usr\/bin\/ftp\r\n\r\nftp: \/usr\/bin\/ftp \/usr\/share\/man\/man1\/ftp.1.gz<\/pre>\n<h6>Q.6: When a user login, which files are called for user profile, by default??<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The \u2018.profile\u2019 and \u2018.bashrc\u2019 present under home directory are called for user profile by default.<\/div>\n<pre>[root@tecmint ~]# ls -al\r\n-rw-r--r--.  1 tecmint     tecmint            176 May 11  2012 .bash_profile\r\n-rw-r--r--.  1 tecmint     tecmint            124 May 11  2012 .bashrc<\/pre>\n<h6>Q.7: The \u2018resolv.conf\u2019 file is a configuration file for?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The \u2018\/etc\/resolv.conf\u2019 is the configuration file for DNS at client side.<\/div>\n<pre>[root@tecmint ~]# cat \/etc\/resolv.conf\r\n\r\nnameserver 172.16.16.94<\/pre>\n<h6>Q.8: Which command is used to create soft link of a file?<\/h6>\n<ol>\n<li>ln<\/li>\n<li>ln -s<\/li>\n<li>link<\/li>\n<li>link -soft<\/li>\n<li>None of the above<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0The \u2018ln -s\u2019 command is used to create soft link of a file in Linux Environment.<\/div>\n<pre>[root@tecmint ~]# ln -s \/etc\/httpd\/conf\/httpd.conf httpd.original.conf<\/pre>\n<h6>Q.9: The command \u2018pwd\u2019 is an alias of command \u2018passwd\u2019 in Linux?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0No! The command \u2018pwd\u2019 is not an alias of command \u2018passwd\u2019 by default. \u2018pwd\u2019 stands for \u2018print working directory\u2019, which shows current directory and \u2018passwd is used to change the password of user account in Linux.<\/div>\n<pre>[root@tecmint ~]# pwd\r\n\r\n\/home\/tecmint<\/pre>\n<pre>[root@tecmint ~]# passwd\r\nChanging password for user root.\r\nNew password:\r\nRetype new password:<\/pre>\n<h6>Q.10: How will you check pci devices vendor and version on a Linux?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The Linux command \u2018lspci\u2019 comes to rescue here.<\/div>\n<pre>[root@tecmint ~]# lspci\r\n\r\n00:00.0 Host bridge: Intel Corporation 5000P Chipset Memory Controller Hub (rev b1)\r\n00:02.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 2-3 (rev b1)\r\n00:04.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 4-5 (rev b1)\r\n00:06.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 6-7 (rev b1)\r\n00:08.0 System peripheral: Intel Corporation 5000 Series Chipset DMA Engine (rev b1)\r\n...<\/pre>\n<p>That\u2019s all for now. I hope these above questions might be very helpful to you. In our next weekend we again come-up with some new set of questions.<\/p>\n<h1 class=\"post-title\">10 Linux Interview Questions and Answers for Linux Beginners \u2013 Part 3<\/h1>\n<p>Continuing the\u00a0<strong>Interview Questions<\/strong>\u00a0series, with a big thanks for the nice feedback on last two articles of this series, we are here presenting\u00a0<strong>10 questions<\/strong>\u00a0again for interactive learning.<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/basic-linux-interview-questions-and-answers\/\" target=\"_blank\" rel=\"noopener\">11 Basic Linux Interview Questions and Answers \u2013 Part 1<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/basic-linux-interview-questions-and-answers-part-ii\/\" target=\"_blank\" rel=\"noopener\">10 Basic Linux Interview Questions and Answers \u2013 Part II<\/a><\/li>\n<\/ol>\n<div id=\"attachment_5022\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/12\/Basic-Interview-Questions-Part-3.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5022\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/12\/Basic-Interview-Questions-Part-3.png\" alt=\"Linux Interview Questions\" width=\"425\" height=\"276\" aria-describedby=\"caption-attachment-5022\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5022\" class=\"wp-caption-text\">Linux Interview Questions Part \u2013 3<\/p>\n<\/div>\n<h6>1. How will you add a new user (say, tux) to your system.?<\/h6>\n<ol>\n<li>useradd command<\/li>\n<li>adduser command<\/li>\n<li>linuxconf command<\/li>\n<li>All of the above<\/li>\n<li>None of the above<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0All of the above commands i.e.,\u00a0<strong>useradd<\/strong>,\u00a0<strong>adduser<\/strong>\u00a0and\u00a0<strong>linuxconf<\/strong>\u00a0will add an user to the Linux system.<\/div>\n<h6>2. How many primary partition is possible on one drive?<\/h6>\n<ol>\n<li>1<\/li>\n<li>2<\/li>\n<li>4<\/li>\n<li>16<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0There are a maximum of \u2018<strong>4<\/strong>\u2018 primary partition possible on a drive.<\/div>\n<h6>3. The default port for Apache\/Http is?<\/h6>\n<ol>\n<li>8080<\/li>\n<li>80<\/li>\n<li>8443<\/li>\n<li>91<\/li>\n<li>None of the above.<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0By default Apache\/Http is configured on port\u00a0<strong>80<\/strong>.<\/div>\n<h6>4. What does GNU stand for?<\/h6>\n<ol>\n<li>GNU\u2019s not Unix<\/li>\n<li>General Unix<\/li>\n<li>General Noble Unix<\/li>\n<li>Greek Needed Unix<\/li>\n<li>None of the above<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0GNU stands for \u2018<strong>GNU<\/strong>\u2018s not\u00a0<strong>Unix<\/strong>\u2018.<\/div>\n<h6>5. You typed at shell prompt \u201cmysql\u201d and what you got in return was \u201ccan\u2019t connect to local MySQL server through socket \u2018\/var\/mysql\/mysql.sock\u2019\u201d, what would you check first.<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Seeing the error message, I will first check if mysql is running or not using commands\u00a0<strong>service mysql status<\/strong>\u00a0or\u00a0<strong>service mysqld status<\/strong>. If mysql service is not running, starting of the service is required.<\/div>\n<p><strong>Note<\/strong>:The above error message can be the result of ill configured\u00a0<strong>my.cnf<\/strong>\u00a0or mysql\u00a0<strong>user permission<\/strong>. If mysql service starting doesn\u2019t help, you need to see into the above said issues.<\/p>\n<h6>6. How to Mount a windows ntfs partition on Linux?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0First install\u00a0<strong>ntfs\u00ad3g<\/strong>\u00a0pack on the system using\u00a0<strong>apt<\/strong>\u00a0or\u00a0<strong>yum<\/strong>\u00a0tool and then use \u201c<strong>mount sudo mount \u00adt ntfs\u00ad3g \/dev\/&lt;Windows\u00adpartition&gt;\/&lt;Mount\u00adpoint&gt;<\/strong>\u201d command to mount Windows partition on Linux.<\/div>\n<h6>7. From the following which is not an RPM based OS.?<\/h6>\n<ol>\n<li>RedHat Linux<\/li>\n<li>Centos<\/li>\n<li>Scientific Linux<\/li>\n<li>Debian<\/li>\n<li>Fedora<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0The \u2018<strong>Debian<\/strong>\u2018 operating system is not an\u00a0<strong>RPM<\/strong>\u00a0based and all listed above are \u2018<strong>RPM<\/strong>\u2018 based except Debian.<\/div>\n<h6>8. Which command can be used to rename a file in Linux.?<\/h6>\n<ol>\n<li>mv<\/li>\n<li>ren<\/li>\n<li>rename<\/li>\n<li>change<\/li>\n<li>None of the Above<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0The\u00a0<strong>mv<\/strong>\u00a0command is used to rename a file in Linux. For example,\u00a0<strong>mv \/path_to_File\/original_file_name.extension \/Path_to_File\/New_name.extension<\/strong>.<\/div>\n<h6>9. Which command is used to create and display file in Linux?<\/h6>\n<ol>\n<li>ed<\/li>\n<li>vi<\/li>\n<li>cat<\/li>\n<li>nano<\/li>\n<li>None of the above<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0The \u2018<strong>cat<\/strong>\u2018 command can be used to create and display file in Linux.<\/div>\n<h6>10. What layer protocol is responsible for user and the application program support such as passwords, resource sharing, file transfer and network management?<\/h6>\n<ol>\n<li>Layer 4 protocols<\/li>\n<li>Layer 5 protocols<\/li>\n<li>Layer 6 protocols<\/li>\n<li>Layer 7 protocols<\/li>\n<li>None of the above<\/li>\n<\/ol>\n<div><strong>Answer :<\/strong>\u00a0The \u2018<strong>Layer 7 Protocol<\/strong>\u2018 is responsible for user and the application program support such as passwords, resource sharing, file transfer and network management.<\/div>\n<p>That\u2019s all for now. I will be writing on another useful topic soon.<\/p>\n<h1 class=\"post-title\">15 Basic MySQL Interview Questions for Database Administrators<\/h1>\n<p>Prior to This Article, three articles has already been published in \u2018<a title=\"Linux Questions\" href=\"https:\/\/www.tecmint.com\/category\/interview-questions\/\" target=\"_blank\" rel=\"noopener\">Linux Interview<\/a>\u2018 Section and all of them were highly appreciated by our notable readers, however we were receiving feedback to make this interactive learning process, section-wise. From idea to action, we are providing you\u00a0<strong>15 MySQL Interview Questions<\/strong>.<\/p>\n<div id=\"attachment_5093\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/12\/Mysql-Interview-Questions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5093\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2013\/12\/Mysql-Interview-Questions.png\" alt=\"Mysql Interview Questions\" width=\"425\" height=\"276\" aria-describedby=\"caption-attachment-5093\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5093\" class=\"wp-caption-text\">Mysql Interview Questions<\/p>\n<\/div>\n<h6>1. How would you check if MySql service is running or not?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Issue the command \u201c<strong>service mysql status<\/strong>\u201d in \u2018Debian\u2019 and \u201c<strong>service mysqld status<\/strong>\u201d in RedHat. Check the output, and all done.<\/div>\n<pre>root@localhost:\/home\/avi# <strong>service mysql status<\/strong>\r\n\r\n\/usr\/bin\/mysqladmin \u00a0Ver 8.42 Distrib 5.1.72, for debian-linux-gnu on i486\r\nCopyright (c) 2000, 2013, Oracle and\/or its affiliates. All rights reserved.\r\n\r\nOracle is a registered trademark of Oracle Corporation and\/or its\r\naffiliates. Other names may be trademarks of their respective\r\nowners.\r\n\r\nServer version 5.1.72-2\r\nProtocol version 10\r\nConnection Localhost via UNIX socket\r\nUNIX socket \/var\/run\/mysqld\/mysqld.sock\r\nUptime: 1 hour 22 min 49 sec\r\n\r\nThreads: 1 \u00a0Questions: 112138 \u00a0Slow queries: 1 \u00a0Opens: 1485 \u00a0Flush tables: 1 \u00a0Open tables: 64 \u00a0Queries per second avg: 22.567.<\/pre>\n<h6>2. If the service is running\/stop how would you stop\/start the service?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To start MySql service use command as\u00a0<strong>service mysqld start<\/strong>\u00a0and to stop use\u00a0<strong>service mysqld stop<\/strong>.<\/div>\n<pre>root@localhost:\/home\/avi# <strong>service mysql stop<\/strong>\r\n\r\nStopping MySQL database server: mysqld.\r\n\r\nroot@localhost:\/home\/avi# <strong>service mysql start<\/strong>\r\n\r\nStarting MySQL database server: mysqld.\r\n\r\nChecking for corrupt, not cleanly closed and upgrade needing tables..<\/pre>\n<h6>3. How will you login to MySQL from Linux Shell?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To connect or login to MySQL service, use command:\u00a0<strong>mysql -u root -p<\/strong>.<\/div>\n<pre>root@localhost:\/home\/avi# <strong>mysql -u root -p<\/strong> \r\nEnter password: \r\nWelcome to the MySQL monitor.  Commands end with ; or \\g. \r\nYour MySQL connection id is 207 \r\nServer version: 5.1.72-2 (Debian) \r\n\r\nCopyright (c) 2000, 2013, Oracle and\/or its affiliates. All rights reserved. \r\n\r\nOracle is a registered trademark of Oracle Corporation and\/or its \r\naffiliates. Other names may be trademarks of their respective \r\nowners. \r\n\r\nType 'help;' or '\\h' for help. Type '\\c' to clear the current input statement. \r\n\r\nmysql&gt;<\/pre>\n<h6>4. How will you obtain list of all the databases?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To list all currently running databases run the command on mysql shell as:\u00a0<strong>show databases;<\/strong><\/div>\n<pre>mysql&gt; <strong>show databases;<\/strong> \r\n+--------------------+ \r\n| Database           | \r\n+--------------------+ \r\n| information_schema | \r\n| a1                 | \r\n| cloud              | \r\n| mysql              | \r\n| phpmyadmin         | \r\n| playsms            | \r\n| sisso              | \r\n| test               | \r\n| ukolovnik          | \r\n| wordpress          | \r\n+--------------------+ \r\n10 rows in set (0.14 sec)<\/pre>\n<h6>5. How will you switch to a database, and start working on that?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To use or switch to a specific database run the command on mysql shell as:\u00a0<strong>use database_name;<\/strong><\/div>\n<pre>mysql&gt; <strong>use cloud;<\/strong> \r\nReading table information for completion of table and column names \r\nYou can turn off this feature to get a quicker startup with -A \r\n\r\nDatabase changed \r\nmysql&gt;<\/pre>\n<h6>6. How will you get the list of all the tables, in a database?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To list all the tables of a database use the command on mysql shell as:\u00a0<strong>show tables;<\/strong><\/div>\n<pre>mysql&gt; <strong>show tables;<\/strong> \r\n+----------------------------+ \r\n| Tables_in_cloud            | \r\n+----------------------------+ \r\n| oc_appconfig               | \r\n| oc_calendar_calendars      | \r\n| oc_calendar_objects        | \r\n| oc_calendar_repeat         | \r\n| oc_calendar_share_calendar | \r\n| oc_calendar_share_event    | \r\n| oc_contacts_addressbooks   | \r\n| oc_contacts_cards          | \r\n| oc_fscache                 | \r\n| oc_gallery_sharing         | \r\n+----------------------------+ \r\n10 rows in set (0.00 sec)<\/pre>\n<h6>7. How will you get the Field Name and Type of a MySql table?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To get the Field Name and Type of a table use the command on mysql shell as:\u00a0<strong>describe table_name;<\/strong><\/div>\n<pre>mysql&gt; <strong>describe oc_users;<\/strong> \r\n+----------+--------------+------+-----+---------+-------+ \r\n| Field    | Type         | Null | Key | Default | Extra | \r\n+----------+--------------+------+-----+---------+-------+ \r\n| uid      | varchar(64)  | NO   | PRI |         |       | \r\n| password | varchar(255) | NO   |     |         |       | \r\n+----------+--------------+------+-----+---------+-------+ \r\n2 rows in set (0.00 sec)<\/pre>\n<h6>8. How will you delete a table?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To delte a specific table use the command on mysql shell as:\u00a0<strong>drop table table_name;<\/strong><\/div>\n<pre>mysql&gt; <strong>drop table lookup;<\/strong> \r\n\r\nQuery OK, 0 rows affected (0.00 sec)<\/pre>\n<h6>9. What about database? How will you delete a database?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To delte a specific database use the command on mysql shell as:\u00a0<strong>drop database database-name;<\/strong><\/div>\n<pre>mysql&gt; <strong>drop database a1;<\/strong> \r\n\r\nQuery OK, 11 rows affected (0.07 sec)<\/pre>\n<h6>10. How will you see all the contents of a table?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To view all the contents of a particular table use the command on mysql shell as:\u00a0<strong>select * from table_name;<\/strong><\/div>\n<pre>mysql&gt; <strong>select * from engines;<\/strong> \r\n+------------+---------+----------------------------------------------------------------+--------------+------+------------+ \r\n| ENGINE     | SUPPORT | COMMENT                                                        | TRANSACTIONS | XA   | SAVEPOINTS | \r\n+------------+---------+----------------------------------------------------------------+--------------+------+------------+ \r\n| InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys     | YES          | YES  | YES        | \r\n| MRG_MYISAM | YES     | Collection of identical MyISAM tables                          | NO           | NO   | NO         | \r\n| BLACKHOLE  | YES     | \/dev\/null storage engine (anything you write to it disappears) | NO           | NO   | NO         | \r\n| CSV        | YES     | CSV storage engine                                             | NO           | NO   | NO         | \r\n| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables      | NO           | NO   | NO         | \r\n| FEDERATED  | NO      | Federated MySQL storage engine                                 | NULL         | NULL | NULL       | \r\n| ARCHIVE    | YES     | Archive storage engine                                         | NO           | NO   | NO         | \r\n| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance         | NO           | NO   | NO         | \r\n+------------+---------+----------------------------------------------------------------+--------------+------+------------+ \r\n8 rows in set (0.00 sec)<\/pre>\n<h6>11. How will you see all the data in a field (say, uid), from table (say, oc_users)?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To view all the data in a field use the command on mysql shell as:\u00a0<strong>select uid from oc_users;<\/strong><\/div>\n<pre>mysql&gt; <strong>select uid from oc_users;<\/strong> \r\n+-----+ \r\n| uid | \r\n+-----+ \r\n| avi | \r\n+-----+ \r\n1 row in set (0.03 sec)<\/pre>\n<h6>12. Say you have a table \u2018xyz\u2019, which contains several fields including \u2018create_time\u2019 and \u2018engine\u2019. The field \u2018engine\u2019 is populated with two types of data \u2018Memory\u2019 and \u2018MyIsam\u2019. How will you get only \u2018create_time\u2019 and \u2018engine\u2019 from the table where engine is \u2018MyIsam\u2019?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Use the command on mysql shell as:\u00a0<strong>select create_time, engine from xyz where engine=\u201dMyIsam\u201d;<\/strong><\/div>\n<pre>12. mysql&gt; <strong>select create_time, engine from xyz where engine=\"MyIsam\";<\/strong>\r\n\r\n+---------------------+--------+ \r\n| create_time         | engine | \r\n+---------------------+--------+ \r\n| 2013-12-15 13:43:27 | MyISAM | \r\n| 2013-12-15 13:43:27 | MyISAM | \r\n| 2013-12-15 13:43:27 | MyISAM | \r\n| 2013-12-15 13:43:27 | MyISAM | \r\n| 2013-12-15 13:43:27 | MyISAM | \r\n| 2013-12-15 13:43:27 | MyISAM | \r\n| 2013-12-15 13:43:27 | MyISAM | \r\n| 2013-12-15 13:43:27 | MyISAM | \r\n| 2013-10-23 14:56:38 | MyISAM | \r\n| 2013-10-23 14:56:38 | MyISAM | \r\n| 2013-10-23 14:56:38 | MyISAM | \r\n| 2013-10-23 14:56:38 | MyISAM | \r\n| 2013-10-23 14:56:38 | MyISAM | \r\n| 2013-10-23 14:56:38 | MyISAM | \r\n| 2013-10-23 14:56:38 | MyISAM | \r\n+---------------------+--------+ \r\n132 rows in set (0.29 sec)<\/pre>\n<h6>13. How will you show all the records from table \u2018xrt\u2019 where name is \u2018tecmint\u2019 and web_address is \u2018tecmint.com\u2019?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Use the command on mysql shell as:\u00a0<strong>select * from xrt where name = \u201ctecmint\u201d and web_address = \u201ctecmint.com\u201d;<\/strong><\/div>\n<pre>mysql&gt; <strong>select  * from xrt where name = \"tecmint\" and web_address = \u201ctecmint.com\u201d;<\/strong>\r\n+---------------+---------------------+---------------+ \r\n| Id                  | name                   | web_address | \r\n+---------------+---------------------+----------------+ \r\n| 13                 |  tecmint               | tecmint.com  |\r\n+---------------+---------------------+----------------+ \r\n| 41                 |  tecmint               | tecmint.com  |\r\n+---------------+---------------------+----------------+<\/pre>\n<h6>14. How will you show all the records from table \u2018xrt\u2019 where name is not \u2018tecmint\u2019 and web_address is \u2018tecmint.com\u2019?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Use the command on mysql shell as:\u00a0<strong>select * from xrt where name != \u201ctecmint\u201d and web_address = \u201ctecmint.com\u201d;<\/strong><\/div>\n<pre>mysql&gt; <strong>select * from xrt where name != \u201dtecmint\u201d and web_address = \u201dtecmint.com\u201d;<\/strong>\r\n\r\n+---------------+---------------------+---------------+ \r\n| Id            | name                | web_address   | \r\n+---------------+---------------------+----------------+ \r\n| 1173          |  tecmint            | tecmint.com   |\r\n+---------------+---------------------+----------------+<\/pre>\n<h6>15. You need to know total number of row entry in a table. How will you achieve it?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Use the command on mysql shell as:\u00a0<strong>select count(*) from table_name;<\/strong><\/div>\n<pre>mysql&gt; <strong>select count(*) from Tables;<\/strong> \r\n\r\n+----------+ \r\n| count(*) | \r\n+----------+ \r\n|      282 | \r\n+----------+ \r\n1 row in set (0.01 sec)<\/pre>\n<p><strong>Read Also<\/strong>\u00a0:\u00a0<a title=\"Advance MySQL Interview Questions\" href=\"https:\/\/www.tecmint.com\/10-mysql-database-interview-questions-for-beginners-and-intermediates\/\" target=\"_blank\" rel=\"noopener\">10 MySQL Database Interview Questions Intermediates<\/a><\/p>\n<p>That\u2019s all for now. How you feel about this \u2018<strong>Linux Interview Question<\/strong>\u2018 section. Don\u2019t forget to provide us with your valuable feedback in our comment section.<\/p>\n<h1 class=\"post-title\">25 Apache Interview Questions for Beginners and Intermediates<\/h1>\n<p>We are very thankful to All our readers for the response we are getting for our new\u00a0<strong>Linux Interview<\/strong>\u00a0section. And now we have started section wise learning for Interview questions and continuing with the same today\u2019s article focuses on\u00a0<strong>Basic<\/strong>\u00a0to\u00a0<strong>Intermediate<\/strong>\u00a0Apache interview Questions that will help you to prepare yourself.<\/p>\n<div id=\"attachment_5292\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/01\/Apache-Interview-Questions.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-5292\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/01\/Apache-Interview-Questions-620x420.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/01\/Apache-Interview-Questions-620x420.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/01\/Apache-Interview-Questions.jpg 650w\" alt=\"Apache Interview Questions\" width=\"620\" height=\"420\" aria-describedby=\"caption-attachment-5292\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5292\" class=\"wp-caption-text\">Apache Job Interview Questions<\/p>\n<\/div>\n<p>In this section, we have covered some interesting\u00a0<strong>25 Apache Job Interview Questions<\/strong>\u00a0along with their answers so that you can easily understand some new things about Apache that you might never known before.<\/p>\n<p>Before you read this article, We strongly recommend you to don\u2019t try to memorize the answers, always first try to understand the scenarios on a practical basis.<\/p>\n<h6>1. What is Apache web server?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Apache web server HTTP is a most popular, powerful and Open Source to host websites on the web server by serving web files on the networks. It works on HTTP as in Hypertext Transfer protocol, which provides a standard for servers and client side web browsers to communicate. It supports SSL, CGI files, Virtual hosting and many other features.<\/div>\n<h6>2. How to check Apache and it\u2019s version?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0First, use the rpm command to check whether Apache installed or not. If it\u2019s installed, then use\u00a0<strong>httpd -v<\/strong>\u00a0command to check its version.<\/div>\n<pre>[root@tecmint ~]# rpm -qa | grep httpd\r\n\r\nhttpd-devel-2.2.15-29.el6.centos.i686\r\nhttpd-2.2.15-29.el6.centos.i686\r\nhttpd-tools-2.2.15-29.el6.centos.i686<\/pre>\n<pre>[root@tecmint ~]# httpd -v\r\n\r\nServer version: Apache\/2.2.15 (Unix)\r\nServer built:   Aug 13 2013 17:27:11<\/pre>\n<h6>3. Apache runs as which user? and location of main config file?.<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Apache runs with the user \u201cnobody\u201d and httpd daemon. Apache main configuration file: \/etc\/httpd\/conf\/httpd.conf (CentOS\/RHEL\/Fedora) and \/etc\/apache2.conf (Ubuntu\/Debian).<\/div>\n<h6>4. On which port Apache listens http and https both?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0By default Apache runs on http port 80 and https port 443 (for SSL certificate). You can also use\u00a0<a href=\"https:\/\/www.tecmint.com\/20-netstat-commands-for-linux-network-management\/\" target=\"_blank\" rel=\"noopener\">netstat command<\/a>\u00a0to check ports.<\/div>\n<pre>[root@tecmint ~]# netstat -antp | grep http\r\n\r\ntcp        0      0 :::80                       :::*                        LISTEN      1076\/httpd          \r\ntcp        0      0 :::443                      :::*                        LISTEN      1076\/httpd<\/pre>\n<h6>5. How do you install Apache Server on your Linux machine?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Simply, you can use any package installer such as yum on (RHEL\/CentOS\/Fedora) and apt-get on (Debian\/Ubuntu) to install Apache server on your Linux machine.<\/div>\n<pre>[root@tecmint ~]# yum install httpd<\/pre>\n<pre>[root@tecmint ~]# apt-get install apache2<\/pre>\n<h6>6. Where you can find all configuration directories of Apache Web Server?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0By default Apache configuration directories installed under \/etc\/httpd\/ on (RHEL\/CentOS\/Fedora) and \/etc\/apache2 on (Debian\/Ubuntu).<\/div>\n<pre>[root@tecmint ~]# cd \/etc\/httpd\/\r\n[root@tecmint httpd]# ls -l\r\ntotal 8\r\ndrwxr-xr-x. 2 root root 4096 Dec 24 21:44 conf\r\ndrwxr-xr-x. 2 root root 4096 Dec 25 02:09 conf.d\r\nlrwxrwxrwx  1 root root   19 Oct 13 19:06 logs -&gt; ..\/..\/var\/log\/httpd\r\nlrwxrwxrwx  1 root root   27 Oct 13 19:06 modules -&gt; ..\/..\/usr\/lib\/httpd\/modules\r\nlrwxrwxrwx  1 root root   19 Oct 13 19:06 run -&gt; ..\/..\/var\/run\/httpd<\/pre>\n<pre>[root@tecmint ~]# cd \/etc\/apache2\r\n[root@tecmint apache2]# ls -l\r\ntotal 84\r\n-rw-r--r-- 1 root root  7113 Jul 24 16:15 apache2.conf\r\ndrwxr-xr-x 2 root root  4096 Dec 16 11:48 conf-available\r\ndrwxr-xr-x 2 root root  4096 Dec 16 11:45 conf.d\r\ndrwxr-xr-x 2 root root  4096 Dec 16 11:48 conf-enabled\r\n-rw-r--r-- 1 root root  1782 Jul 21 02:14 envvars\r\n-rw-r--r-- 1 root root 31063 Jul 21 02:14 magic\r\ndrwxr-xr-x 2 root root 12288 Dec 16 11:48 mods-available\r\ndrwxr-xr-x 2 root root  4096 Dec 16 11:48 mods-enabled\r\n-rw-r--r-- 1 root root   315 Jul 21 02:14 ports.conf\r\ndrwxr-xr-x 2 root root  4096 Dec 16 11:48 sites-available\r\ndrwxr-xr-x 2 root root  4096 Dec  6 00:04 sites-enabled<\/pre>\n<p>7. Can Apache be secured with TCP wrappers?<\/p>\n<div><strong>Answer :<\/strong>\u00a0No, It can\u2019t be secured with the TCP wrappers since it doesn\u2019t support libwrap.a library of Linux.<\/div>\n<h6>8. How to change default Apache Port and How Listen Directive works in Apache?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0There is a directive \u201cListen\u201d in httpd.conf file which allows us to change the default Apache port. With the help of Listen directive we can make Apache listen on different port as well as different interfaces.<\/div>\n<p>Suppose you have multiple IPs assigned to your Linux machine and want Apache to receive\u00a0<strong>HTTP<\/strong>\u00a0requests on a special Ethernet port or Interface, even that can be done with Listen directive.<\/p>\n<p>To change the Apache default port, please open your Apache main configuration file<strong>\u00a0httpd.conf<\/strong>\u00a0or\u00a0<strong>apache2.conf<\/strong>file with\u00a0<strong>VI<\/strong>\u00a0editor.<\/p>\n<pre>[root@tecmint ~]# vi \/etc\/httpd\/conf\/httpd.conf\r\n\r\n[root@tecmint ~]# vi \/etc\/apache2\/apache2.conf<\/pre>\n<p>Search for the word \u201d<strong>Listen<\/strong>\u201d, comment the original line and write your own directive below that line.<\/p>\n<pre># Listen 80\r\nListen 8080\r\n\r\nOR\r\n\r\nListen 172.16.16.1:8080<\/pre>\n<p>Save the file and restart the web server.<\/p>\n<pre>[root@tecmint ~]# service httpd restart\r\n\r\n[root@tecmint ~]# service apache2 restart<\/pre>\n<h6>9. Can we have two Apache Web servers on a single machine?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes, we can run two different Apache servers at one time on a Linux machine, but the condition for that is they should listen on different ports and we can change the ports with Listen directive of Apache.<\/div>\n<h6>10. What do you mean by DocumentRoot of Apache?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0DocumentRoot in Apache means, it\u2019s the location of web files are stored in the server, the default DocumentRoot of Apache is \/var\/www\/html or \/var\/www. This can be changed to anything, by setting up \u201cDocumentRoot\u201d in a virtual host of configuration file of domain.<\/div>\n<h6>11. How to host files in different folder and what is Alias directive?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes, this can be achieved by Alias directive in the main Apache configuration file. Alias directive maps resources in File system, it takes a URL path and substitute it with a file or directory path on the system with is set up to redirect.<\/div>\n<p>To use Alias directive, Its the part of\u00a0<strong>mod_alias<\/strong>\u00a0module of Apache. The default syntax of Alias directive is:<\/p>\n<pre>Alias \/images \/var\/data\/images\/<\/pre>\n<p>Here in above example,\u00a0<strong>\/images<\/strong>\u00a0url prefix to the\u00a0<strong>\/var\/data\/images<\/strong>\u00a0prefix that mean clients will query for \u201c<strong>http:\/\/www.example.com\/images\/sample-image.png<\/strong>\u201d and Apache will pick up the \u201c<strong>sample-image.png<\/strong>\u201d file from\u00a0<strong>\/var\/data\/images\/sample-image.png<\/strong>\u00a0on the server. It\u2019s also known as URL Mapping.<\/p>\n<h6>12. What do you understand by \u201cDirectoryIndex\u201d?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0DirectoryIndex is the name of first file which Apache looks for when a request comes from a domain. For example: www.example.com is requested by the client, so Apache will go the document root of that website and looks for the index file (first file to display).<\/div>\n<p>The default setting of DirectoryIndex is\u00a0<strong>.html<\/strong>\u00a0<strong>index.html<\/strong>\u00a0<strong>index.php<\/strong>, if you have different names of your first file, you need to make the changes in\u00a0<strong>httpd.conf<\/strong>\u00a0or\u00a0<strong>apache2.conf<\/strong>\u00a0for DirectoryIndex value to display that to your client browser.<\/p>\n<pre>#\r\n# DirectoryIndex: sets the file that Apache will serve if a directory\r\n# is requested.\r\n#\r\n# The index.html.var file (a type-map) is used to deliver content-\r\n# negotiated documents.  The MultiViews Option can be used for the\r\n# same purpose, but it is much slower.\r\n#\r\nDirectoryIndex index.html index.html.var index.cgi .exe<\/pre>\n<h6>13. How to disable Directory listing when an index file is missing?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0If, the main index file is missing in the website root directory, then the Apache will lists all the contents like files and folder of the website on the browser instead of Main website pages.<\/div>\n<p>To stop Apache directory listing, you can set the following rule in the main configuration file globally or in\u00a0<strong>.htaccess<\/strong>\u00a0file for a particular website.<\/p>\n<pre>&lt;Directory \/var\/www\/html&gt;\r\n   Options -Indexes\r\n&lt;\/Directory&gt;<\/pre>\n<h6>14. What are different log files of Apache Web Server?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The default log files of Apache Web Server are access log \u201c\/var\/log\/httpd\/access_log\u201d and error log :\/var\/log\/httpd\/error_log\u201d.<\/div>\n<h6>15. What do you understand by \u201cconnection reset by peer\u201d in error logs?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0When the server is serving any ongoing Apache request and end user terminates the connection in between, we see \u201cconnection reset by peer\u201d in the Apache error logs.<\/div>\n<h6>16. What is Virtual Host in Apache?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The Virtual Host section contains the information like Website name, Document root, Directory Index, Server Admin Email, ErrorLog File location etc.<\/div>\n<p>You are free to add as many directives you require for your domain, but the two minimal entries for a working website is the\u00a0<strong>ServerName<\/strong>\u00a0and\u00a0<strong>DocumentRoot<\/strong>. We usually define our Virtual Host section at the bottom of\u00a0<strong>httpd.conf<\/strong>\u00a0file in Linux machines.<\/p>\n<h5>Sample VirtualHost<\/h5>\n<pre>&lt;VirtualHost *:80&gt;\r\n   ServerAdmin webmaster@dummy-host.example.com\r\n   DocumentRoot \/www\/docs\/dummy-host.example.com\r\n   ServerName dummy-host.example.com\r\n   ErrorLog logs\/dummy-host.example.com-error_log\r\n   CustomLog logs\/dummy-host.example.com-access_log common\r\n&lt;\/VirtualHost&gt;<\/pre>\n<ol>\n<li><strong>ServerAdmin<\/strong>\u00a0: Its usually the email address of the website owner, where the error or notification can be sent.<\/li>\n<li><strong>DocumentRoot<\/strong>\u00a0: location where the web files are located in the server(Necessary).<\/li>\n<li><strong>ServerName<\/strong>\u00a0: Its the domain name which you want to access from your web browser(Necessary).<\/li>\n<li><strong>ErrorLog<\/strong>\u00a0: Its the location of the log file where all the domain related logs are being recorded.<\/li>\n<\/ol>\n<h6>17. What\u2019s the difference between &lt;Location&gt; and &lt;Directory&gt;?<\/h6>\n<div>\n<p><strong>Answer :<\/strong><\/p>\n<ol>\n<li><strong>&lt;Location&gt;<\/strong>\u00a0is used to set element related to the URL \/ address bar of the web server.<\/li>\n<li><strong>&lt;Directory&gt;<\/strong>\u00a0refers that the location of file system object on the server<\/li>\n<\/ol>\n<\/div>\n<h6>18. What is Apache Virtual Hosting?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Apache Virtual hosting is the concept of hosting multiple website on a single web server. There are two types of Virtual hosts can be setup with Apache are\u00a0<strong>Name Based Virtual hosting<\/strong>\u00a0and\u00a0<strong>IP based virtual hosting<\/strong>.<\/div>\n<p>For more information, read on\u00a0<a href=\"https:\/\/www.tecmint.com\/apache-ip-based-and-name-based-virtual-hosting\/\" target=\"_blank\" rel=\"noopener\">How to Create Name\/IP based Virtual Hosts in Apache<\/a>.<\/p>\n<h6>19. What do you understand by MPM in Apache?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0MPM stands for Multi Processing Modules, actually Apache follows some mechanism to accept and complete web server requests.<\/div>\n<h6>20. What is the difference between Worker and Prefork MPM?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Both MPMs, Worker and prefork has their own mechanism to work with Apache. It totally depends on you that in which mode you want to start your Apache.<\/div>\n<ol>\n<li><strong>Basic difference between Worker and MPM<\/strong>\u00a0is in their process of spawning the child process. In the Prefork MPM, a master httpd process is started and this master process starts manages all other child processes to serve client requests. Whereas, In the worker MPM one httpd process is active, and it uses different threads to serve client requests.<\/li>\n<li><strong>Prefork MPM<\/strong>\u00a0uses multiple child processes with one thread each, where worker MPM uses multiple child processes with many threads each.<\/li>\n<li><strong>Connection handling<\/strong>\u00a0in the Prefork MPM, each process handles one connection at a time, whereas in the Worker mpm each thread handles one connection at a time.<\/li>\n<li><strong>Memory footprints<\/strong>\u00a0Prefork MPM Large memory footprints, where Worker has smaller memory footprints.<\/li>\n<\/ol>\n<h6>21. What\u2019s the use of \u201cLimitRequestBody\u201d and how to put limit on your uploads?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0LimitRequestBody directive is used to put a limit on the upload size.<\/div>\n<p>For example: I want to put limits of\u00a0<strong>100000 Byte<\/strong>s in the folder\u00a0<strong>\/var\/www\/html\/tecmin\/<\/strong>uploads. So, you need to add following directive in Apache configuration file.<\/p>\n<pre>&lt;Directory \"\/var\/www\/html\/tecmint\/uploads\"&gt;\r\nLimitRequestBody 100000\r\n&lt;\/Directory&gt;<\/pre>\n<h6>22. What is mod_perl and mod _php?<\/h6>\n<div>\n<p><strong>Answer :<\/strong><\/p>\n<ol>\n<li><strong>mod_perl<\/strong>\u00a0is an Apache module which is compiled with Apache for easy integration and to increase the performance of Perl scripts.<\/li>\n<li><strong>mod_php<\/strong>\u00a0is used for easy integration of PHP scripts by the web server, it embeds the PHP interpreter inside the Apache process. Its forces Apache child process to use more memory and works with Apache only but still very popular.<\/li>\n<\/ol>\n<\/div>\n<h6>23. What is Mod_evasive?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Its a third-party module which helps us to prevent your web server from the web attacks like DDOS because it performs only one task at a time and performs it very well.<\/div>\n<p>For more information, read the article that guides you\u00a0<a href=\"https:\/\/www.tecmint.com\/protect-apache-using-mod_security-and-mod_evasive-on-rhel-centos-fedora\/\" target=\"_blank\" rel=\"noopener\">how to install and configure mod_evasive in Apache<\/a>.<\/p>\n<h6>24. What is Loglevel debug in httpd.conf file?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0With the help of Loglevel Debug option, we can get\/log more information in the error logs which helps us to debug a problem.<\/div>\n<h6>25. What\u2019s the use of mod_ssl and how SSL works with Apache?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Mod_ssl package is an Apache module, which allows Apache to establish its connection and transfer all the data in a secure encrypted environment. With the help of SSL certificates, all the Login details and other important secret details get transferred in an encrypted manner over the Internet, which prevents our data from Eavesdropping and IP spoofing.<\/div>\n<h5>How SSL works with Apache<\/h5>\n<p>Whenever an https requests comes, these three steps Apache follows:<\/p>\n<ol>\n<li>Apache generates its private key and converts that private key to\u00a0<strong>.CSR<\/strong>\u00a0file (Certificate signing request).<\/li>\n<li>Then Apache sends the\u00a0<strong>.csr<\/strong>\u00a0file to the\u00a0<strong>CA<\/strong>\u00a0(Certificate Authority).<\/li>\n<li>CA will take the\u00a0<strong>.csr<\/strong>\u00a0file and convert it to\u00a0<strong>.crt<\/strong>\u00a0(certificate) and will send that\u00a0<strong>.crt<\/strong>\u00a0file back to Apache to secure and complete the https connection request.<\/li>\n<\/ol>\n<p>These are just most popular\u00a0<strong>25 questions<\/strong>\u00a0being asked these days by Interviewers, please provide some more interview questions which you have faced in your recent interview and help others via our Comment section below.<\/p>\n<p>We are also recommend you to read our previous articles on Apache.<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/apache-security-tips\/\" target=\"_blank\" rel=\"noopener\">13 Apache Web Server Security and Hardening Tips<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/sync-two-apache-websites-using-rsync\/\" target=\"_blank\" rel=\"noopener\">How to Sync Two Apache Web Servers\/Websites Using Rsync<\/a><\/li>\n<\/ol>\n<h1 class=\"post-title\">10 MySQL Database Interview Questions for Beginners and Intermediates<\/h1>\n<p>In our last article, we\u2019ve covered\u00a0<a href=\"https:\/\/www.tecmint.com\/basic-mysql-interview-questions-for-database-administrators\/\" target=\"_blank\" rel=\"noopener\">15 Basic MySQL Questions<\/a>, again we are here with another set interview questions for intermediate users. As we said earlier these questions can be asked in\u00a0<strong>Job Interviews<\/strong>. But some of our critics on the last article said, that I don\u2019t give response to my critics and the questions are very basic and will never be asked in any\u00a0<strong>Database Administrator Interview<\/strong>.<\/p>\n<div id=\"attachment_5304\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/01\/Mysql-Job-Interview-Questions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5304\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/01\/Mysql-Job-Interview-Questions.png\" alt=\"Mysql Job Interview Questions\" width=\"425\" height=\"276\" aria-describedby=\"caption-attachment-5304\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5304\" class=\"wp-caption-text\">10 Mysql Job Interview Questions<\/p>\n<\/div>\n<p>To them we must admit all the articles and question can not be composed keeping all the flock in mind. We are coming from basic to expert level step by step. Please Co\u00adoperate with us.<\/p>\n<h6>1. Define SQL?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0SQL stands for Structured Query Language. SQL is a programming Language designed specially for managing data in Relational Database Management System (RDBMS).<\/div>\n<h6>2. What is RDBMS? Explain its features?<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0A Relational Database Management System (RDBMS) is the most widely used database Management System based on the Relational Database model.<\/p>\n<h6>Features of RDBMS<\/h6>\n<ol>\n<li>Stores data in tables.<\/li>\n<li>Tables have rows and column.<\/li>\n<li>Creation and Retrieval of Table is allowed through SQL.<\/li>\n<\/ol>\n<\/div>\n<h6>3. What is Data Mining?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Data Mining is a subcategory of Computer Science which aims at extraction of information from set of data and transform it into Human Readable structure, to be used later.<\/div>\n<h6>4. What is an ERD?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0ERD stands for Entity Relationship Diagram. Entity Relationship Diagram is the graphical representation of tables, with the relationship between them.<\/div>\n<h6>5. What is the difference between Primary Key and Unique Key?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Both Primary and Unique Key is implemented for Uniqueness of the column. Primary Key creates a clustered index of column where as an Unique creates unclustered index of column. Moreover, Primary Key doesn\u2019t allow NULL value, however Unique Key does allows one NULL value.<\/div>\n<h6>6. How to store picture file in the database. What Object type is used?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Storing Pictures in a database is a bad idea. To store picture in a database Object Type \u2018Blob\u2019 is recommended.<\/div>\n<h6>7. What is Data Warehousing?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0A Data Warehousing generally refereed as Enterprise Data Warehousing is a central Data repository, created using different Data Sources.<\/div>\n<h6>8. What are indexes in a Database. What are the types of indexes?<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0Indexes are the quick references for fast data retrieval of data from a database. There are two different kinds of indexes.<\/p>\n<h6>Clustered Index<\/h6>\n<ol>\n<li>Only one per table.<\/li>\n<li>Faster to read than non clustered as data is physically stored in index order.<\/li>\n<\/ol>\n<h6>Non\u00adclustered Index<\/h6>\n<ol>\n<li>Can be used many times per table.<\/li>\n<li>Quicker for insert and update operations than a clustered index.<\/li>\n<\/ol>\n<\/div>\n<h6>9. How many TRIGGERS are possible in MySql?<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0There are only six triggers are allowed to use in MySQL database and they are.<\/p>\n<ol>\n<li>Before Insert<\/li>\n<li>After Insert<\/li>\n<li>Before Update<\/li>\n<li>After Update<\/li>\n<li>Before Delete<\/li>\n<li>After Delete<\/li>\n<\/ol>\n<\/div>\n<h6>10. What is Heap table?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Tables that are present in the memory are called as HEAP tables. These tables are commonly known as memory tables. These memory tables never have values with data type like \u201cBLOB\u201d or \u201cTEXT\u201d. They use indexes which make them faster.<\/div>\n<p>That\u2019s all for now on MySQL questions, I will be coming up with another set of questions soon. Don\u2019t forget to provide your valuable feedback in comment section.<\/p>\n<h1 class=\"post-title\">10 Core Linux Interview Questions and Answers<\/h1>\n<p>Again its time to read some serious content in light mood, Yup! Its another article on Interview question and here we are presenting\u00a0<strong>10 Core Linux Questions<\/strong>, which surely will add to your knowledge.<\/p>\n<div id=\"attachment_5421\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/01\/Core-Linux-Interview-Questions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5421\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/01\/Core-Linux-Interview-Questions.png\" alt=\"Linux Interview Job Questions\" width=\"425\" height=\"276\" aria-describedby=\"caption-attachment-5421\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5421\" class=\"wp-caption-text\">10 Core Linux Interview Questions<\/p>\n<\/div>\n<h6>1. You need to define a macro, a key binding for the existing command. How would you do it?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0There is a command called bind, in bash shell which is capable of defining macro, or binding a key. In order to bind a key with an existing command, we need to generate Character Sequence emitted by the key. Press Ctrl+v and then key F12, I got ^[[24~<\/div>\n<pre>[root@localhost ~]# bind '\"\\e[24~\":\"date\"'<\/pre>\n<p><strong>Note<\/strong>\u00a0: Different types of terminals or terminal emulators can emit different codes for the same key.<\/p>\n<h6>2. A user is new to Linux and he wants to know full list of available commands, what would you suggest him?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0A command \u2018compgen \u00adc\u2019 will show a full list of available commands.<\/div>\n<pre>[root@localhost ~]$ compgen -c\r\n\r\nl.\r\nll\r\nls\r\nwhich\r\nif\r\nthen\r\nelse\r\nelif\r\nfi\r\ncase\r\nesac\r\nfor\r\nselect\r\nwhile\r\nuntil\r\ndo\r\ndone\r\n...<\/pre>\n<h6>3. Your assistant needs to print directory stack, what would you suggest?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The Linux command \u2018dirs\u2019, will print the directory stack.<\/div>\n<pre>[root@localhost ~]# dirs\r\n\r\n\/usr\/share\/X11<\/pre>\n<h6>4. You have lots of running jobs, how would you remove all the running processes, without restarting the machine?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The Linux command \u2018disown -r\u2019 will remove all the running Processes.<\/div>\n<h6>5. What does the command \u2018hash\u2019 is used for in bash Shell?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Linux command \u2018hash\u2019 manages internal hash table, fins and remember full path of the specified command, Display used command names and number of times the command is used.<\/div>\n<pre>[root@localhost ~]# hash\r\n\r\nhits    command\r\n   2    \/bin\/ls\r\n   2    \/bin\/su<\/pre>\n<h6>6. Which built\u00adin Linux command performs arithmetic operation of Integers in Bash?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The \u2018let\u2019 command that performs, arithmetic operation of integer in bash shell.<\/div>\n<pre>#! \/bin\/bash\r\n\r\n...\r\n\r\n...\r\n\r\nlet c=a+b\r\n\r\n...\r\n\r\n...<\/pre>\n<h6>7. You have a large text file, and you need to see one page at a time. What will you do?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0You can achieve the above result by pipeling the output of \u2018cat file_name.txt\u2019 with \u2018more\u2019 command.<\/div>\n<pre>[root@localhost ~]# cat file_name.txt | more<\/pre>\n<h6>8. Who own the data dictionary?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The user \u2018SYS\u2019 owns the data dictionary. Users \u2018SYS\u2019 and \u2018SYSEM are created by default, automatically.<\/div>\n<h6>9. How to know a command summary and useability in Linux?<\/h6>\n<p>Assume you came across a command in \/bin directory, which you are completely unaware of, and have no idea what it does. What will you do to know its useability?<\/p>\n<div><strong>Answer :<\/strong>\u00a0The command \u2018whatis\u2019 display a summary of its useability from the man page. For example, you would like to see a summary of \u2018zcat\u2019 command which you don\u2019t know previously.<\/div>\n<pre>[root@localhost ~]# whatis zcat\r\n\r\nzcat [gzip]          (1)  - compress or expand files<\/pre>\n<h6>10. What command should you use to check the number of files and disk space used by each user\u2019s defined quotas?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The command \u2018repquota\u2019 comes to rescue here. Command repquota summaries quotas for a file system.<\/div>\n<p>That\u2019s all for now. Provide your valuable Feedback in our comment section. Stay tuned for more Linux and Foss posts.<\/p>\n<h1 class=\"post-title\">10 VsFTP (Very Secure File Transfer Protocol) Interview Questions and Answers<\/h1>\n<p><strong>FTP<\/strong>\u00a0stands for \u2018<strong>File Transfer Protocol<\/strong>\u2018 is one of the most widely used and standard protocol available over Internet. FTP works in a\u00a0<strong>Server<\/strong>\/\u00ad<strong>Client<\/strong>\u00a0architecture and is used to transfer file. Initially FTP client were command-\u00adline based. Now most of the platform comes bundled with FTP client and server program and a lot of FTP Client\/Server Program is available. Here we are presenting\u00a0<strong>10 Interview Questions<\/strong>\u00a0based on\u00a0<strong>Vsftp<\/strong>\u00a0(Very Secure File Transfer Protocol) on a Linux Server.<\/p>\n<div id=\"attachment_5495\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/FTP-Intervew-Questions.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5495\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/FTP-Intervew-Questions.jpg\" alt=\"VsFTP Interview Questions\" width=\"400\" height=\"260\" aria-describedby=\"caption-attachment-5495\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5495\" class=\"wp-caption-text\">10 VsFTP Interview Questions<\/p>\n<\/div>\n<h6>1. What is the Difference between TFTP and FTP Server?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0TFTP is File Transfer Protocol which usages User Datagram Protocol (UDP) whereas FTP usages Transmission Control Protocol (TCP). TCP usages port number 20 for Data and 21 for control by default whereas TFTP usages port 69 by default.<\/div>\n<p><strong>Note<\/strong>: Briefly you can say FTP usages port 21 by default when clarification between Data and Control is not required.<\/p>\n<h6>2. How to Restrict Users and Disallow browsing beyond their Home Directories? How?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes! It is possible to restrict users to their home directories and browsing beyond home directories. This can be done by enabling chroot option in ftp configuration file (i.e. vsftpd.conf).<\/div>\n<pre>chroot_local_user=YES<\/pre>\n<h6>3. How would you manage number of FTP clients that connect to your FTP server?<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0We need to set \u2018max_client parameter\u2019. This parameter controls the number of clients connecting, if max_client is set to 0, it will allow unlimited clients to connect FTP server.The maximum client parameter needs to be changed in vsftpd.conf and the default value is 0.<\/p>\n<\/div>\n<h6>4. How to limit the FTP login attempts to fight against botnet\/illegal login attempts?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0We need to edit \u2018max_login_fails parameter\u2019. This parameter manages the maximum number of login attempts before the session is killed. The default value is \u20183\u2019 which means a maximum of \u20183\u2019 login attempts are possible failing which the session will be killed.<\/div>\n<h6>5. How to enable file upload from anonymous users to FTP Server?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Anonymous users can be allowed to upload files to FTP server by modifying parameter \u2018anon_upload_enable\u2019. If Value of anon_upload_enable is set to Yes, Anonymous users are permitted to upload files. In order to have a working anonymous upload, we must have parameter \u2018write_enable\u2019 activated. The Default Value is NO, which means anonymous upload is disabled.<\/div>\n<h6>6. How would you disabled downloads from FTP server?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Disabling Downloads from FTP Server can be implemented by modifying the parameter \u2018download_enable\u2019. If set to NO, all download request will be denied. The Default value is YES which Means, Downloading is Enabled.<\/div>\n<h6>7. How to enable and permit FTP login to local users?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The parameter \u2018Local_enable\u2019 is responsible for managing local users login. In order to activate local users login, we must set \u2018local_enable=yes\u2019 in file vsftpd.conf. The default value is NO, which means Local User Login is not permitted.<\/div>\n<h6>8. Is it Possible to maintain log of FTP requests and responses?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes! We can log FTP requests and responses. What we need to do is to modify the binary value of parameter \u2018log_ftp_protocol\u2019. If set to Yes, it will log all the requests, responses. The log may be very useful in Debugging. The default value of above parameter is NO which means no logs are maintained by default.<\/div>\n<p><strong>Note<\/strong>: In order to create and maintains logs successfully, the parameter \u2018xferlog_std_format\u2019 must be enabled.<\/p>\n<h6>9. How to disable the login for few seconds, in case of failed login. How will you achieve this?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The number of seconds we need to pause in case of failed login attempt can be achieved by modifying the value of parameter \u2018delay_failed_login\u2019. The default value is 1.<\/div>\n<h6>10. How to display certain text message before a client connects to FTP server. How would you get this done?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0We can achieve this by setting \u2018banner_file\u2019. We need to set ftpd_banner=\/path\/to\/banner-file in vsftpd.conf file.<\/div>\n<p>FTP is a very Useful tool and is vast yet very interesting. Moreover it is useful from Interview Point of View. We have taken the pain to bring these questions to you and will cover more of these questions in our future article. Till then stay tuned and connected to Tecmint.<\/p>\n<p><strong>Read Also<\/strong>:\u00a0<a href=\"https:\/\/www.tecmint.com\/10-advance-vsftp-interview-questions-and-answers-part-ii\/\" target=\"_blank\" rel=\"noopener\">10 Advance VsFTP Interview Questions and Answers \u2013 Part II<\/a><\/p>\n<h1 class=\"post-title\">10 Advance VsFTP Interview Questions and Answers \u2013 Part II<\/h1>\n<p>We were overwhelmed with the response we\u2019ve received on our last article. Where we\u2019ve presented\u00a0<strong>10 wonderful question<\/strong>\u00a0on\u00a0<strong>Very Secure File Transfer Protocol<\/strong>. Continuing\u00a0<strong>VSFTP<\/strong>\u00a0interview article we are here presenting you yet another\u00a0<strong>10 Advance Interview Questions<\/strong>\u00a0which surely will help you.<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/ftp-interview-questions-and-answers\/\" target=\"_blank\" rel=\"noopener\">10 Basic Vsftp Interview Question\/Answers \u2013 Part I<\/a><\/li>\n<\/ol>\n<div id=\"attachment_5562\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/VsFTP-Intervew-Questions.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5562\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/VsFTP-Intervew-Questions.jpg\" alt=\"VsFTP Intervew Questions\" width=\"400\" height=\"260\" aria-describedby=\"caption-attachment-5562\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5562\" class=\"wp-caption-text\">VsFTP Intervew Questions \u2013 Part II<\/p>\n<\/div>\n<p>Please note\u00a0<strong>vsftpd.conf<\/strong>\u00a0file is used to control various aspects of configuration as specified in this article. By default, the vsftpd searches for the configuration file under\u00a0<strong>\/etc\/vsftpd\/vsftpd.conf<\/strong>. However, the format of file is very simple and it contains comment or directive. Comment lines begins with a \u2018<strong>#<\/strong>\u2018 are ignored and a directive line has the following format.<\/p>\n<pre>option=value<\/pre>\n<p>Before we start the Question and their well explained Answer we would like to answer a question \u201c<strong>Who is going to attend FTP Interview<\/strong>?\u201d. Well no one. Perhaps no one would be attending FTP interview. But we are presenting subject wise questions to maintain a systematic approach so that in any Interview, you wont get a new question which you wont be knowing on any of the topics\/subjects we covered here.<\/p>\n<h6>11. How would you block an IP which is acting malicious on your internal private VSFTP network?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0We can Block IP either by adding the suspicious IP to \u2018\/etc\/hosts.deny\u2019 file or alternatively adding a DROP rule for the suspicious IP to iptables INPUT chain.<\/div>\n<h5>Block IP using host.deny file<\/h5>\n<p>Open \u2018\/etc\/hosts.deny\u2019 file.<\/p>\n<pre># vi \/etc\/hosts.deny<\/pre>\n<p>Append the following line at the bottom of the file with the IP address that you want to block access to FTP.<\/p>\n<pre>#\r\n# hosts.deny    This file contains access rules which are used to\r\n#               deny connections to network services that either use\r\n#               the tcp_wrappers library or that have been\r\n#               started through a tcp_wrappers-enabled xinetd.\r\n#\r\n#               The rules in this file can also be set up in\r\n#               \/etc\/hosts.allow with a 'deny' option instead.\r\n#\r\n#               See 'man 5 hosts_options' and 'man 5 hosts_access'\r\n#               for information on rule syntax.\r\n#               See 'man tcpd' for information on tcp_wrappers\r\n#\r\n<strong>vsftpd:172.16.16.1<\/strong><\/pre>\n<h5>Block IP using iptables rule<\/h5>\n<p>To block FTP access to particular IP address, add the following drop rule to iptables INPUT chain.<\/p>\n<pre>iptables -A RH-Firewall-1-INPUT -p tcp -s <strong>172.16.16.1<\/strong> -m state --state NEW -m tcp --dport 21 -j DROP<\/pre>\n<h6>12. How to allow secured SSL connections to Anonymous users? How would you do?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes! It is possible to allow anonymous users to use secured SSL connections. The value of parameter \u2018allow_anon_ssl\u2019 should be \u2018YES\u2019 in the vsftpd.conf file. If it, set to NO it wont allow anonymous users to use SSL connections. The default value is NO.<\/div>\n<pre># Add this line to enable secured SSL connection to anonymous users.\r\n<strong>allow_anon_ssl=YES<\/strong><\/pre>\n<h6>13. How to allow Anonymous users to create new directory and write to that directory?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0We need to edit the parameter \u2018anon_mkdir_write_enable\u2019 and set it\u2019s value to \u2018YES\u2019. But in order to make the parameter working, \u2018write_enable\u2019 must be activated. The default is NO.<\/div>\n<pre># Uncomment this to enable any form of FTP write command.\r\n<strong>write_enable=YES<\/strong><\/pre>\n<pre># Uncomment this if you want the anonymous FTP user to be able to create\r\n# new directories.\r\n<strong>anon_mkdir_write_enable=YES<\/strong><\/pre>\n<h6>14. How to enable Anonymous downloads, but disable permission to write?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0In the above said scenario, we need to edit the parameter \u2018anon_world_readable_only\u2019. The parameter should be enabled and set to \u2018YES\u2019. The default value is YES.<\/div>\n<pre># Add this line to enable read only permission to anonymous users.\r\n<strong>allow_anon_ssl=YES<\/strong><\/pre>\n<h6>15. How to CHMOD all Anonymous uploads automatically. How would you do?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To chmod all anonymous uploads automatically, we need to edit the parameter \u2018chmod_enable\u2019 and set it to \u2018YES\u2019. Anonymous users never get to use SITE CHMOD. The default value is YES.<\/div>\n<pre># Add this line to chmod all anonymous uploads automatically.\r\n<strong>chmod_enable=YES<\/strong><\/pre>\n<h6>16. How to disable directory listing in a FTP server?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The parameter \u2018dirlist_enable\u2019 comes to rescue at this point. The value of \u2018dirlist_enable\u2019 should be set to NO. The default value is YES.<\/div>\n<pre># Add this line to disable directory listing.\r\n<strong>dirlist_enable=NO<\/strong><\/pre>\n<h6>17. How to maintain sessions for logins of VSFTP. How will you do?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The parameter \u2018session_support\u2019 needs to be modified. This parameter controls and manages vsftp attempts to maintain session for logins. The default value is NO.<\/div>\n<pre># Add this line to maintain session logins.\r\n<strong>session_support=YES<\/strong><\/pre>\n<h6>18. How to display time in local time zone, when listing the contents of directory?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The parameter \u2018usr_localtime\u2019 needs to be modified. If enabled, vsftpd will list directory files in local time zone format. The default is to display GMT. The default value is NO.<\/div>\n<pre># Add this line to display directory listing in local time zone.\r\n<strong>usr_localtime=YES<\/strong><\/pre>\n<h6>19. How will you limit the maximum transfer rate from VSFTP server?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To limit the maximum transfer rate of VSFTP server we need the parameter \u2018anon_max_rate\u2019 in bytes per second, for anonymous client. The default value is 0 which means unlimited.<\/div>\n<pre># Add this line to limit the ftp transfer rate.\r\n<strong>anon_max_rate=0 # 0 means unlimited<\/strong><\/pre>\n<h6>20. How will you timeout the idle session of VSFTP?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The parameter \u2018idle_session_timeout\u2019 needs to be modified here. The timeout in second, which is the maximum time an anonymous user can spend in a session between his client machine and VSFTP server. As soon as the the timeout triggers, the client is logged out. The default time is 300.<\/div>\n<pre># Add this line to set the ftp timeout session.\r\n<strong>idle_session_timeout=300<\/strong><\/pre>\n<p>That\u2019s all for now. We will be coming up with next article very soon, till then stay tuned and connected and don\u2019t forget to provide us with your valuable feedback in our comment section.<\/p>\n<h1 class=\"post-title\">10 Useful Random Linux Interview Questions and Answers<\/h1>\n<p>To a little surprise this time we are not presenting Interview question on any specific subject but on random topics. These question will surely help you in cracking Interviews beside adding to your Knowledge.<\/p>\n<div id=\"attachment_5638\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/Random-Interview-Questions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5638\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/Random-Interview-Questions.png\" alt=\"Linux Interview Questions\" width=\"425\" height=\"276\" aria-describedby=\"caption-attachment-5638\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5638\" class=\"wp-caption-text\">10 Random Linux Questions and Answers<\/p>\n<\/div>\n<h6>1. Let\u2019s say you maintains a backup on regular basis for the company you are working. The backups are maintained in Compressed file format. You need to examine a log, two months old. What would you suggest without decompressing the compressed file?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To check the contents of a compressed file without the need of decompressing it, we need to use \u2018zcat\u2019. The zcat utility makes it possible to view the contents of a compressed file.<\/div>\n<pre># zcat \u00adf phpshell\u00ad2.4.tar.gz<\/pre>\n<h6>2. You need to track events on your system. What will you do?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0For tracking the events on the system, we need a daemon called syslogd. The syslogd daemon is useful in tracking the information of system and then saving it to specified log files.<\/div>\n<p>Running \u2018<strong>syslogd<\/strong>\u2018 application in terminal generates log file at the location \u2018<strong>\/var\/log\/syslog<\/strong>\u2018. The syslogd application is very useful in troubleshooting Linux sytems. A sample log file looks similar to below.<\/p>\n<div id=\"attachment_5637\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/syslongd.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-5637\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/syslongd-620x350.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/syslongd-620x350.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/syslongd-1024x578.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/syslongd.jpg 1360w\" alt=\"syslongd command\" width=\"620\" height=\"350\" aria-describedby=\"caption-attachment-5637\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5637\" class=\"wp-caption-text\">syslongd<\/p>\n<\/div>\n<h6>3. How will you restrict IP so that the restricted IP\u2019s may not use the FTP Server?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0We can block suspicious IP by integrating tcp_wrapper. We need to enable the parameter \u201ctcp_wrapper=YES\u201d in the configuration file at \u2018\/etc\/vsftpd.conf\u2019. And then add the suspicious IP in the \u2018host.deny\u2019 file at location \u2018\/etc\/host.deny\u2019.<\/div>\n<h5>Block IP Address<\/h5>\n<p>Open \u2018\/etc\/hosts.deny\u2019 file.<\/p>\n<pre># vi \/etc\/hosts.deny<\/pre>\n<p>Add the IP address that you want to block at the bottom of the file.<\/p>\n<pre>#\r\n# hosts.deny    This file contains access rules which are used to\r\n#               deny connections to network services that either use\r\n#               the tcp_wrappers library or that have been\r\n#               started through a tcp_wrappers-enabled xinetd.\r\n#\r\n#               The rules in this file can also be set up in\r\n#               \/etc\/hosts.allow with a 'deny' option instead.\r\n#\r\n#               See 'man 5 hosts_options' and 'man 5 hosts_access'\r\n#               for information on rule syntax.\r\n#               See 'man tcpd' for information on tcp_wrappers\r\n#\r\nvsftpd:172.16.16.1<\/pre>\n<h6>4. Tell us the difference between Telnet and SSH?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Telnet and SSH both are communication protocol which are used to manage remote system. SSH is Secured, which requires exchanging of key opposite of telnet which transmit data in plain text, which means telnet is less secure than SSH.<\/div>\n<h6>6. You need to stop your X server. When you tries to kill your X server, You got an error message that you cannot quit X server. What will you do?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0When killing a X server, it won\u2019t work normal way like doing \u2018\/etc\/init.d\/gdm stop\u2019. We need to execute a special key combination \u2018Ctrl+ Alt+ Back Space\u2019 which will force X server to restart.<\/div>\n<h6>6. What is the difference between command \u2018ping\u2019 and \u2018ping6\u2019?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Both the commands are same and used for the same purpose except that the fact that ping6 is used with ipv6 IP address.<\/div>\n<h6>7. You want to search for all the *.tar files in your Home directory and wants to delete all at once. How will you do it?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0We need to use find command with rm command to delete all \u201c.tar\u201d files.<\/div>\n<pre># find \/home\/ \u00adname '*.tar' | xargs rm \u00adrf<\/pre>\n<h6>8. What is the difference between locate and slocate command?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The slocate looks for the files that user have access whereas locate will search for the file with updated result.<\/div>\n<h6>9. You need to search for the string \u201cTecmint\u201d in all the \u201c.txt\u201d files in the current directory. How will you do it?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0We need to run the fine command to search for the text \u201cTecmint\u201d in the current directory, recursively.<\/div>\n<pre># find -\u00adname \u201c*.txt\u201d | xargs grep \u201cTecmint\u201d<\/pre>\n<h6>10. You want to send a message to all connected users as \u201cServer is going down for maintenance\u201d, what will you do?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0This can be achieved using the wall command. The wall command sends a message to all connected users on the sever.<\/div>\n<pre># echo please save your work, immediately. The server is going down for Maintenance at 12:30 Pm, sharply. | wall<\/pre>\n<div id=\"attachment_5635\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/wall.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-5635\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/wall-620x350.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/wall-620x350.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/wall-1024x578.jpg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/02\/wall.jpg 1360w\" alt=\"wall command\" width=\"620\" height=\"350\" aria-describedby=\"caption-attachment-5635\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5635\" class=\"wp-caption-text\">wall command<\/p>\n<\/div>\n<p>That\u2019s all for now. Don\u2019t Forget to give your valuable feedback in comment section below.<\/p>\n<h1 class=\"post-title\">10 Useful Interview Questions on Linux Services and Daemons<\/h1>\n<p><strong>Daemon<\/strong>\u00a0is a computer program that runs as a background process and generally do not remains under the direct control of user. The parent process of a daemon in most cases are\u00a0<strong>init<\/strong>, but not always.<\/p>\n<p>In Linux, a\u00a0<strong>Service<\/strong>\u00a0is an application that runs in a background carrying out essential task or waiting for its execution.<\/p>\n<div id=\"attachment_5782\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/03\/Questions-on-Linux-Services-and-Daemons.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5782\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/03\/Questions-on-Linux-Services-and-Daemons.png\" alt=\"Questions on Linux Services and Daemons\" width=\"442\" height=\"317\" aria-describedby=\"caption-attachment-5782\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5782\" class=\"wp-caption-text\">Questions on Linux Services and Daemons<\/p>\n<\/div>\n<p>Generally, there is no difference between a\u00a0<strong>Daemon<\/strong>\u00a0and a<strong>\u00a0Service<\/strong>. Daemon is Service but service may be bigger than Daemon. Daemon provide some services and services may contain more than one Daemon.<\/p>\n<p>Here in this series of<strong>\u00a0Interview Article<\/strong>, we would be covering\u00a0<strong>Services and Daemons in Linux<\/strong>.<\/p>\n<h6>1. What is Exim Service? What is the purpose of this Service?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Exim is an Open Source Mail Transfer Agent (MTA) which deals with routing, receiving and delivering of Electronic Mail. Exim service serves to be a great replacement of sendmail service which comes bundled with most of the distro.<\/div>\n<p>2. What is NIS server? What is the purpose of NIS Server?<\/p>\n<div><strong>Answer :<\/strong>\u00a0The NIS server, serves the purpose of dealing with Network Information Service which in-turn facilitates to login to other Systems with same log-in credentials. NIS is a directory service protocol which functions in Client-Server Model.<\/div>\n<h6>3. What will you prefer for a reverse proxy in Linux?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Reverse Proxy refers to the type of proxy that retrieves resources on account of client from server(s). The solution of \u2018Reverse Proxy\u2019 in Linux is squid as well as Apache reverse Proxy. However \u2018squid\u2019 is more preferred than \u2018Apache reverse Proxy\u2019 because of its simplicity and straight forward nature.<\/div>\n<h6>4. You are getting following codes (2xx, 3xx, 4xx, 5xx) in Apache, at some point of time. What does this means?<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0In Apache each error code points towards a specific area of problem.<\/p>\n<ol>\n<li>2xx : Request of connection Successful<\/li>\n<li>3xx: Redirection<\/li>\n<li>4xx: Client Error<\/li>\n<li>5xx: Server Error<\/li>\n<\/ol>\n<\/div>\n<h6>5. You are asked to stop Apache Service through its control Script. What will you do?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The Apache service is controlled using a script called apachectl. In order to stop apache using its control script we need to run.<\/div>\n<pre># apachectl stop\t\t[On Debian based Systems]\r\n# \/etc\/inid.t\/httpd stop\t[On Red Hat based Systems]<\/pre>\n<h6>6. How is \u2018apachectl restart\u2019 different from \u2018apachectl graceful\u2019<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The \u2018apachectl restart\u2019 when executed will force Apache to restart immediately, before the task complete whereas \u2018apachectl graceful\u2019 will wait for the current task to be finished before restarting the service. Not to mention \u2018apachectl graceful\u2019 is more safe to execute but the execution time for \u2018apachectl restart\u2019 is less as compared to \u2018apachectl graceful\u2019.<\/div>\n<h6>7. How will you configure the nfs mounts to export it, from your local machine?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The \/etc\/export allows the creation of nfs exports on local machine and make it available to the whole world.<\/div>\n<h6>8. You are supposed to create a new Apache VirtualHost configuration for the host www.Tecmint.com that is available at \/home\/Tecmint\/public_html\/ and maintains log at \/var\/log\/httpd\/ by default.<\/h6>\n<div><strong>Answer :<\/strong>\u00a0You need to create a Apache virtual host container in main apache configuration file located at \u2018\/etc\/httpd\/conf\/httpd.conf\u2019. The following is the virtual container for host www.tecmint.com.<\/div>\n<pre>&lt;VirtualHost *:80&gt;\r\nDocumentRoot \/home\/Tecmint\/public_html\r\nServerName www.Tecmint.com\r\nServer Alias Tecmint.com\r\nCustomLog \/var\/log\/httpd\/Tecmint.com.log combined\r\nErrorLog \/var\/log\/httpd\/Tecmint.com.error.log\r\n&lt;\/VirtualHost&gt;<\/pre>\n<h6>9. You are supposed to dump all the packets of http traffic in file http.out. What will you suggest?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0In order to dump all the network traffic, we need to use command \u2018tcpdump\u2019 with the following switches.<\/div>\n<pre># tcpdump tcp port 80 -s0 -w http.out<\/pre>\n<h6>10. How will you add a service (say httpd) to start at INIT Level 3?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0We need to use \u2018chkconfig\u2019 tool to hook up a service at INIT Level 3 by changing its runlevel parameter.<\/div>\n<pre>chkconfig \u2013level 3 httpd on<\/pre>\n<p>That\u2019s all for now. I\u2019ll be here again with another interesting article very soon.<\/p>\n<h1 class=\"post-title\">10 Useful SSH (Secure Shell) Interview Questions and Answers<\/h1>\n<p><strong>SSH<\/strong>\u00a0stands for\u00a0<strong>Secure Shell<\/strong>\u00a0is a network protocol, used to access remote machine in order to execute command-line network services and other commands over a Network. SSH is Known for its high security, cryptographic behavior and it is most widely used by Network Admins to control remote web servers primarily.<\/p>\n<div id=\"attachment_5823\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/03\/SSH-Interview-Questions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5823\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/03\/SSH-Interview-Questions.png\" alt=\"SSH Interview Questions\" width=\"442\" height=\"317\" aria-describedby=\"caption-attachment-5823\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5823\" class=\"wp-caption-text\">10 SSH Interview Questions<\/p>\n<\/div>\n<p>Here in this\u00a0<strong>Interview Questions<\/strong>\u00a0series article, we are presenting some useful\u00a0<strong>10 SSH (Secure Shell) Questions<\/strong>and their Answers.<\/p>\n<h6>1. SSH is configured on what Port Number, by default? How to change the port of SSH?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0SSH is configured on port 22, by default. We can change or set custom port number for SSH in configuration file.<\/div>\n<p>We can check port number of SSH by running the below one liner script, directly on terminal.<\/p>\n<pre># grep Port \/etc\/ssh\/sshd_config\t\t[On <strong>Red Hat<\/strong> based systems]\r\n\r\n# grep Port \/etc\/ssh\/ssh_config\t\t        [On <strong>Debian<\/strong> based systems]<\/pre>\n<p>To change the port of SSH, we need to modify the configuration file of SSH which is located at \u2018<strong>\/etc\/ssh\/sshd_config<\/strong>\u2018 or \u2018<strong>\/etc\/ssh\/ssh_config<\/strong>\u2018.<\/p>\n<pre># nano \/etc\/ssh\/sshd_config\t[On <strong>Red Hat<\/strong> based systems]\r\n\r\n# nano \/etc\/ssh\/ssh_config\t\t[On <strong>Debian<\/strong> based systems]<\/pre>\n<p>Searh for the Line.<\/p>\n<pre>Port 22<\/pre>\n<p>And replace \u2018<strong>22<\/strong>\u2018 with any UN-engaged port Number say \u2018<strong>1080<\/strong>\u2018. Save the file and restart the SSH service to take the changes into effect.<\/p>\n<pre># service sshd restart\t\t\t\t\t[On <strong>Red Hat<\/strong> based systems]\r\n\r\n# service ssh restart\t\t\t\t\t[On <strong>Debian<\/strong> based systems]<\/pre>\n<h6>2. As a security implementation, you need to disable root Login on SSH Server, in Linux. What would you suggest?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The above action can be implemented in the configuration file. We need to change the parameter \u2018PermitRootLogin\u2019 to \u2018no\u2019 in the configuration file to disable direct root login.<\/div>\n<p>To disable SSH root login, open the configuration file located at \u2018<strong>\/etc\/ssh\/sshd_config<\/strong>\u2018 or \u2018<strong>\/etc\/ssh\/ssh_config<\/strong>\u2018.<\/p>\n<pre># nano \/etc\/ssh\/sshd_config\t\t\t[On <strong>Red Hat<\/strong> based systems]\r\n\r\n# nano Port \/etc\/ssh\/ssh_config\t\t\t[On <strong>Debian<\/strong> based systems]<\/pre>\n<p>Change the parameter \u2018<strong>PermitRootLogin<\/strong>\u2018 to \u2018<strong>no<\/strong>\u2018 and restart the SSH service as show above.<\/p>\n<h6>3. SSH or Telnet? Why?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Both SSH and Telnet are network Protocol. Both the services are used in order to connect and communicate to another machine over Network. SSH uses Port 22 and Telnet uses port 23 by default. Telnet send data in plain text and non-encrypted format everyone can understand whereas SSH sends data in encrypted format. Not to mention SSH is more secure than Telnet and hence SSH is preferred over Telnet.<\/div>\n<h6>4. Is it possible to login to SSH server without password? How<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes! It is possible to login to a remote SSH server without entering password. We need to use ssh-keygen technology to create public and private keys.<\/div>\n<p>Create\u00a0<strong>ssh-keygen<\/strong>\u00a0using the command below.<\/p>\n<pre>$ ssh-keygen<\/pre>\n<p>Copy public keys to remote host using the command below.<\/p>\n<pre>$ ssh-copy-id -i \/home\/USER\/.ssh\/id_rsa.pub REMOTE-SERVER<\/pre>\n<p><strong>Note<\/strong>: Replace\u00a0<strong>USER<\/strong>\u00a0with user name and\u00a0<strong>REMOTE-SERVER<\/strong>\u00a0by remote server address.<\/p>\n<p>The next time we try to login to SSH server, it will allow login without asking password, using the keygen. For more detailed instructions, read\u00a0<a href=\"https:\/\/www.tecmint.com\/ssh-passwordless-login-using-ssh-keygen-in-5-easy-steps\/\" target=\"_blank\" rel=\"noopener\">how to login remote SSH server without password<\/a>.<\/p>\n<h6>5. How will you allows users and groups to have access to SSH Sever?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes! It is possible to allow users and groups to have access to SSH server.<\/div>\n<p>Here again we need to edit the configuration file of SSH service. Open the configuration file and add users and groups at the bottom as show below and then, restart the service.<\/p>\n<pre>AllowUsers Tecmint Tecmint1 Tecmint2\r\nAllowGroups group_1 group_2 group_3<\/pre>\n<h6>6. How to add welcome\/warning message as soon as a user login to SSH Server?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0In order to add a welcome\/warning message as soon as a user logged into SSH server, we need to edit file called \u2018\/etc\/issue\u2019 and add message there.<\/div>\n<pre># nano \/etc\/issue<\/pre>\n<p>And add your custom message in this file. See, below a screen grab that shows a custom message as soon as user logged into server.<\/p>\n<div id=\"attachment_5822\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/03\/SSH-Login-Banner.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-5822\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/03\/SSH-Login-Banner-620x350.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/03\/SSH-Login-Banner-620x350.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/03\/SSH-Login-Banner-1024x578.jpeg 1024w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/03\/SSH-Login-Banner.jpeg 1360w\" alt=\"SSH Login Banner\" width=\"620\" height=\"350\" aria-describedby=\"caption-attachment-5822\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5822\" class=\"wp-caption-text\">SSH Login Message<\/p>\n<\/div>\n<h6>7. SSH has two protocols? Justify this statement.<\/h6>\n<div><strong>Answer :<\/strong>\u00a0SSH uses two protocols \u2013 Protocol 1 and Protocol 2. Protocol 1 is older than protocol 2. Protocol 1 is less secure than protocol 2 and should be disabled in the config file.<\/div>\n<p>Again, we need to open the SSH configuration file and add\/edit the lines as shown below.<\/p>\n<pre># protocol 2,1\r\n\r\nto\r\n\r\nProtocol 2<\/pre>\n<p>Save the configuration file and restart the service.<\/p>\n<h6>8. Is it possible to trace unauthorized login attempts to SSH Server with date of Intrusion along with their corresponding IP.<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes! we can find the failed login attempts in the log file created at location \u2018\/var\/log\/secure\u2019. We can make a filter using the grep command as shown below.<\/div>\n<pre># cat \/var\/log\/secure | grep \u201cFailed password for\u201d<\/pre>\n<p><strong>Note<\/strong>: The grep command can be tweaked in any other way to produce the same result.<\/p>\n<h6>9. Is it possible to copy files over SSH? How?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes! We can copy files over SSH using command SCP, stands for \u2018Secure CopY\u2019. SCP copies file using SSH and is very secure in functioning.<\/div>\n<p>A dummy SCP command in action is depicted below:<\/p>\n<pre>$ scp text_file_to_be_copied Your_username@Remote_Host_server:\/Path\/To\/Remote\/Directory<\/pre>\n<p>For more practical examples on how to copy files\/folders using scp command, read the\u00a0<a href=\"https:\/\/www.tecmint.com\/scp-commands-examples\/\" target=\"_blank\" rel=\"noopener\">10 SCP Commands to Copy Files\/Folders in Linux<\/a>.<\/p>\n<h6>10. Is it possible to pass input to SSH from a local file? If Yes! How?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes! We can pass input to SSH from a local file. We can do this simply as we do in scripting Language. Here is a simple one liner command, which will pass input from local files to SSH.<\/div>\n<pre># ssh username@servername &lt; local_file.txt<\/pre>\n<p>SSH is a very hot topic from interview point, of all times. The above questions would have surely added to your knowledge.<\/p>\n<p>That\u2019s all for now. I\u2019ll soon be here with another interesting article.<\/p>\n<h1 class=\"post-title\">10 Interview Questions and Answers on Various Commands in Linux<\/h1>\n<p>Our last article, \u201c<a href=\"https:\/\/www.tecmint.com\/ssh-interview-questions\/\" target=\"_blank\" rel=\"noopener\">10 Useful SSH Interview Questions<\/a>\u201d was highly appreciated on various\u00a0<strong>Social Networkin<\/strong>g sites as well as on\u00a0<strong>Tecmint<\/strong>. This time we are presenting you with \u201c<strong>10 Questions on various Linux commands<\/strong>\u201c. These questions will prove to be brainstorming to you and will add to your knowledge which surely will help you in day-to-day interaction with\u00a0<strong>Linux<\/strong>\u00a0and in\u00a0<strong>Interviews<\/strong>.<\/p>\n<div id=\"attachment_5882\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/03\/Questions-on-Various-Commands.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-5882\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/03\/Questions-on-Various-Commands.png\" alt=\"Linux Questions on Commands\" width=\"442\" height=\"317\" aria-describedby=\"caption-attachment-5882\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-5882\" class=\"wp-caption-text\">Questions on Various Commands<\/p>\n<\/div>\n<h6><strong>Q1.<\/strong>\u00a0You have a file (say virgin.txt). You want this file to be alter-proof so that no one can edit or delete this file, not even root. What will you do?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0In order to make this file immune to editing and deleting we need to use command \u201cchattr\u201d. Chattr changes the attributes of a file on Linux System.<\/div>\n<p>The Syntax of command chattr, for the above purpose is:<\/p>\n<pre># chattr +i virgin.txt<\/pre>\n<p>Now try to remove the file using normal user.<\/p>\n<pre>$ rm -r virgin.txt \r\n\r\nrm: remove write-protected regular empty file `virgin.txt'? Y \r\nrm: cannot remove `virgin.txt': Operation not permitted<\/pre>\n<p>Now try to remove the file using root user.<\/p>\n<pre># rm -r virgin.txt \r\n\r\ncannot remove `virgin.txt': Operation not permitted<\/pre>\n<h6><strong>Q2.<\/strong>\u00a0If several users are using your Linux Server, how will you find the usage time of all the users, individually on your server?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0To fulfill the above task, we need to execute command \u2018ac\u2019. The Linux command \u2018ac\u2019 may not be installed, in your Linux box, by default. On a Debian based System you need a package \u2018acct\u2019 installed to run ac.<\/div>\n<pre># apt-get install acct\r\n<\/pre>\n<pre># ac -p \r\n\r\n(unknown)                     14.18 \r\nserver                             235.23 \r\ntotal      249.42<\/pre>\n<h6><strong>Q3.<\/strong>\u00a0Which is preferred tool to create Network Statistics for your server?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0A mrtg stands for Multi Router Traffic Grapher is one of the most commonly used tool to monitor network Statistics. mrtg is most widely recommended FOSS tool, which is very powerful. mrtg may not be installed on your Linux Box, by default and you need to install it manually from repo.<\/div>\n<pre># apt-get install mrtg<\/pre>\n<h6><strong>Q4.<\/strong>\u00a0It is possible to send query to BIOS from Linux Command Line?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes! it is possible to send query and signals to BIOS, directly from the command line. For this you need a tool called \u201cbiosdecode\u201d. On my Debian wheezy (7.4), it is already installed.<\/div>\n<pre># biosdecode \r\n\r\n# biosdecode 2.11 \r\n\r\nACPI 2.0 present. \r\n\tOEM Identifier: LENOVO \r\n\tRSD Table 32-bit Address: 0xDDFCA028 \r\n\tXSD Table 64-bit Address: 0x00000000DDFCA078 \r\nSMBIOS 2.7 present. \r\n\tStructure Table Length: 3446 bytes \r\n\tStructure Table Address: 0x000ED9D0 \r\n\tNumber Of Structures: 89 \r\n\tMaximum Structure Size: 184 bytes \r\nPNP BIOS 1.0 present. \r\n\tEvent Notification: Not Supported \r\n\tReal Mode 16-bit Code Address: F000:BD76 \r\n\tReal Mode 16-bit Data Address: F000:0000 \r\n\t16-bit Protected Mode Code Address: 0x000FBD9E \r\n\t16-bit Protected Mode Data Address: 0x000F0000 \r\nPCI Interrupt Routing 1.0 present. \r\n\tRouter ID: 00:1f.0 \r\n\tExclusive IRQs: None \r\n\tCompatible Router: 8086:27b8 \r\n\tSlot Entry 1: ID 00:1f, on-board \r\n\t...\r\n\tSlot Entry 15: ID 02:0c, slot number 2<\/pre>\n<h6><strong>Q5.<\/strong>\u00a0Most of the Linux Server are headless, i.e., they run in command mode only. No GUI is installed. How will you find hardware description and configuration of your box?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0It is easy to find Hardware description and configuration of a headless Linux Server using command \u201cdmidecode\u201d, which is the DMI table decoder.<\/div>\n<pre># dmidecode<\/pre>\n<p>The output of dmidecode is extensive. It will be a nice idea to redirect its output to a file.<\/p>\n<pre># dmidecode &gt; \/path\/to\/text\/file\/text_file.txt<\/pre>\n<h6><strong>Q6.<\/strong>\u00a0You need to know all the libraries being used and needed by a binary, say \u2018\/bin\/echo\u2019. How will you achieve desirable output?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The command \u2018ldd\u2019, which print shared library dependencies of a binary in Linux.<\/div>\n<pre>$ ldd \/bin\/echo \r\n\r\nlinux-gate.so.1 =&gt;  (0xb76f1000) \r\nlibc.so.6 =&gt; \/lib\/i386-linux-gnu\/i686\/cmov\/libc.so.6 (0xb7575000) \r\n\/lib\/ld-linux.so.2 (0xb76f2000)<\/pre>\n<h6><strong>Q7.<\/strong>\u00a0You are working for the country\u2019s army. You have a file (say \u201ctopsecret.txt\u201d) which contains confidential and country\u2019s security Information, Nuclear missiles, etc. What will be your preferred method to delete this file?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The file, being so confidential needs special deletion technique which can not be recovered by any means. For this, to implement practically we need to utilize an application \u201cshred\u201d. Shred tool overwrites a file repeatedly several times, thus making file recovery for any illegal activity almost nil and practically impossible.<\/div>\n<pre># shred -n 15 -z topsecret.txt<\/pre>\n<p>shread \u2013 overwrite a file to hide its contents, and optionally delete it.<\/p>\n<ol>\n<li><strong>-n<\/strong>\u00a0\u2013 Overwrites the files n times<\/li>\n<li><strong>-z<\/strong>\u00a0\u2013 Add a final overwrite with zeros to hide shredding.<\/li>\n<\/ol>\n<p><strong>Note<\/strong>: The above command overwrites the file 15 times before overwriting with zero, to hide shredding.<\/p>\n<h6><strong>Q8.<\/strong>\u00a0Is it possible to mount an NTFS partition on Linux?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes! We can mount an NTFS partition\/disk on Linux system using application \u2018mount.ntfs\u2019 which optionally is called as \u2018ntfs-3g\u2019 in order to mount ntfs partition on Linux System.<\/div>\n<p>For more information, read article on\u00a0<a href=\"https:\/\/www.tecmint.com\/how-do-i-access-or-mount-windows-ntfs-partition-in-linux\/\" target=\"_blank\" rel=\"noopener\">how to monitor an NTFS Partition on Linux<\/a>.<\/p>\n<h6><strong>Q9.<\/strong>\u00a0What and where you need to edit so that the default desktop at login will be KDE, which at present is GNOME.<\/h6>\n<div><strong>Answer :<\/strong>\u00a0We need to edit a file \u2018\/etc\/sysconfig\/desktop\u2019 and add\/edit the below lines to load KDE by default and not GNOME.<\/div>\n<pre>DESKTOP=\u201dKDE\u201d\r\nDISPLAYMANAGER=\u201dKDE\u201d<\/pre>\n<p>Save the file with above content. Next time when machine boots, it automatically will load KDE as default display manager.<\/p>\n<h6><strong>Q10.<\/strong>\u00a0What does an intrid image file refers to?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0An intrid is Initial Ram Disk Image that loads into Memory after Power On Self Test (POST) in order to improve machine I\/O performance. intrid contains temporary root file system.<\/div>\n<p>That\u2019s all for now. I\u2019ll be here again with another interesting topic, worth knowing.<\/p>\n<h1 class=\"post-title\">10 Useful \u2018Interview Questions and Answers\u2019 on Linux Shell Scripting<\/h1>\n<p>Greeting of the day. The vastness of Linux makes it possible to come up with a unique post every time.\u00a0<a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Questions-on-Shell-Scripting.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7070\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/05\/Questions-on-Shell-Scripting.png\" alt=\"Questions on Shell Scripting\" width=\"442\" height=\"317\" aria-describedby=\"caption-attachment-7070\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<div id=\"attachment_7070\" class=\"wp-caption aligncenter\">\n<p id=\"caption-attachment-7070\" class=\"wp-caption-text\">Questions on Shell Scripting<\/p>\n<\/div>\n<p>We have lots of tutorials on\u00a0<strong>Shell Scripting<\/strong>\u00a0language and\u00a0<strong>Interview Questions<\/strong>\u00a0for readers of all kind, here are the links to those articles.<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/category\/bash-shell\/\" target=\"_blank\" rel=\"noopener\">Shell Scripting Series<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/category\/interview-questions\/\" target=\"_blank\" rel=\"noopener\">Interview Question and Answer Series<\/a><\/li>\n<\/ol>\n<p>Adding to the shell scripting posts here, in this article we will be going through questions related to Linux Shell from interview point of view.<\/p>\n<h6>1. How will you abort a shell script before it is successfully executed?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0We need to use \u2018exit\u2019 command to fulfil the above described situation. A \u2018exit\u2019 command when forced to output any value other than 0 (zero), the script will throw an error and will abort. The value 0 (zero) under Unix environment shell scripting represents successful execution. Hence putting \u2018exit -1\u2019, without quotes before script termination will abort the script.<\/div>\n<p>For example, create a following shell script as \u2018<strong>anything.sh<\/strong>\u2018.<\/p>\n<pre>#!\/bin\/bash\r\necho \"Hello\"\r\nexit -1\r\necho \"bye\"<\/pre>\n<p>Save the file and execute it.<\/p>\n<pre># sh anything.sh\r\n\r\nHello\r\nexit.sh: 3: exit: Illegal number: -1<\/pre>\n<p>From the above script, it is clear that the execution went well before exit\u00a0<strong>-1<\/strong>\u00a0command.<\/p>\n<h6>2. How to remove the headers from a file using command in Linux?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0A \u2018sed\u2019 command comes to rescue here, when we need to delete certain lines of a file.<\/div>\n<p>Here it the exact command to remove headers from a file (or first line of a file).<\/p>\n<pre># sed '1 d' file.txt<\/pre>\n<p>The only problem with above command is that, it outputs the file on standard output without the first line. In order to save the output to file, we need to use redirect operator which will redirects the output to a file.<\/p>\n<pre># sed '1 d' file.txt &gt; new_file.txt<\/pre>\n<p>Well the built in switch \u2018<strong>-i<\/strong>\u2018 for\u00a0<strong>sed<\/strong>\u00a0command, can perform this operation without a redirect operator.<\/p>\n<pre># sed -i '1 d' file.txt<\/pre>\n<h6>3. How will you check the length of a line from a text file?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Again \u2018sed\u2019 command is used to find or check the length of a line from a text file.<\/div>\n<p>A \u2018<strong>sed \u2013n \u2018n p\u2019 file.txt<\/strong>\u2018, where \u2018<strong>n<\/strong>\u2018 represents the line number and \u2018<strong>p<\/strong>\u2018 print out the pattern space (to the standard output). This command is usually only used in conjunction with the\u00a0<strong>-n<\/strong>\u00a0command-line option. So, how to get the length count? Obviously! we need to pipeline the output with \u2018<strong>wc<\/strong>\u2018 command.<\/p>\n<pre># sed \u2013n 'n p' file.txt | wc \u2013c<\/pre>\n<p>To get the length of line number \u20185\u2019 in the text file \u2018<strong>tecmint.txt<\/strong>\u2018, we need to run.<\/p>\n<pre># sed -n '5 p' tecmint.txt | wc -c<\/pre>\n<h6>4. Is it possible to view all the non-printable characters from a text file on Linux System? How will you achieve this?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes! it is very much possible to view all the non-printable characters in Linux. In order to achieve the above said scenario, we need to take the help of editor \u2018vi\u2019.<\/div>\n<p>How to show non-printable characters in \u2018<strong>vi<\/strong>\u2018 editor?<\/p>\n<ol>\n<li>Open vi editor.<\/li>\n<li>Go to command mode of vi editor by pressing [esc] followed by \u2018:\u2019.<\/li>\n<li>The final step is to type execute [set list] command, from command interface of \u2018vi\u2019 editor.<\/li>\n<\/ol>\n<p><strong>Note<\/strong>: This way we can see all the non-printable characters from a text file including\u00a0<strong>ctrl+m<\/strong>\u00a0(<strong>^M<\/strong>).<\/p>\n<h6>5. You are a Team-Leader of a group of staffs working for a company xyz. The company ask you to create a directory \u2018dir_xyz\u2019, such that any member of the group can create a file or access a file under it, but no one can delete the file, except the one created it. what will you do?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0An interesting scenario to work upon. Well in the above said scenario we need to implement the below steps which is as easy as cake walk.<\/div>\n<pre># mkdir dir_xyz\r\n# chmod g+wx dir_xyz\r\n# chmod +t dir_xyz<\/pre>\n<p>The first line of command create a directory (<strong>dir_xyz<\/strong>). The second line of command above allow group (<strong>g<\/strong>) to have permission to \u2018<strong>write<\/strong>\u2018 and \u2018<strong>execute<\/strong>\u2018 and the last line of the above command \u2013 The \u2018<strong>+t<\/strong>\u2018 in the end of the permissions is called the \u2018<strong>sticky bit<\/strong>\u2018. It replaces the \u2018<strong>x<\/strong>\u2018 and indicates that in this directory, files can only be deleted by their owners, the owner of the directory or the root superuser.<\/p>\n<h6>6. Can you tell me the various stages of a Linux process, it passes through?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0A Linux process normally goes through four major stages in its processing life.<\/div>\n<p>Here are the 4 stages of Linux process.<\/p>\n<ol>\n<li>Waiting: Linux Process waiting for a resource.<\/li>\n<li>Running : A Linux process is currently being executed.<\/li>\n<li>Stopped : A Linux Process is stopped after successful execution or after receiving kill signal.<\/li>\n<li>Zombie : A Process is said to be \u2018Zombie\u2019 if it has stopped but still active in process table.<\/li>\n<\/ol>\n<h6>7. What is the use of cut command in Linux?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0A \u2018cut\u2019 is a very useful Linux command which proves to be helpful when we need to cut certain specific part of a file and print it on standard output, for better manipulation when the field of the file and file itself is too heavy.<\/div>\n<p>For example, extract first 10 columns of a text file \u2018<strong>txt_tecmint<\/strong>\u2018.<\/p>\n<pre># cut -c1-10 txt_tecmint<\/pre>\n<p>To extract 2nd, 5th and 7th column of the same text file.<\/p>\n<pre># cut -d;-f2 -f5 -f7 txt_tecmint<\/pre>\n<h6>8. What is the difference between commands \u2018cmp\u2019 and \u2018diff\u2019?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The command \u2018cmp\u2019 and \u2018diff\u2019 means to obtain the same thing but with different mindset.<\/div>\n<p>The \u2018<strong>diff<\/strong>\u2018 command reports the changes one should make so that both the files look the same. Whereas \u2018<strong>cmp<\/strong>\u2018 command compares the two files byte-by-byte and reports the first mismatch.<\/p>\n<h6>9. Is it possible to substitute \u2018ls\u2019 command with \u2018echo\u2019 command?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Yes! the \u2018ls\u2019 command can be substituted by \u2018echo\u2019 command. The command \u2018ls\u2019 lists the content of file. From the point of view of replacement of above command we can use \u2018echo *\u2019, obviously without quotes. The output of both the commands are same.<\/div>\n<h6>10. You might have heard about inodes. can you describe inode briefly?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0A \u2018inode\u2019 is a \u2018data-structure\u2019, which is used for file identification on Linux. Each file on an Unix System has a separate \u2018inode\u2019 and an \u2018Unique\u2019 inode Number.<\/div>\n<p>That\u2019s all for now. We will be coming up with another interesting and knowledgeable Interview questions, in the next article.<\/p>\n<h1 class=\"post-title\">Practical Interview Questions and Answers on Linux Shell Scripting<\/h1>\n<article class=\"post-7329 post type-post status-publish format-standard has-post-thumbnail hentry category-interview-questions tag-linux-interview tag-shell-scripting\">\n<div class=\"post-inner group\">\n<div class=\"entry share\">\n<div class=\"entry-inner\">\n<p>With the overwhelming response we are getting on the Interview Series articles, the first of its kind on any Linux How-to website in the form of Likes, Feedbacks in comment as well as on personal Email Address make us going from one article to the next article.<\/p>\n<p>Here is the link to the\u00a0<a href=\"https:\/\/www.tecmint.com\/category\/interview-questions\/\" target=\"_blank\" rel=\"noopener\">Interview Series<\/a>\u00a0articles already published on Tecmint.com, where we have covered lots of topics viz., FTP, MySQL, Apache, Scripting, Linux Commands, etc.<\/p>\n<div id=\"attachment_7332\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/06\/Interview-Questions-on-Shell-Scripting.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7332\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/06\/Interview-Questions-on-Shell-Scripting.png\" alt=\"Practical Interview Question on Shell Scripting\" width=\"442\" height=\"317\" aria-describedby=\"caption-attachment-7332\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-7332\" class=\"wp-caption-text\">Practical Interview Question on Shell Scripting<\/p>\n<\/div>\n<p>Continuing to the above series here we are coming with another 5 wonderful Linux Interview Questions and their answer. Your (The Tecmint.com Readers and frequent Visitors) support is always needed to make it successful.<\/p>\n<h6>1. Write a shell script to get current date, time, user name and current working directory.<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The commands logname, date, who I am and pwd will output username, current date and time, and current working directory. Just implementing these commands in the script and making it a bit interactive.<\/div>\n<p>Now create a file called \u2018<strong>userstats.sh<\/strong>\u2018 and add the following code to it.<\/p>\n<pre>#!\/bin\/bash \r\necho \"Hello, $LOGNAME\" \r\necho \"Current date is `date`\" \r\necho \"User is `who i am`\" \r\necho \"Current directory `pwd`\"<\/pre>\n<p>Place execute permission and run the script as shown below.<\/p>\n<pre># chmod 755 userstats.sh \r\n# .\/userstats.sh<\/pre>\n<h5>Sample Output<\/h5>\n<pre>Hello, avi \r\nCurrent date is Sat Jun  7 13:05:29 IST 2014 \r\nUser is avi      pts\/0        2014-06-07 11:59 (:0) \r\nCurrent directory \/home\/avi\/Desktop<\/pre>\n<h6>2. Write a Shell Script that adds two numbers if provided as the command Line Argument and if the two numbers are not entered it outputs an Error Message along with a one-Line of how-to use description.<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Here is the simple Shell Script along with description which adds two number if provided as Command-Line argument, if not it throws error with single line on how to use the script.<\/div>\n<p>Again create a file called \u2018<strong>two-numbers.sh<\/strong>\u2018 and add the following content to it.<\/p>\n<pre>#!\/bin\/bash \r\n# The Shebang\r\n\r\nif [ $# -ne 2 ] \r\n# If two Inputs are not received from Standard Input\r\n\r\nthen \r\n# then execute the below statements\r\n\r\n    echo \"Usage - $0   x    y\" \r\n    # print on standard output, how-to use the script (Usage - .\/1.sh   x    y )\r\n\r\n    echo \"        Where x and y are two nos for which I will print sum\" \r\n    # print on standard output, \u201cWhere x and y are two nos for which I will print sum \u201d\r\n\r\n    exit 1 \r\n    # Leave shell in Error Stage and before the task was successfully carried out.\r\n\r\nfi \r\n# End of the if Statement.\r\n\r\n    echo \"Sum of $1 and $2 is `expr $1 + $2`\"\r\n    # If the above condition was false and user Entered two numbers as a command Line Argument,   \r\n       it will show the sum of the entered numbers.<\/pre>\n<p>Set executer permission on the file and run the script as shown below.<\/p>\n<pre># chmod 755 two-numbers.sh<\/pre>\n<p><strong>Condition 1<\/strong>: Running the script without entering two numbers as command line argument, you will get the following output.<\/p>\n<h5>Sample Output<\/h5>\n<pre># .\/two-numbers.sh\r\n\r\nUsage - .\/two-numbers.sh   x    y \r\n        Where x and y are two nos for which I will print sum<\/pre>\n<p><strong>Condition 2<\/strong>: When Numbers are entered as command line argument you will get the result as shown.<\/p>\n<pre>$ .\/two-numbers.sh 4 5 \r\n\r\nSum of 4 and 5 is 9<\/pre>\n<p>Hence the above shell script fulfills the condition as suggested in the question.<\/p>\n<h6>3. You needs to print a given Number say 10572, in reverse order using a Shell script such that the input is provided using command Line Argument only. If the input data is not provided as Command Line Argument, it should throw and error and should suggest, how to use the script. Write the script but before that tell me the algorithm that needs to be implemented here.<\/h6>\n<h4>Algorithm<\/h4>\n<ol>\n<li>1. Let the Input Number = n<\/li>\n<li>2. Set rev=0, sd=0 (Reverse and single digitis set to 0)<\/li>\n<li>3. n % 10, will find and give single left most digit<\/li>\n<li>4. reverse number is generated as rev * 10 + sd<\/li>\n<li>5. Decrease Input Number (n) by 1.<\/li>\n<li>6. if n &gt; 0, then goto step 3 else goto setp 7<\/li>\n<li>7. Print rev<\/li>\n<\/ol>\n<p>Now again, create a file called \u2018<strong>numbers.sh<\/strong>\u2018 and add the following given code it.<\/p>\n<pre>#!\/bin\/bash \r\nif [ $# -ne 1 ] \r\nthen \r\n    echo \"Usage: $0   number\" \r\n    echo \"       I will find reverse of given number\" \r\n    echo \"       For eg. $0 0123, I will print 3210\" \r\n    exit 1 \r\nfi \r\n\r\nn=$1 \r\nrev=0 \r\nsd=0 \r\n\r\nwhile [ $n -gt 0 ] \r\ndo \r\n    sd=`expr $n % 10` \r\n    rev=`expr $rev \\* 10  + $sd` \r\n    n=`expr $n \/ 10` \r\ndone \r\n    echo  \"Reverse number is $rev\"<\/pre>\n<p>Grant a execute permission on the file and run the script as shown below.<\/p>\n<pre># chmod 755 numbers.h<\/pre>\n<p><strong>Condition 1<\/strong>: When Input is not provided as command line argument, you will get the following output.<\/p>\n<h5>Sample Output<\/h5>\n<pre>.\/numbers.sh\r\n\r\nUsage: .\/numbers.sh  number \r\n       I will find reverse of given number \r\n       For eg. .\/2.sh 123, I will print 321<\/pre>\n<p><strong>Condition 2<\/strong>: When Input was provided as command line Argument.<\/p>\n<pre>$ .\/numbers.sh 10572 \r\n\r\nReverse number is 27501<\/pre>\n<p>The above script worked perfectly and the output was just what we needed.<\/p>\n<h6>4. You are supposed to calculate a real number calculation directly from terminal and not any shell script. What will you do (say the real numbers are 7.56 and 2.453)?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0We need to use bc command in a special way as described below. The output of echo 7.56 + 2.453 should be pipelined to bc.<\/div>\n<p>For example, run the following command to calculate numbers in real time using\u00a0<strong>bc<\/strong>\u00a0command as shown.<\/p>\n<pre>$ echo 7.56 + 2.453 | bc\r\n\r\n10.013<\/pre>\n<h6>5. You are supposed to find the value of pi upto 100 places of decimal, what is the easiest way to get the result done.<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The easiest way to find the value of pi, correct upto 100 places of decimal we just need to issue the below command.<\/div>\n<pre># pi 100 \r\n\r\n3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067<\/pre>\n<p>Obviously! We must have package \u2018<strong>pi<\/strong>\u2018 installed. Just do a<strong>\u00a0apt<\/strong>\u00a0or<strong>\u00a0yum<\/strong>\u00a0to get a required package to install\u00a0<strong>\u2018pi<\/strong>\u2018 onto the distribution you are using.<\/p>\n<p>That\u2019s all for now. I\u2019ll be here again with another interesting article very soon. Till then stay tuned and connected to Tecmint.com. Don\u2019t forget to provide us with you valuable feedback in the comment section below.<\/p>\n<h1 class=\"post-title\">11 Advance MySQL Database \u201cInterview Questions and Answers\u201d for Linux Users<\/h1>\n<p>We have already published two MySQL articles, well appreciated by\u00a0<strong>Tecmint Community<\/strong>. This is the third article on MySQL Interview series and sixteen in the the Interview Genre Column.<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/basic-mysql-interview-questions-for-database-administrators\/\" target=\"_blank\" rel=\"noopener\">15 Basic MySQL Interview Questions<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/10-mysql-database-interview-questions-for-beginners-and-intermediates\/\" target=\"_blank\" rel=\"noopener\">10 MySQL Database Interview Questions for Intermediates<\/a><\/li>\n<\/ol>\n<div id=\"attachment_7517\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/06\/MySQL-Interview-Questions.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7517\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/06\/MySQL-Interview-Questions.jpeg\" alt=\"MySQL Interview Questions\" width=\"600\" height=\"400\" aria-describedby=\"caption-attachment-7517\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-7517\" class=\"wp-caption-text\">11 MySQL Interview Questions<\/p>\n<\/div>\n<p>We have reached here all because of yours support and we seek the same in future form your end. Here in this article we will be concentrating on the practical aspect of MySQL, the question relevant for Interview aspect.<\/p>\n<h6>1. Using SELECT statement find the version of the server you are running and print the name of the current database?<\/h6>\n<p><b>Ans:<\/b>\u00a0The below MySQL command will show server version and currently selected Database.<\/p>\n<pre><b>mysql&gt; SELECT VERSION(), DATABASE();<\/b>\r\n\r\n+-------------------------+------------+\r\n| VERSION()               | DATABASE() |\r\n+-------------------------+------------+\r\n| 5.5.34-0ubuntu0.13.10.1 | NULL       |\r\n+-------------------------+------------+\r\n1 row in set (0.06 sec)<\/pre>\n<p>In the Database Column it is showing\u00a0<b>NULL<\/b>\u00a0value because we have not selected any database. So, select database as shown in the following command.<\/p>\n<pre><b>mysql&gt; use Tecmint;<\/b>\r\n\r\nReading table information for completion of table and column names\r\nYou can turn off this feature to get a quicker startup with -A\r\n\r\nDatabase changed<\/pre>\n<pre><b>mysql&gt; select VERSION(), DATABASE();<\/b>\r\n\r\n+-------------------------+------------+\r\n| VERSION()               | DATABASE() |\r\n+-------------------------+------------+\r\n| 5.5.34-0ubuntu0.13.10.1 | tecmint    |\r\n+-------------------------+------------+\r\n1 row in set (0.00 sec)<\/pre>\n<h6>2. USE NOT Operator (!) to select all the users except \u2018SAM\u2019 from a table say \u2018Tecmint\u2019<\/h6>\n<p><b>Ans:<\/b>\u00a0The below statement will show all the columns of all the users from table \u2018<b>Tecmint<\/b>\u2018 except the user \u2018<b>SAM<\/b>\u2018.<\/p>\n<pre><strong>mysql&gt; SELECT * FROM Tecmint WHERE user !=SAM;<\/strong>\r\n\r\n+---------------------+---------+---------+---------+---------+-------+ \r\n| date                | user    | host \t | root     | local   | size  | \r\n+---------------------+---------+---------+---------+---------+-------+ \r\n| 2001-05-14 14:42:21 | Anthony | venus  | barb     | venus   | 98151 | \r\n| 2001-05-15 08:50:57 | TIM     | venus  | phil     | venus   | 978   | \r\n+---------------------+---------+---------+---------+---------+-------+<\/pre>\n<h6>3. Is it possible to implement \u2018AND\u2019 with NOT (!) Operator.<\/h6>\n<p><b>Ans:<\/b>\u00a0The AND operator is used when we use (=) and the operator OR is used when we use (!=). An example of (=) with AND Operator.<\/p>\n<pre><b>mysql&gt; SELECT * FROM mail WHERE user = SAM AND root = phil<\/b><\/pre>\n<p>An Example of (!=) with OR Operator.<\/p>\n<pre><b>mysql&gt; SELECT * FROM mail WHERE user != SAM OR root != phil<\/b>\r\n\r\n+---------------------+---------+---------+---------+---------+-------+ \r\n| date                | user    | host    | root    | local   | size  | \r\n+---------------------+---------+---------+---------+---------+-------+ \r\n| 2001-05-14 14:42:21 | Anthony | venus   | barb    | venus   | 98151 | \r\n+---------------------+---------+---------+---------+---------+-------+<\/pre>\n<ol>\n<li><strong>=<\/strong>\u00a0: means Equal to<\/li>\n<li><b>!=<\/b>\u00a0: Not Equal to<\/li>\n<li><b>!\u00a0:\u00a0<\/b>represents NOT Operator<\/li>\n<\/ol>\n<p>The AND &amp; OR are treated as joining operators in MySQL.<\/p>\n<h6>4. What IFNULL() statement is used for in MySQL?<\/h6>\n<p><b>Ans:<\/b>\u00a0The Query in MySQL can be written precisely using\u00a0<b>IFNULL()<\/b>\u00a0statement. The IFNULL() statement test its first argument and returns if it\u2019s not NULL, or returns its second argument, otherwise.<\/p>\n<pre><b>mysql&gt; SELECT name, IFNULL(id,'Unknown') AS 'id' FROM taxpayer;<\/b>\r\n\r\n+---------+---------+ \r\n| name \t  | id      | \r\n+---------+---------+ \r\n| bernina | 198-48  | \r\n| bertha  | Unknown | \r\n| ben     | Unknown | \r\n| bill    | 475-83  | \r\n+---------+---------+<\/pre>\n<h6>5. You want to see only certain rows from a result set from the beginning or end of a result set. How will you do it?<\/h6>\n<p><b>Ans:<\/b>\u00a0We need to use\u00a0<b>LIMIT<\/b>\u00a0clause along with ORDER BY to achieve the above described scenario.<\/p>\n<h5>Show 1 Record<\/h5>\n<pre><b>mysql&gt; SELECT * FROM name LIMIT 1;<\/b>\r\n\r\n+----+------+------------+-------+----------------------+------+ \r\n| id | name | birth      | color | foods                | cats | \r\n+----+------+------------+-------+----------------------+------+ \r\n| 1  | Fred | 1970-04-13 | black | lutefisk,fadge,pizza | 0    | \r\n+----+------+------------+-------+----------------------+------+<\/pre>\n<h5>Show 5 Record<\/h5>\n<pre><b>mysql&gt; SELECT * FROM profile LIMIT 5;<\/b>\r\n\r\n+----+------+------------+-------+-----------------------+------+ \r\n| id | name | birth      | color | foods                 | cats | \r\n+----+------+------------+-------+-----------------------+------+ \r\n| 1  | Fred | 1970-04-13 | black | lutefisk,fadge,pizza  | 0    | \r\n| 2  | Mort | 1969-09-30 | white | burrito,curry,eggroll | 3    | \r\n| 3  | Brit | 1957-12-01 | red   | burrito,curry,pizza   | 1    |   \r\n| 4  | Carl | 1973-11-02 | red   | eggroll,pizza         | 4    | \r\n| 5  | Sean | 1963-07-04 | blue  | burrito,curry         | 5    | \r\n+----+------+------------+-------+-----------------------+------+<\/pre>\n<pre><b>mysql&gt; SELECT * FROM profile ORDER BY birth LIMIT 1;<\/b>\r\n\r\n+----+------+------------+-------+----------------+------+ \r\n| id | name | birth      | color | foods          | cats | \r\n+----+------+------------+-------+----------------+------+ \r\n| 9  | Dick | 1952-08-20 | green | lutefisk,fadge | 0    | \r\n+----+------+------------+-------+----------------+------+<\/pre>\n<h6>6. Oracle Vs MySQL. Which one and Why?<\/h6>\n<p><b>Ans:<\/b>\u00a0Well both has its advantages and disadvantages. As a matter of time I prefer MySQL.<\/p>\n<h5>Reason for Selection MySQL Over oracle<\/h5>\n<ol>\n<li>Mysql is FOSS.<\/li>\n<li>MySQL is portable.<\/li>\n<li>MYSQL supports both GUI as well as Command Prompt.<\/li>\n<li>MySQL Administration is supported over Query Browser.<\/li>\n<\/ol>\n<h6>7. How will you get current date in MySQL?<\/h6>\n<p><b>Ans:<\/b>\u00a0Getting current date in MySQL is as simple as executing the below SELECT Statement.<\/p>\n<pre><b>mysql&gt; SELECT CURRENT_DATE();<\/b>\r\n\r\n+----------------+\r\n| CURRENT_DATE() |\r\n+----------------+\r\n| 2014-06-17     |\r\n+----------------+<\/pre>\n<h6>8. How will you export tables as an XML file in MySQL?<\/h6>\n<p><b>Ans:<\/b>\u00a0We use \u2018<strong>-e<\/strong>\u2018 (export) option to export MySQL table or the whole database into an XML file. With large tables we may need to implement it manually but for small tables, applications like phpMyAdmin can do the job.<\/p>\n<p>A native command of MySQL can do it.<\/p>\n<pre><b>mysql -u USER_NAME \u2013xml -e 'SELECT * FROM table_name' &gt; table_name.xml<\/b><\/pre>\n<p>Where USER_NAME is username of Database, table_name is the table we are exporting to XML and table_name.xml is the xml file where data is stored.<\/p>\n<h6>9. What is MySQL_pconnect? And how it differs from MySQL_connect?<\/h6>\n<p><b>Ans:<\/b>\u00a0MySQL_pconnect() opens a connection that is persistent to the MySQL Database which simply means that the database is not opened every-time the page loads and hence we can not use MySQL_close() to close a persistent connection.<\/p>\n<p>A brief difference between MySQL_pconnect and MySQL_connect are.<\/p>\n<p>Unlike MySQL_pconnect, MySQL_connect \u2013 Opens the Database every-time the page is loaded which can be closed any-time using statement MySQL_close().<\/p>\n<h6>10. You need to show all the indexes defined in a table say \u2018user\u2019 of Database say \u2018mysql\u2019. How will you achieve this?<\/h6>\n<p><b>Ans:<\/b>\u00a0The following command will show all the indexes of a table \u2018user\u2019.<\/p>\n<pre><b>mysql&gt; show index from user;<\/b>\r\n+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ \r\n| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | \r\n+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ \r\n| user  |          0 | PRIMARY  |            1 | Host        | A         |        NULL |     NULL | NULL   |      | BTREE      |         |               | \r\n| user  |          0 | PRIMARY  |            2 | User        | A         |           4 |     NULL | NULL   |      | BTREE      |         |               | \r\n+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+ \r\n2 rows in set (0.00 sec)<\/pre>\n<h6>11. What are CSV tables?<\/h6>\n<p><b>Ans:<\/b>\u00a0CSV stands for Comma-Separated Values aka Character-Separated Values. CSV table stores data in plain text and tabular format. It typically contains one record per line.<\/p>\n<p>Each record is separated by specific delimiters (Comma, Semi-colon, \u2026) where each record has same sequence of field. CSV tables are most widely used to store phone contacts to Import and Export and can be used to store any sort of plain text data.<\/p>\n<p>That\u2019s all for now. I\u2019ll be here again with another Interesting article, you people will love to read.<\/p>\n<h1 class=\"post-title\">10 Useful Interview Questions and Answers on Linux Commands<\/h1>\n<p>Linux command Line and the interaction of users with Linux Shell with Linux Commands is the most wonderful part of Linux and is one of the most widely topic from interview point. Here in this article we are coming up with 10 wonderful questions that are important from the interview perspective and will surely add to yours knowledge base.<\/p>\n<div id=\"attachment_7996\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/07\/Linux-Command-Questions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-7996\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/07\/Linux-Command-Questions.png\" alt=\"Linux Interview Questions\" width=\"442\" height=\"317\" aria-describedby=\"caption-attachment-7996\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-7996\" class=\"wp-caption-text\">Linux Command Questions<\/p>\n<\/div>\n<h6>1. How will you suspend a running process and put it in the background?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0In order to suspend a running process\/job and put it in the background we need to use the key combination Ctrl+z.<\/div>\n<h6>2. What are the minimum number of partitions required to install Linux and How will you check boot messages?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The \/root partition alone is sufficient to perform the whole task however minimum three partitions are recommended to install Linux. These are root, boot and swap. An IDE Hard Disk Drive supports upto 63 partitions and SCSI Hard Disk Drive supports up-to 15 partitions.<\/div>\n<p>In order to check boot messages we need to use cat or dmesg commands as shown below.<\/p>\n<pre># cat \/var\/log\/messages\r\n\r\nOR \r\n\r\n# dmesg<\/pre>\n<h6>3. Name the Daemon responsible for tracking System Event on your Linux box?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The Daemon \u2018syslogd\u2019 is responsible for tracking system information and stores the tracked logs in specific log files.<\/div>\n<h6>4. What are the minimum requirements to run command \u2018fsck\u2019 on root partition?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The \/root partition must be mounted as read only mode and not read-write to execute fsck command on root partition.<\/div>\n<h6>5. How to copy \/home directory hierarchically to another directory. How will you do it?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0A Linux command \u2018cpio\u2019 comes to rescue here. The \u2018cpio\u2019 utility copies files and directories hierarchically over another location.<\/div>\n<h6>6. How will you automate the rotation of logs in Linux?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0A Linux command \u2018logrotate\u2019 comes to rescue when it comes to automate the logs in Linux.<\/div>\n<h6>7. How to know who has scheduled the job?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The Linux command \u2018at\u2019 along with switch \u2018-l\u2019 is all we need to use in order to check who has scheduled the job.<\/div>\n<h6>8. How to view the contents of the tar ball without extracting it. How will you do this?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0We need to use command \u2018tar\u2019 with options \u2018-tvf\u2019. The options \u2018t\u2019 (Display the contents), \u2018v\u2019 (Verbose), \u2018f\u2019 (files).<\/div>\n<h6>9. What is page Fault and how it happens?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0A program request for some data and if it is not available in the Memory it is called as page fault. Page Fault occurs as a result of program shutdown.<\/div>\n<h6>10. What are return codes in program?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0A return code is the feature of Shell. The result of return code shows the status of a program. A successful program after execution returns \u20180\u2019, &amp;&amp; can be used to prioritize which application will be executing first.<\/div>\n<p>That\u2019s all for now. I\u2019ll be here again with another interesting article soon.<\/p>\n<h1 class=\"post-title\">10 Useful \u201cSquid Proxy Server\u201d Interview Questions and Answers in Linux<\/h1>\n<p>It\u2019s not only to System Administrator and Network Administrator, who listens the phrase Proxy Server every now and then but we too. Proxy Server is now a corporate culture and is the need of the hour. Proxy server now a days is implemented from small schools, cafeteria to large MNCs. Squid (also known as proxy) is such an application which acts as proxy server and one of the most widely used tool of its kind.<\/p>\n<p>This Interview article aims at strengthening your base from Interview point on the ground of proxy server and squid.<\/p>\n<div id=\"attachment_8102\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/07\/Squid-Interview-Questions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8102\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/07\/Squid-Interview-Questions.png\" alt=\"Squid Interview Questions\" width=\"442\" height=\"317\" aria-describedby=\"caption-attachment-8102\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-8102\" class=\"wp-caption-text\">Squid Interview Questions<\/p>\n<\/div>\n<h6>1. What do you mean by Proxy Server? What is the use of Proxy Server in Computer Networks?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0A Proxy Server refers to physical machine or Application which acts intermediate between client and resource provider or server. A client seeks for file, page or data from the the proxy server and proxy server manages to get the requested demand of client fulfilled by handling all the complexities in between.<\/div>\n<p>Proxy servers are the backbone of WWW (World Wide Web). Most of the proxies of today are web proxies. A proxy server handles the complexity in between the Communication of client and Server. Moreover it provides anonymity on the web which simply means your identity and digital footprints are safe. Proxies can be configured to allow which sites client can see and which sites are blocked.<\/p>\n<h6>2. What is Squid?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Squid is an Application software released under GNU\/GPL which acts as a proxy server as well as web cache Daemon. Squid primarily supports Protocol like HTTP and FTP however other protocols like HTTPS, SSL,TLS, etc are well supported. The feature web cache Daemon makes web surfing faster by caching web and DNS for frequently visited websites. Squid is known to support all major platforms including Linux, UNIX, Microsoft Windows and Mac.<\/div>\n<h6>3. What is the default port of squid and how to change its operating port?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0The default port on which squid runs is 3128. We can change the operating port of squid from default to any custom unused port by editing its configuration file which is located at \/etc\/squid\/squid.conf as suggested below.<\/div>\n<p>Open \u2018\/etc\/squid\/squid.conf\u2019 file and with your choice of editor.<\/p>\n<pre># nano \/etc\/squid\/squid.conf<\/pre>\n<p>Now change this port to any other unused port. Save the editor and exit.<\/p>\n<pre>http_port 3128<\/pre>\n<p>Restart the squid service as shown below.<\/p>\n<pre># service squid restart<\/pre>\n<h6>4. You works for a company the management of which ask you to block certain domains through squid proxy server. What are you going to do?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Blocking domain is a module which is implemented well in the configuration file. We just need to perform a little manual configuration as suggested below.<\/div>\n<p>a. Create a file say \u2018blacklist\u2019 under directory \u2018\/etc\/squid\u2019.<\/p>\n<pre># touch \/etc\/squid\/blacklist<\/pre>\n<p>b. Open the file \u2018\/etc\/squid\/blacklist\u2019 with nano editor.<\/p>\n<pre># nano \/etc\/squid\/blacklist<\/pre>\n<p>c. Add all the domains to the file blacklist with one domain per line.<\/p>\n<pre>.facebook.com\r\n.twitter.com\r\n.gmail.com\r\n.yahoo.com\r\n...<\/pre>\n<p>d. Save the file and exit. Now open the Squid configuration file from location \u2018\/etc\/squid\/squid.conf\u2019.<\/p>\n<pre># nano \/etc\/squid\/squid.conf<\/pre>\n<p>e. Add the lines below to the Squid configuration file.<\/p>\n<pre>acl BLACKLIST dstdom_regex -i \u201c\/etc\/squid\/blacklist\u201d\r\nhttp_access deny blacklist<\/pre>\n<p>f. Save the configuration file and exit. Restart Squid service to make the changes effective.<\/p>\n<pre># service squid restart<\/pre>\n<h6>5. What is Media Range Limitation and partial download in Squid?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Media Range Limitation is a special feature of squid in which just the required data is requested from the server and not the whole file. This feature is very well implemented in various videos streaming websites like Youtube and Metacafe where a user can click on the middle of progress bar hence whole video need not be fetched except for the requested part.<\/div>\n<p>The squid\u2019s feature of partial download is implemented well within windows update where downloads are requested in the form of small packets which can be paused. Because of this feature a update downloading windows machine can be restarted without any fear of data loss. Squid makes the Media Range Limitation and Partial Download possible only after storing a copy of whole data in it. Moreover the partial download gets deleted and not cached when user points to another page until Squid is specially configured somehow.<\/p>\n<h6>6. What is reverse proxy in squid?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Reverse proxy is a feature of Squid which is used to accelerate the web surfing for end user. Say the Real server \u2018RS\u2019 contains the resource and \u2018PS\u2019 is the proxy Server. The client seek some data which is available at RS. It will rely on RS for the specified data for the first time and the copy of that specified data gets stored on PS for configurable amount of time. For every request for that data from now PS becomes the real source. This results in Less traffic, Lesser CPU usages, Lesser web resource utilization and hence lesser load to actual server RS. But RS has no statistics for the total traffic since PS acted as actual server and no Client reached RS. \u2018X-Forwarded-For HTTP\u2019 can be used to log the client IP although on RS.<\/div>\n<p>Technically it is feasible to use single squid server to act both as normal proxy server and reverse proxy server at the same point of time.<\/p>\n<h6>7. Since Squid can be used as web-cache Daemon, is it possible to Clear its Cache? How?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0No Doubt! Squid acts as web-cache Daemon which is used to accelerate web surfing still it is possible to clear its cache and that too very easily.<\/div>\n<p>a. First stop Squid proxy server and delete cache from the location \u2018\/var\/lib\/squid\/cache\u2019 directory.<\/p>\n<pre># service squid stop\r\n# rm -rf \/var\/lib\/squid\/cache\/*&lt;<\/pre>\n<p>b. Create Swap directories.<\/p>\n<pre># squid -z<\/pre>\n<h6>8. A client approaches you, who is working. They want the web access time be restricted for their children. How will you achieve this scenario?<\/h6>\n<p>Say the web access allow time be 4\u2019o clock to 7\u2019o clock in the evening for three hours, sharply form Monday to Friday.<\/p>\n<p>a. To restrict web access between 4 to 7 from Monday to Friday, open the Squid configuration file.<\/p>\n<pre># nano \/etc\/squid\/squid.conf<\/pre>\n<p>b. Add the following lines and save the file and exit.<\/p>\n<pre>acl ALLOW_TIME time M T W H F 16:00-19:00\r\nshttp_access allow ALLOW_TIME<\/pre>\n<p>c. Restart the Squid Service.<\/p>\n<pre># service squid restart<\/pre>\n<h6>9. Squid stores data in which file format?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0Data stored by Squid is in ufs format. Ufs is the old well-known Squid storage format.<\/div>\n<h6>10. Where do cache gets stored by squid?<\/h6>\n<div><strong>Answer :<\/strong>\u00a0A squid stores cache in special folder at the location \u2018\/var\/spool\/squid\u2019.<\/div>\n<p>That\u2019s all for now. I\u2019ll be here again with another interesting article soon.<\/p>\n<h1 class=\"post-title\">10 Basic Interview Questions and Answers on Linux Networking \u2013 Part 1<\/h1>\n<p>Most of the computer in this century is on network of one kind or other. A computer not attached to network is nothing more than a Metal. Network means connection of two or more computers using protocols (viz.,\u00a0<strong>HTTP<\/strong>,\u00a0<strong>FTP<\/strong>,\u00a0<strong>HTTPS<\/strong>, etc) in such a way that they tends to serve information as and when required.<\/p>\n<div id=\"attachment_8198\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/08\/Networking.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-8198\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/08\/Networking.png\" alt=\"Linux Networking Questions\" width=\"600\" height=\"400\" aria-describedby=\"caption-attachment-8198\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-8198\" class=\"wp-caption-text\">Interview Questions on Networking<\/p>\n<\/div>\n<p>Networking is a vast subject and is ever expanding. It is the most frequently used interview topic. Networking questions are common to all the interviewing candidates of IT no matter he is a System Admin, a Programmer, or deals in any other branch of Information Technology. which in turn means that market demands, everyone should have the basic knowledge of Networks and Networking.<\/p>\n<p>This is the first time we have touched an ever demanding Topic \u201c<strong>Networking<\/strong>\u201c. Here we have tried to serve the 10 basic interview questions and answers on networking.<\/p>\n<h6>1. What is a Computer Network?<\/h6>\n<p><b>Ans<\/b>: A computer network is a connection network between two or more nodes using Physical Media Links viz., cable or wireless in order to exchange data over pre-configured services and Protocols. A computer network is a collective result of \u2013 Electrical Engineering, Computer Science, Telecommunication, Computer Engineering and Information Technology involving their theoretical as well as practical aspects into action. The most widely used Computer Network of Today is Internet which supports World Wide Web (<strong>WWW<\/strong>).<\/p>\n<h6>2. What is DNS?<\/h6>\n<p><b>Ans<\/b>: DNS stands for\u00a0<strong>Domain Name System<\/strong>. It is a Naming System for all the resources over Internet which includes Physical nodes and Applications. DNS is a way to locate to a resource easily over a network and serves to be an essential component necessary for the working of Internet.<\/p>\n<p>It is always easy to remember\u00a0<strong>xyz.com<\/strong>\u00a0that to remember its IP(v4) address\u00a0<strong>82.175.219.112<\/strong>. The condition gets more worse when you have to deal with IP(v6) address\u00a0<strong>2005:3200:230:7e:35dl:2874:2190<\/strong>. Now think of the scenario when you have a list of 10 most visited resource over Internet? Didn\u2019t the things get more worse to remember? It is said and proved scientifically that humans are good in remembering names as compared to numbers.<\/p>\n<p>The Domain Name System functions to assign Domain Names by mapping corresponding IP addresses and works in a Hierarchical and Distributed Fashion.<\/p>\n<h6>3. What are IPv4 and IPv6? Who manages these?<\/h6>\n<p><b>Ans<\/b>: IPv4 and IPv6 are the versions of Internet Protocol which stands for Version4 and Version6 respectively. IP address is an unique value which represents a device over network. All the device over Internet must have a valid and Unique address to function normally.<\/p>\n<p>IPv4 is a 32 bit numeric representation of devices over Internet, most widely used till date. It supports upto 4.3 billion (4,300,000,000) unique IP addresses. Seeing the continuing growth of Internet with more and more devices and users linking to Internet there was a need of better version of IP address which could support more users. Hence came IPv6 in 1995. An example of IPv4 is:<\/p>\n<pre>82.175.219.112<\/pre>\n<p>IPv6 is a 128 bit numeric representation of devices over Internet. It supports as much as 340 trillion, trillion, trillion (340,000,000,000,000,000,000,000,000,000,000,000,000) unique IP address. This is sufficient to provide more than a billion of IP addresses to every human being on earth. Sufficient for centuries. With the invent of IPv6, we need not to bother about depleting Unique IP addresses. An example of IPv6 is:<\/p>\n<pre> 2005:3200:230:7e:35dl:2874:2190<\/pre>\n<h6>4. Give a brief description of PAN, LAN, HAN, SAN, CAN, MAN, WAN, GAN.<\/h6>\n<p><b>Ans<\/b>: PAN stands for Personal Area Network. It is a connection of Computer and Devices that are close to a person VIZ., Computer, Telephones, Fax, Printers, etc. Range Limit \u2013 10 meters.<\/p>\n<p>LAN stands for Local Area Network. LAN is the connection of Computers and Devices over a small Geographical Location \u2013 Office, School, Hospital, etc. A LAN can be connected to WAN using a gateway (Router).<\/p>\n<p>HAN stands for House Area Network. HAN is LAN of Home which connects to homely devices ranging from a few personal computers, phone, fax and printers.<\/p>\n<p>SAN stands for Storage Area Network. SAN is the connection of various storage devices which seems local to a computer.<\/p>\n<p>CAN stands for Campus Area Network, CAN is the connection of devices, printers, phones and accessories within a campus which Links to other departments of the organization within the same campus.<\/p>\n<p>MAN stands for Metropolitan Area Network. MAN is the connection of loads of devices which spans to Large cities over a wide Geographical Area.<\/p>\n<p>WAN stands for Wide Area Network. WAN connects devices, phones, printers, scanners, etc over a very wide geographical location which may range to connect cities, countries and ever continents.<\/p>\n<p>GAN stands for Global Area Network. GAN connects mobiles across the globe using satellites.<\/p>\n<h6>5. What is POP3?<\/h6>\n<p><b>Ans:<\/b>\u00a0POP3 stands for Post Office Protocol Version3 (Current Version). POP is a protocol which listens on port 110 and is responsible for accessing the mail service on a client machine. POP3 works in two modes \u2013 Delete Mode and Keep Mode.<\/p>\n<ol>\n<li><b>Delete Mode<\/b>: A mail is deleted from the mailbox after successful retrieval.<\/li>\n<li><b>Keep Mode<\/b>: The Mail remains Intact in the mailbox after successful retrieval.<\/li>\n<\/ol>\n<h6>6. What is the criteria to check the network reliability?<\/h6>\n<p><b>Ans<\/b>: A network Reliability is measured on following factors.<\/p>\n<ol>\n<li><b>Downtime<\/b>: The time it takes to recover.<\/li>\n<li><b>Failure Frequency<\/b>: The frequency when it fails to work the way it is intended.<\/li>\n<\/ol>\n<h6>7. What is a router?<\/h6>\n<p><b>Ans<\/b>: A router is a physical device which acts as a gateway and connects to two network. It forwards the packets of data\/information from one network to another. It acts as an interconnection Link between two network.<\/p>\n<h6>8. What are the use of cross and standard cables? Where do you find their usages?<\/h6>\n<p><b>Ans<\/b>: A Network cable may be crossover as well as straight. Both of these cables have different wires arrangement in them, which serves to fulfill different purpose.<\/p>\n<h5>Area of application of Straight cable<\/h5>\n<ol>\n<li>Computer to Switch<\/li>\n<li>Computer to Hub<\/li>\n<li>Computer to Modem<\/li>\n<li>Router to Switch<\/li>\n<\/ol>\n<h5>Ares of application of Crossover cable<\/h5>\n<ol>\n<li>Computer to Computer<\/li>\n<li>Switch to Switch<\/li>\n<li>Hub to Hub<\/li>\n<\/ol>\n<h6>9. What do you mean by Bandwidth?<\/h6>\n<p><b>Ans<\/b>: Every Signal has a limit of its upper range and lower range of frequency of signal it can carry. This range of limit of network between its upper frequency and lower frequency is termed as Bandwidth.<\/p>\n<h6>10. What do you mean by MAC address? Does it has some link or something in common to Mac OS of Apple?<\/h6>\n<p><b>Ans<\/b>: MAC stands for Media Access Control. It is the address of the device identified at Media Access Control Layer of Network Architecture. Similar to IP address MAC address is unique address, i.e., no two device can have same MAC address. MAC address is stored at the Read Only Memory (ROM) of the device.<\/p>\n<p>MAC Address and Mac OS are two different things and it should not be confused with each other. Mac OS is a POSIX standard Operating System Developed upon FreeBSD used by Apple devices.<\/p>\n<p>That\u2019s all for now. We will be coming up with another articles on Networking series every now and then. Till then, don\u2019t forget to provide us with your valuable feedback in the comment section below.<\/p>\n<h1 class=\"post-title\">15 Interview Questions on Linux \u201cls\u201d Command \u2013 Part 1<\/h1>\n<p>The listing command in UNIX and UNIX like operating System \u2018<strong>ls<\/strong>\u2018 is one of the most basic and widely used utility in command-line. It is POSIX compliant utility available for GNU coreutils and BSD variants.<\/p>\n<p>The\u00a0<a href=\"https:\/\/www.tecmint.com\/linux-ls-command-tricks\/\" target=\"_blank\" rel=\"noopener\">\u2018ls\u2019 command can be used with a variety of options<\/a>\u00a0to get desired results. This article aims at deep insight of file listing command in Linux with relevant examples.<\/p>\n<div id=\"attachment_9032\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/ls-Command-Questions.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-9032\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/ls-Command-Questions.png\" alt=\"ls Command Questions\" width=\"442\" height=\"317\" aria-describedby=\"caption-attachment-9032\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9032\" class=\"wp-caption-text\">15 ls Command Questions<\/p>\n<\/div>\n<h6>1. How will you List files from a directory?<\/h6>\n<p><strong>Ans:<\/strong>\u00a0The Linux file listing command \u2018<strong>ls<\/strong>\u2018 comes to rescue here.<\/p>\n<pre># ls\r\n<\/pre>\n<div id=\"attachment_9016\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/list-files.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9016\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/list-files.gif\" alt=\"List Files in Linux\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9016\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9016\" class=\"wp-caption-text\">List Files<\/p>\n<\/div>\n<p>Alternatively, we can use\u00a0<a href=\"https:\/\/www.tecmint.com\/echo-command-in-linux\/\" target=\"_blank\" rel=\"noopener\">\u2018echo\u2019 command<\/a>\u00a0to list files within a directory in association with wildcard (<strong>*<\/strong>).<\/p>\n<pre># echo *\r\n<\/pre>\n<div id=\"attachment_9017\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/list-all-files.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9017\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/list-all-files.gif\" alt=\"List All Files in Linux\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9017\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9017\" class=\"wp-caption-text\">List All Files<\/p>\n<\/div>\n<h6>2. How will you list all the directories only using echo command?<\/h6>\n<pre># echo *\/\r\n<\/pre>\n<div id=\"attachment_9018\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/list-all-directories.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9018\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/list-all-directories.gif\" alt=\"List All Directories in Linux\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9018\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9018\" class=\"wp-caption-text\">List All Directories<\/p>\n<\/div>\n<h6>3. How will you list all the files within a directory including hidden files aka (.) dot files?<\/h6>\n<p><strong>Ans:<\/strong>\u00a0We need to use option \u2018<strong>-a<\/strong>\u2018 (list hidden files) with command \u2018<strong>ls<\/strong>\u2018.<\/p>\n<pre># ls -a\r\n<\/pre>\n<div id=\"attachment_9019\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/list-all-hidden-files.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9019\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/list-all-hidden-files.gif\" alt=\"List All Hidden Files in Linux\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9019\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9019\" class=\"wp-caption-text\">List All Hidden Files<\/p>\n<\/div>\n<h6>4. How do you list all the files within a directory including hidden files, but do not list implied \u2018.\u2019 and \u2018..\u2019?<\/h6>\n<p><strong>Ans:<\/strong>\u00a0We need to use option \u2018<strong>-A<\/strong>\u2018 (do not list implied\u00a0<strong>.<\/strong>\u00a0and\u00a0<strong>..<\/strong>) with command \u2018<strong>ls<\/strong>\u2018.<\/p>\n<pre># ls -A\r\n<\/pre>\n<div id=\"attachment_9020\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/Do-not-list-Implied.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9020\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/Do-not-list-Implied.gif\" alt=\"Do Not List Implied\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9020\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9020\" class=\"wp-caption-text\">Do Not List Implied<\/p>\n<\/div>\n<h6>5. How will you print the content of a directory in long format listing?<\/h6>\n<p><strong>Ans:<\/strong>\u00a0We need to use option \u2018<strong>l<\/strong>\u2018 (long format) with command \u2018<strong>ls<\/strong>\u2018.<\/p>\n<pre># ls -l\r\n<\/pre>\n<div id=\"attachment_9021\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/list-files-long.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9021\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/list-files-long.gif\" alt=\"List Files Long\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9021\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9021\" class=\"wp-caption-text\">List Files Long<\/p>\n<\/div>\n<p>In the above example, the output seems like.<\/p>\n<pre>drwxr-xr-x  5 avi tecmint      4096 Sep 30 11:31 Binary\r\n<\/pre>\n<p>Here,\u00a0<b>drwxr-xr-x<\/b>\u00a0is file permission for owner, group and world. Owner has Read(r), Write(w) and Execute(x) permission. The group to which this file belongs has Read(r) and Execute(x) permission but not Write(w) permission, same permission implies for the world that have access to this file.<\/p>\n<ol>\n<li>The Initial \u2018<strong>d<\/strong>\u2018 means its a Directory.<\/li>\n<li>Number \u2018<strong>5<\/strong>\u2018 represents Symbolic Link.<\/li>\n<li>The File Binary belongs to user\u00a0<strong>avi<\/strong>\u00a0and group\u00a0<strong>tecmint<\/strong>.<\/li>\n<li><strong>Sep 30 11:31<\/strong>\u00a0represents the date and time it was last modified.<\/li>\n<\/ol>\n<h6>6. You are supposed to print the content of directory in long format listing, showing hidden\/dot files. How will you achieve this?<\/h6>\n<p><strong>Ans:<\/strong>\u00a0We need to use option \u2018<strong>-a<\/strong>\u2018 (list hidden files) and \u2018<strong>-l<\/strong>\u2018 (long listing) together with command \u2018<strong>ls<\/strong>\u2018.<\/p>\n<pre># ls -la\r\n<\/pre>\n<div id=\"attachment_9022\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/Print-Content-of-Directory.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9022\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/Print-Content-of-Directory.gif\" alt=\"Print Content of Directory\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9022\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9022\" class=\"wp-caption-text\">Print Content of Directory<\/p>\n<\/div>\n<p>Alternatively We can use option \u2018<b>-A<\/b>\u2018 and \u2018<b>-l<\/b>\u2018 with \u2018<b>ls<\/b>\u2018 command, if we do not want to list implied \u2018.\u2019 and \u2018..\u2019.<\/p>\n<pre># ls -lA\r\n<\/pre>\n<h6>7. How will you figure out the author of each file?<\/h6>\n<p><strong>Ans:<\/strong>\u00a0We need to use option \u2018<strong>\u2013author<\/strong>\u2018 along with option \u2018<strong>-l<\/strong>\u2018 to print the author name of each file.<\/p>\n<pre># ls --author -l\r\n<\/pre>\n<div id=\"attachment_9023\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/List-Author-Files.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9023\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/List-Author-Files.gif\" alt=\"List Author Files\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9023\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9023\" class=\"wp-caption-text\">List Author Files<\/p>\n<\/div>\n<h6>8. How will you print escape for non-graphic character?<\/h6>\n<p><strong>Ans:<\/strong>\u00a0We just need to use option \u2018<strong>-b<\/strong>\u2018 to print escape for non-graphic character.<\/p>\n<pre># ls -b\r\n<\/pre>\n<div id=\"attachment_9024\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/Print-Escape-Character.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9024\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/Print-Escape-Character.gif\" alt=\"Print Escape Character\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9024\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9024\" class=\"wp-caption-text\">Print Escape Character<\/p>\n<\/div>\n<h6>9. List the size of files and folders in desired scale format. How will you achieve this?<\/h6>\n<p><strong>Ans:<\/strong>\u00a0Here option \u2018<strong>\u2013block-size=scale<\/strong>\u2018 along with option \u2018<strong>-l<\/strong>\u2018 needs to be used. We need to remove \u2018scale\u2019 in the example with the desired scale viz\u00a0<strong>M<\/strong>,\u00a0<strong>K<\/strong>, etc.<\/p>\n<pre># ls --block-size=M -l\r\n# ls --block-size=K -l\r\n<\/pre>\n<div id=\"attachment_9025\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/List-File-Scale-Format.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9025\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/List-File-Scale-Format.gif\" alt=\"List File Scale Format\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9025\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9025\" class=\"wp-caption-text\">List File Scale Format<\/p>\n<\/div>\n<h6>10. List the files within a directory, but don\u2019t show the backup files, i.e., those files that end with ~.<\/h6>\n<p><strong>Ans:<\/strong>\u00a0Here option \u2018<strong>-B<\/strong>\u2018 (do not list implied entries ending with\u00a0<strong>~<\/strong>) comes to rescue.<\/p>\n<pre># ls -B\r\n<\/pre>\n<div id=\"attachment_9026\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/List-File-Without-Backup.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9026\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/List-File-Without-Backup.gif\" alt=\"List File Without Backup\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9026\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9026\" class=\"wp-caption-text\">List File Without Backup<\/p>\n<\/div>\n<h6>11. Sort all the files within a directory by name and show associated last modification information.<\/h6>\n<p><strong>Ans:<\/strong>\u00a0We need to use option \u2018<strong>-c<\/strong>\u2018 and option \u2018<strong>-l<\/strong>\u2018 with command ls to fulfil the need as suggested above.<\/p>\n<pre># ls -cl\r\n<\/pre>\n<div id=\"attachment_9027\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/Sort-Files.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9027\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/Sort-Files.gif\" alt=\"Sort Files in Linux\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9027\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9027\" class=\"wp-caption-text\">Sort Files<\/p>\n<\/div>\n<h6>12. Sort all the files within a directory by modification time and show associated information.<\/h6>\n<p><strong>Ans:<\/strong>\u00a0We need to use three options together i.e., \u2018<strong>-l<\/strong>\u2018, \u2018<strong>-t<\/strong>\u2018 and \u2018<strong>-c<\/strong>\u2018 with command ls to sort files by modification time, newest first.<\/p>\n<pre># ls -ltc\r\n<\/pre>\n<div id=\"attachment_9028\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/Sort-Files-by-Modification.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9028\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/Sort-Files-by-Modification.gif\" alt=\"Sort Files by Modification\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9028\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9028\" class=\"wp-caption-text\">Sort Files by Modification<\/p>\n<\/div>\n<h6>13. How will you control the output of \u2018ls\u2019 command to be colorful or no-color?<\/h6>\n<p><strong>Ans:<\/strong>\u00a0We need to use option \u2018<strong>\u2013color=parameter<\/strong>\u2018. The parameter to be used with color option are \u2018auto\u2019, \u2018always\u2019 and \u2018never\u2019 which are self explanatory.<\/p>\n<pre># ls --color=never\r\n# ls --color=auto\r\n# ls --color=always\r\n<\/pre>\n<div id=\"attachment_9029\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/ls-colorful-output.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9029\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/ls-colorful-output.gif\" alt=\"ls Colorful Output\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9029\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9029\" class=\"wp-caption-text\">ls Colorful Output<\/p>\n<\/div>\n<h6>14. You are supposed to list directory entries themselves, not their contents. What will you do?<\/h6>\n<p><strong>Ans:<\/strong>\u00a0Here the option \u2018<strong>-d<\/strong>\u2018 comes handy.<\/p>\n<pre># ls -d\r\n<\/pre>\n<div id=\"attachment_9030\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/List-Directory-Entries.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9030\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/List-Directory-Entries.gif\" alt=\"List Directory Entries\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9030\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9030\" class=\"wp-caption-text\">List Directory Entries<\/p>\n<\/div>\n<h6>15. Create an alias for long format listing \u201cls -l\u201d as \u201cll\u201d and output the result to a file and not standard output.<\/h6>\n<p><strong>Ans:<\/strong>\u00a0Here in the above scenario, we need to add alias to\u00a0<strong>.bashrc<\/strong>\u00a0file and then use redirect operator to write the output to file and not standard output. We will be using editor nano.<\/p>\n<pre># ls -a\r\n# nano .bashrc\r\n# ll &gt;&gt; ll.txt\r\n# nano ll.txt\r\n<\/pre>\n<div id=\"attachment_9031\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/Create-ls-Alias.gif\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-9031\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2014\/09\/Create-ls-Alias.gif\" alt=\"Create Alias for ls command\" width=\"620\" height=\"368\" aria-describedby=\"caption-attachment-9031\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-9031\" class=\"wp-caption-text\">Create Alias for ls command<\/p>\n<\/div>\n<p>That\u2019s all for now. Don\u2019t forget to provide us with your valuable feedback in the comments below. I\u2019ll be here again with another interesting article soon. Till then stay tuned and connected.<\/p>\n<p><b>Real Also<\/b>:<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/ls-interview-questions\/\">10 \u2018ls\u2019 Command Interview Questions \u2013 Part 2<\/a><\/li>\n<li><a href=\"https:\/\/www.tecmint.com\/15-basic-ls-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">15 Basic \u2018ls\u2019 Commands in Linux<\/a><\/li>\n<\/ol>\n<h1 class=\"post-title\">10 Useful \u2018ls\u2019 Command Interview Questions \u2013 Part 2<\/h1>\n<p>Continuing the legacy of\u00a0<a href=\"https:\/\/www.tecmint.com\/tag\/linux-ls-command\/\" target=\"_blank\" rel=\"noopener\">ls command<\/a>\u00a0here is the second interview article on Listing command. The first article of the series was highly appreciated by the Tecmint Community. If you\u2019ve missed the first part of this series you may like to visit at:<\/p>\n<ol>\n<li><a href=\"https:\/\/www.tecmint.com\/ls-command-interview-questions\/\" target=\"_blank\" rel=\"noopener\">15 Interview Questions on \u201cls\u201d Command \u2013 Part 1<\/a><\/li>\n<\/ol>\n<p>This article is well presented in the manner that it gives deep insight of\u00a0<a href=\"https:\/\/www.tecmint.com\/15-basic-ls-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">ls command with examples<\/a>. We have taken extra care in the making of article so that it remains simple to understand yet serve the purpose to the fullest.<\/p>\n<div id=\"attachment_11795\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/ls-Command-Interview-Questions.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-11795\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/ls-Command-Interview-Questions-620x297.jpg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/ls-Command-Interview-Questions-620x297.jpg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/ls-Command-Interview-Questions.jpg 720w\" alt=\"ls Command Interview Questions\" width=\"620\" height=\"297\" aria-describedby=\"caption-attachment-11795\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11795\" class=\"wp-caption-text\">10 Interview Questions on ls Command<\/p>\n<\/div>\n<h6>1. You are supposed to list the content of a directory in long list format, but not print the name of the author and group the file belongs. Also show the difference in output.<\/h6>\n<p><strong>a.<\/strong>\u00a0ls command listing the name of the files in long listing format when used with switch (<strong>-l<\/strong>).<\/p>\n<pre># ls -l\r\n<\/pre>\n<div id=\"attachment_11769\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Files-inLong-List-Format.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11769\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Files-inLong-List-Format.gif\" alt=\"List Files in- Long List Format\" aria-describedby=\"caption-attachment-11769\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11769\" class=\"wp-caption-text\">List Files in- Long List Format<\/p>\n<\/div>\n<p><strong>b.<\/strong>\u00a0ls command listing the name of the files in long listing format along with the name of the author file belongs, when used with switch (<strong>\u2013author<\/strong>) along with switch (<strong>-l<\/strong>).<\/p>\n<pre># ls -l --author\r\n<\/pre>\n<div id=\"attachment_11770\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Files-By-Author.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11770\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Files-By-Author.gif\" alt=\"List Files By Author\" aria-describedby=\"caption-attachment-11770\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11770\" class=\"wp-caption-text\">List Files By Author<\/p>\n<\/div>\n<p><strong>c.<\/strong>\u00a0ls command listing the name of the files without the name of its owner, when used with switch (<strong>-g<\/strong>).<\/p>\n<pre># ls -g\r\n<\/pre>\n<div id=\"attachment_11771\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Files-Without-Printing-Author.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11771\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Files-Without-Printing-Author.gif\" alt=\"List Files Without Printing Owner Name\" aria-describedby=\"caption-attachment-11771\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11771\" class=\"wp-caption-text\">List Files Without Printing Owner Name<\/p>\n<\/div>\n<p><strong>d.<\/strong>\u00a0ls command listing the name of files in long listing format without the name of group it belongs, when used with switch (<strong>-G<\/strong>) along with switch (<strong>-l<\/strong>).<\/p>\n<pre># ls -Gl\r\n<\/pre>\n<div id=\"attachment_11772\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Files-Without-Printing-Group.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11772\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Files-Without-Printing-Group.gif\" alt=\"List Files Without Printing Group\" aria-describedby=\"caption-attachment-11772\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11772\" class=\"wp-caption-text\">List Files Without Printing Group<\/p>\n<\/div>\n<h6>2. Print the size of files and folders in the current directory, in human readable format. How will you do this?<\/h6>\n<p>Well we need to use switch\u00a0<strong>-h<\/strong>\u00a0(human-readable) along with switch (<strong>-l<\/strong>) and\/or (<strong>-s<\/strong>) with the command ls to get the desired output.<\/p>\n<pre># ls -hl\r\n<\/pre>\n<div id=\"attachment_11773\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Size-of-Files-with-ls.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11773\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Size-of-Files-with-ls.gif\" alt=\"List Files in Human Readable Format\" aria-describedby=\"caption-attachment-11773\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11773\" class=\"wp-caption-text\">List Files in Human Readable Format<\/p>\n<\/div>\n<pre># ls -hs\r\n<\/pre>\n<div id=\"attachment_11774\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-File-Sizes-in-Readable-Format.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11774\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-File-Sizes-in-Readable-Format.gif\" alt=\"List File Sizes in Long List Format\" aria-describedby=\"caption-attachment-11774\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11774\" class=\"wp-caption-text\">List File Sizes in Long List Format<\/p>\n<\/div>\n<p><strong>Note<\/strong>: The option\u00a0<strong>-h<\/strong>\u00a0uses the power of\u00a0<strong>1024<\/strong>\u00a0(standard in computation) and output the size of files and folders in the units of\u00a0<strong>K<\/strong>,\u00a0<strong>M<\/strong>\u00a0and\u00a0<strong>G<\/strong>.<\/p>\n<h6>3. Well if switch (-h) output size in power of 1024, that is standard, What else power values are supported in ls command?<\/h6>\n<p>There exist a switch\u00a0<strong>-si<\/strong>\u00a0which is similar to switch\u00a0<strong>-h<\/strong>. The only difference is switch\u00a0<strong>-si<\/strong>\u00a0uses power of 1000 unlike switch\u00a0<strong>-h<\/strong>\u00a0which uses the power of 1024.<\/p>\n<pre># ls -si\r\n<\/pre>\n<div id=\"attachment_11775\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/ls-supported-power-values.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11775\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/ls-supported-power-values.gif\" alt=\"Supported Power Values of ls Command\" aria-describedby=\"caption-attachment-11775\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11775\" class=\"wp-caption-text\">Supported Power Values of ls Command<\/p>\n<\/div>\n<p>It can also be used with switch\u00a0<strong>-l<\/strong>\u00a0to output the size of folder in the power of 1000, in long listing format.<\/p>\n<pre># ls -si -l\r\n<\/pre>\n<div id=\"attachment_11776\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Files-by-Power-Values.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11776\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Files-by-Power-Values.gif\" alt=\"List Files by Power Values\" aria-describedby=\"caption-attachment-11776\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11776\" class=\"wp-caption-text\">List Files by Power Values<\/p>\n<\/div>\n<h6>4. You are supposed to print the contents of a directory separated with comma. Is it possible? Can it be done in long listing format?<\/h6>\n<p>Yup! Linux\u00a0<strong>ls command<\/strong>\u00a0can output the contents of a directory separated by comma when used with the switch (<strong>-m<\/strong>). Since this comma separated entries are filled horizontally, ls command can\u2019t separate contents with comma when listing contents vertically.<\/p>\n<pre># ls -m\r\n<\/pre>\n<div id=\"attachment_11777\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Print-Contents-of-Directory-by-Comma.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11777\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Print-Contents-of-Directory-by-Comma.gif\" alt=\"Print Contents of Directory by Comma\" aria-describedby=\"caption-attachment-11777\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11777\" class=\"wp-caption-text\">Print Contents of Directory by Comma<\/p>\n<\/div>\n<p>When used in long listing format, switch\u00a0<strong>-m<\/strong>\u00a0gets useless.<\/p>\n<pre># ls -ml\r\n<\/pre>\n<div id=\"attachment_11778\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Listing-Content-Horizentally.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11778\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Listing-Content-Horizentally.gif\" alt=\"Listing Content Horizontally\" aria-describedby=\"caption-attachment-11778\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11778\" class=\"wp-caption-text\">Listing Content Horizontally<\/p>\n<\/div>\n<h6>5. If there any way to print the contents of a directory upside down? i.e., in reverse order.<\/h6>\n<p>Yeah! The above situation can easily be achieved using the switch\u00a0<strong>-r<\/strong>. The switch \u2018<strong>-r<\/strong>\u2018 reverse the order of output. It can also be used with switch\u00a0<strong>-l<\/strong>\u00a0(long listing format).<\/p>\n<pre># ls -r\r\n<\/pre>\n<div id=\"attachment_11779\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Content-in-Reverse-Order.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11779\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Content-in-Reverse-Order.gif\" alt=\"List Content in Reverse Order\" aria-describedby=\"caption-attachment-11779\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11779\" class=\"wp-caption-text\">List Content in Reverse Order<\/p>\n<\/div>\n<pre># ls -rl\r\n<\/pre>\n<div id=\"attachment_11780\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Long-List-Content-in-Reverse-Order.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11780\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Long-List-Content-in-Reverse-Order.gif\" alt=\"Long List Content in Reverse Order\" aria-describedby=\"caption-attachment-11780\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11780\" class=\"wp-caption-text\">Long List Content in Reverse Order<\/p>\n<\/div>\n<h6>6. You are given a situation to print the sub-directories recursively. How will you achieve this situation? Mind it only sub directories and no files.<\/h6>\n<p>Okay! That is pretty easy with the switch\u00a0<strong>-R<\/strong>\u00a0when used with command ls. It can further be grouped with other options like\u00a0<strong>-l<\/strong>\u00a0(long list) and\u00a0<strong>-m<\/strong>\u00a0(comma separated), etc.<\/p>\n<pre># ls -R\r\n<\/pre>\n<div id=\"attachment_11784\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Print-Sub-Directories-in-Recursively.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11784\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Print-Sub-Directories-in-Recursively.gif\" alt=\"Print Sub Directories in Recursively\" aria-describedby=\"caption-attachment-11784\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11784\" class=\"wp-caption-text\">Print Sub Directories in Recursively<\/p>\n<\/div>\n<h6>7. How to sort the files based upon the size?<\/h6>\n<p>The Linux command line option\u00a0<strong>-S<\/strong>\u00a0when used with ls gives the desired output. To sort the files based upon size in descending order with the largest file listed at first and smallest at last.<\/p>\n<pre># ls -S\r\n<\/pre>\n<div id=\"attachment_11785\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Sort-Files-in-Linux.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11785\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Sort-Files-in-Linux.gif\" alt=\"Sort Files in Linux\" aria-describedby=\"caption-attachment-11785\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11785\" class=\"wp-caption-text\">Sort Files with ls Command<\/p>\n<\/div>\n<p>To sort the files based upon size in descending order with the smallest file listed at first and largest at last.<\/p>\n<pre># ls -Sr\r\n<\/pre>\n<div id=\"attachment_11786\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Sort-Files-in-Descending-Order.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11786\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Sort-Files-in-Descending-Order.gif\" alt=\"Sort Files in Descending Order\" aria-describedby=\"caption-attachment-11786\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11786\" class=\"wp-caption-text\">Sort Files in Descending Order<\/p>\n<\/div>\n<h6>8. List the contents of a directory with no additional information appearing one file per line.<\/h6>\n<p>The switch\u00a0<strong>-1<\/strong>\u00a0comes to rescue here. ls command with switch\u00a0<strong>-1<\/strong>\u00a0output the contents of the directory with one file per line and no additional information.<\/p>\n<pre># ls -1\r\n<\/pre>\n<div id=\"attachment_11787\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Files-Without-Information.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11787\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/List-Files-Without-Information.gif\" alt=\"List Files Without Information\" aria-describedby=\"caption-attachment-11787\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11787\" class=\"wp-caption-text\">List Files Without Information<\/p>\n<\/div>\n<h6>9. You are given a situation in which you have to print the contents of a directory on standard output enclosed by double quotes. How will you do this?<\/h6>\n<p>There exist an option\u00a0<strong>-Q<\/strong>\u00a0(quote-name) which output the content of ls enclosed in double quotes.<\/p>\n<pre># ls -Q\r\n<\/pre>\n<div id=\"attachment_11788\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Print-Files-with-Double-Quotes.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11788\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Print-Files-with-Double-Quotes.gif\" alt=\"Print Files with Double Quotes\" aria-describedby=\"caption-attachment-11788\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11788\" class=\"wp-caption-text\">Print Files with Double Quotes<\/p>\n<\/div>\n<h6>10. You are working in a directory which contains lots of files and folders. You need to print the name of folders before directories. How will you get this?<\/h6>\n<pre># ls --group-directories-first\r\n<\/pre>\n<div id=\"attachment_11789\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Print-Directories-First.gif\"><img decoding=\"async\" class=\"size-medium wp-image-11789\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/03\/Print-Directories-First.gif\" alt=\"Print Directories First\" aria-describedby=\"caption-attachment-11789\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-11789\" class=\"wp-caption-text\">Print Directories First<\/p>\n<\/div>\n<p>That\u2019s all for now. We will be coming up with the next part of this article series about\u00a0<a href=\"https:\/\/www.tecmint.com\/linux-ls-command-tricks\/\" target=\"_blank\" rel=\"noopener\">Quirky \u2018ls\u2019 Command Tricks<\/a>.<\/p>\n<h1 class=\"post-title\">Nishita Agarwal Shares Her Interview Experience on Linux \u2018iptables\u2019 Firewall<\/h1>\n<p><strong>Nishita Agarwal<\/strong>, a frequent\u00a0<strong>Tecmint Visitor<\/strong>\u00a0shared her experience (Question and Answer) with us regarding the job interview she had just given in a privately owned hosting company in\u00a0<strong>Pune<\/strong>,\u00a0<strong>India<\/strong>. She was asked a lot of questions on a variety of topics however she is an expert in\u00a0<strong>iptables<\/strong>\u00a0and she wanted to share those questions and their answer (she gave) related to iptables to others who may be going to give interview in near future.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/05\/Linux-iptables-Interview-Questions.jpg\"><img decoding=\"async\" class=\"size-medium wp-image-13460\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/05\/Linux-iptables-Interview-Questions.jpg\" sizes=\"(max-width: 720px) 100vw, 720px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/05\/Linux-iptables-Interview-Questions.jpg 720w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/05\/Linux-iptables-Interview-Questions-620x297.jpg 620w\" alt=\"Linux Firewall Iptables Interview Questions\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p>All the questions and their Answer are rewritten based upon the memory of\u00a0<strong>Nishita Agarwal<\/strong>.<\/p>\n<blockquote><p>\u201cHello Friends! My name is\u00a0<strong>Nishita Agarwal<\/strong>. I have Pursued Bachelor Degree in Technology. My area of Specialization is UNIX and Variants of UNIX (BSD, Linux) fascinates me since the time I heard it. I have 1+ years of experience in storage. I was looking for a job change which ended with a hosting company in Pune, India.\u201d<\/p><\/blockquote>\n<p>Here is the collection of what I was asked during the Interview. I\u2019ve documented only those questions and their answer that were related to iptables based upon my memory. Hope this will help you in cracking your Interview.<\/p>\n<h6>1. Have you heard of iptables and firewall in Linux? Any idea of what they are and for what it is used?<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0I\u2019ve been using iptables for quite long time and I am aware of both iptables and firewall. Iptables is an application program mostly written in C Programming Language and is released under GNU General Public License. Written for System administration point of view, the latest stable release if iptables\u00a0<strong>1.4.21<\/strong>.iptables may be considered as firewall for UNIX like operating system which can be called as\u00a0<strong>iptables<\/strong>\/<strong>netfilter<\/strong>, more accurately. The Administrator interact with iptables via console\/GUI front end tools to add and define firewall rules into predefined tables. Netfilter is a module built inside of kernel that do the job of filtering.<\/p>\n<p><strong>Firewalld<\/strong>\u00a0is the latest implementation of filtering rules in\u00a0<strong>RHEL<\/strong>\/<strong>CentOS 7<\/strong>\u00a0(may be implemented in other distributions which I may not be aware of). It has replaced iptables interface and connects to netfilter.<\/p>\n<\/div>\n<h6>2. Have you used some kind of GUI based front end tool for iptables or the Linux Command Line?<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0Though I have used both the GUI based front end tools for iptables like\u00a0<a href=\"https:\/\/www.tecmint.com\/shorewall-a-high-level-firewall-for-configuring-linux-servers\/\">Shorewall<\/a>\u00a0in conjugation of\u00a0<a href=\"https:\/\/www.tecmint.com\/install-webmin-web-based-system-administration-tool-for-rhel-centos-fedora\/\">Webmin<\/a>\u00a0in GUI and Direct access to iptables via console.And I must admit that direct access to iptables via Linux console gives a user immense power in the form of higher degree of flexibility and better understanding of what is going on in the background, if not anything other. GUI is for novice administrator while console is for experienced.<\/p>\n<\/div>\n<h6>3. What are the basic differences between between iptables and firewalld?<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0iptables and firewalld serves the same purpose (<strong>Packet Filtering<\/strong>) but with different approach. iptables flush the entire rules set each time a change is made unlike firewalld. Typically the location of iptables configuration lies at \u2018<strong>\/etc\/sysconfig\/iptables<\/strong>\u2018 whereas firewalld configuration lies at \u2018<strong>\/etc\/firewalld\/<\/strong>\u2018, which is a set of XML files.Configuring a XML based firewalld is easier as compared to configuration of iptables, however same task can be achieved using both the packet filtering application ie., iptables and firewalld. Firewalld runs iptables under its hood along with it\u2019s own command line interface and configuration file that is XML based and said above.<\/p>\n<\/div>\n<h6>4. Would you replace iptables with firewalld on all your servers, if given a chance?<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0I am familiar with iptables and it\u2019s working and if there is nothing that requires dynamic aspect of firewalld, there seems no reason to migrate all my configuration from iptables to firewalld.In most of the cases, so far I have never seen iptables creating an issue. Also the general rule of Information technology says \u201cwhy fix if it is not broken\u201d. However this is my personal thought and I would never mind implementing firewalld if the Organization is going to replace iptables with firewalld.<\/p>\n<\/div>\n<h6>5. You seems confident with iptables and the plus point is even we are using iptables on our server.<\/h6>\n<p>What are the tables used in iptables? Give a brief description of the tables used in iptables and the chains they support.<\/p>\n<div>\n<p><strong>Answer :<\/strong>\u00a0Thanks for the recognition. Moving to question part, There are four tables used in iptables, namely they are:<\/p>\n<ol>\n<li>Nat Table<\/li>\n<li>Mangle Table<\/li>\n<li>Filter Table<\/li>\n<li>Raw Table<\/li>\n<\/ol>\n<p><strong>Nat Table<\/strong>\u00a0: Nat table is primarily used for Network Address Translation. Masqueraded packets get their IP address altered as per the rules in the table. Packets in the stream traverse Nat Table only once. ie., If a packet from a jet of Packets is masqueraded they rest of the packages in the stream will not traverse through this table again. It is recommended not to filter in this table. Chains Supported by NAT Table are PREROUTING Chain, POSTROUTING Chain and OUTPUT Chain.<\/p>\n<p><strong>Mangle Table<\/strong>\u00a0: As the name suggests, this table serves for mangling the packets. It is used for Special package alteration. It can be used to alter the content of different packets and their headers. Mangle table can\u2019t be used for Masquerading. Supported chains are PREROUTING Chain, OUTPUT Chain, Forward Chain, INPUT Chain, POSTROUTING Chain.<\/p>\n<p><strong>Filter Table<\/strong>\u00a0: Filter Table is the default table used in iptables. It is used for filtering Packets. If no rules are defined, Filter Table is taken as default table and filtering is done on the basis of this table. Supported Chains are INPUT Chain, OUTPUT Chain, FORWARD Chain.<\/p>\n<p><strong>Raw Table<\/strong>\u00a0: Raw table comes into action when we want to configure packages that were exempted earlier. It supports PREROUTING Chain and OUTPUT Chain.<\/p>\n<\/div>\n<h6>6. What are the target values (that can be specified in target) in iptables and what they do, be brief!<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0Following are the target values that we can specify in target in iptables:<\/p>\n<ol>\n<li>\n<ol>\n<li><strong>ACCEPT<\/strong>\u00a0: Accept Packets<\/li>\n<li><strong>QUEUE<\/strong>\u00a0: Paas Package to user space (place where application and drivers reside)<\/li>\n<li><strong>DROP<\/strong>\u00a0: Drop Packets<\/li>\n<li><strong>RETURN<\/strong>\u00a0: Return Control to calling chain and stop executing next set of rules for the current Packets in the chain.<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<\/div>\n<h6>7. Lets move to the technical aspects of iptables, by technical I means practical.<\/h6>\n<p>How will you Check iptables rpm that is required to install iptables in CentOS?.<\/p>\n<div>\n<p><strong>Answer :<\/strong>\u00a0iptables rpm are included in standard CentOS installation and we do not need to install it separately. We can check the rpm as:<\/p>\n<pre># rpm -qa iptables\r\n\r\niptables-1.4.21-13.el7.x86_64\r\n<\/pre>\n<p>If you need to install it, you may do yum to get it.<\/p>\n<pre># yum install iptables-services\r\n<\/pre>\n<\/div>\n<h6>8. How to Check and ensure if iptables service is running?<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0To check the status of iptables, you may run the following command on the terminal.<\/p>\n<pre># service iptables status\t\t\t[On <strong>CentOS 6\/5<\/strong>]\r\n# systemctl status iptables\t\t\t[On <strong>CentOS 7<\/strong>]\r\n<\/pre>\n<p>If it is not running, the below command may be executed.<\/p>\n<pre>---------------- <strong>On CentOS 6\/5<\/strong> ---------------- \r\n# chkconfig --level 35 iptables on\r\n# service iptables start\r\n\r\n---------------- <strong>On CentOS 7<\/strong> ---------------- \r\n# systemctl enable iptables \r\n# systemctl start iptables \r\n<\/pre>\n<p>We may also check if the iptables module is loaded or not, as:<\/p>\n<pre># lsmod | grep ip_tables\r\n<\/pre>\n<\/div>\n<h6>9. How will you review the current Rules defined in iptables?<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0The current rules in iptables can be review as simple as:<\/p>\n<pre># iptables -L\r\n<\/pre>\n<p><strong>Sample Output<\/strong><\/p>\n<pre>Chain INPUT (policy ACCEPT)\r\ntarget     prot opt source               destination         \r\nACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED\r\nACCEPT     icmp --  anywhere             anywhere            \r\nACCEPT     all  --  anywhere             anywhere            \r\nACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:ssh\r\nREJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited\r\n\r\nChain FORWARD (policy ACCEPT)\r\ntarget     prot opt source               destination         \r\nREJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited\r\n\r\nChain OUTPUT (policy ACCEPT)\r\ntarget     prot opt source               destination\r\n<\/pre>\n<\/div>\n<h6>10. How will you flush all iptables rules or a particular chain?<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0To flush a particular iptables chain, you may use following commands.<\/p>\n<pre> \r\n# iptables --flush OUTPUT\r\n<\/pre>\n<p>To Flush all the iptables rules.<\/p>\n<pre># iptables --flush\r\n<\/pre>\n<\/div>\n<h6>11. Add a rule in iptables to accept packets from a trusted IP Address (say 192.168.0.7)<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0The above scenario can be achieved simply by running the below command.<\/p>\n<pre># iptables -A INPUT -s 192.168.0.7 -j ACCEPT \r\n<\/pre>\n<p>We may include standard slash or subnet mask in the source as:<\/p>\n<pre># iptables -A INPUT -s 192.168.0.7\/24 -j ACCEPT \r\n# iptables -A INPUT -s 192.168.0.7\/255.255.255.0 -j ACCEPT\r\n<\/pre>\n<\/div>\n<h6>12. How to add rules to ACCEPT, REJECT, DENY and DROP ssh service in iptables.<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0Hoping ssh is running on port 22, which is also the default port for ssh, we can add rule to iptables as:<\/p>\n<p>To\u00a0<strong>ACCEPT<\/strong>\u00a0tcp packets for ssh service (port 22).<\/p>\n<pre># iptables -A INPUT -s -p tcp --dport 22 -j ACCEPT \r\n<\/pre>\n<p>To\u00a0<strong>REJECT<\/strong>\u00a0tcp packets for ssh service (port 22).<\/p>\n<pre># iptables -A INPUT -s -p tcp --dport 22 -j REJECT\r\n<\/pre>\n<p>To\u00a0<strong>DENY<\/strong>\u00a0tcp packets for ssh service (port 22).<\/p>\n<pre> \r\n# iptables -A INPUT -s -p tcp --dport 22 -j DENY\r\n<\/pre>\n<p>To\u00a0<strong>DROP<\/strong>\u00a0tcp packets for ssh service (port 22).<\/p>\n<pre> \r\n# iptables -A INPUT -s -p tcp --dport 22 -j DROP\r\n<\/pre>\n<\/div>\n<h6>13. Let me give you a scenario. Say there is a machine the local ip address of which is 192.168.0.6. You need to block connections on port 21, 22, 23, and 80 to your machine. What will you do?<\/h6>\n<div>\n<p><strong>Answer :<\/strong>\u00a0Well all I need to use is the \u2018<strong>multiport<\/strong>\u2018 option with iptables followed by port numbers to be blocked and the above scenario can be achieved in a single go as.<\/p>\n<pre># iptables -A INPUT -s 192.168.0.6 -p tcp -m multiport --dport 21,22,23,80 -j DROP\r\n<\/pre>\n<p>The written rules can be checked using the below command.<\/p>\n<pre># iptables -L\r\n\r\nChain INPUT (policy ACCEPT)\r\ntarget     prot opt source               destination         \r\nACCEPT     all  --  anywhere             anywhere             state RELATED,ESTABLISHED\r\nACCEPT     icmp --  anywhere             anywhere            \r\nACCEPT     all  --  anywhere             anywhere            \r\nACCEPT     tcp  --  anywhere             anywhere             state NEW tcp dpt:ssh\r\nREJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited\r\nDROP       tcp  --  192.168.0.6          anywhere             multiport dports ssh,telnet,http,webcache\r\n\r\nChain FORWARD (policy ACCEPT)\r\ntarget     prot opt source               destination         \r\nREJECT     all  --  anywhere             anywhere             reject-with icmp-host-prohibited\r\n\r\nChain OUTPUT (policy ACCEPT)\r\ntarget     prot opt source               destination\r\n<\/pre>\n<\/div>\n<p><strong>Interviewer<\/strong>\u00a0: That\u2019s all I wanted to ask. You are a valuable employee we won\u2019t like to miss. I will recommend your name to the HR. If you have any question you may ask me.<\/p>\n<p>As a candidate I don\u2019t wanted to kill the conversation hence keep asking about the projects I would be handling if selected and what are the other openings in the company. Not to mention HR round was not difficult to crack and I got the opportunity.<\/p>\n<h1 class=\"post-title\">Shilpa Nair Shares Her Interview Experience on RedHat Linux Package Management<\/h1>\n<p><strong>Shilpa Nair<\/strong>\u00a0has just graduated in the year 2015. She went to apply for Trainee position in a\u00a0<strong>National News Television<\/strong>\u00a0located in\u00a0<strong>Noida, Delhi<\/strong>. When she was in the last year of graduation and searching for help on her assignments she came across Tecmint. Since then she has been visiting Tecmint regularly.<\/p>\n<div id=\"attachment_14312\" class=\"wp-caption aligncenter\">\n<p><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/06\/Linux-Interview-Questions-on-RPM.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-14312\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/06\/Linux-Interview-Questions-on-RPM-620x297.jpeg\" sizes=\"auto, (max-width: 620px) 100vw, 620px\" srcset=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/06\/Linux-Interview-Questions-on-RPM-620x297.jpeg 620w, https:\/\/www.tecmint.com\/wp-content\/uploads\/2015\/06\/Linux-Interview-Questions-on-RPM.jpeg 720w\" alt=\"Linux Interview Questions on RPM\" width=\"620\" height=\"297\" aria-describedby=\"caption-attachment-14312\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p id=\"caption-attachment-14312\" class=\"wp-caption-text\">Linux Interview Questions on RPM<\/p>\n<\/div>\n<p>All the questions and answers are rewritten based upon the memory of\u00a0<strong>Shilpa Nair<\/strong>.<\/p>\n<blockquote><p>\u201cHi friends! I am Shilpa Nair from Delhi. I have completed my graduation very recently and was hunting for a Trainee role soon after my degree. I have developed a passion for UNIX since my early days in the collage and I was looking for a role that suits me and satisfies my soul. I was asked a lots of questions and most of them were basic questions related to RedHat Package Management.\u201d<\/p><\/blockquote>\n<p>Here are the questions, that I was asked and their corresponding answers. I am posting only those questions that are related to RedHat GNU\/Linux Package Management, as they were mainly asked.<\/p>\n<h6>1. How will you find if a package is installed or not? Say you have to find if \u2018nano\u2019 is installed or not, what will you do?<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>To find the package nano, weather installed or not, we can use rpm command with the option\u00a0<strong>-q<\/strong>\u00a0is for query and\u00a0<strong>-a<\/strong>\u00a0stands for all the installed packages.<\/p>\n<pre># rpm -qa nano\r\nOR\r\n# rpm -qa | grep -i nano\r\n\r\n<strong>nano-2.3.1-10.el7.x86_64<\/strong>\r\n<\/pre>\n<p>Also the package name must be complete, an incomplete package name will return the prompt without printing anything which means that package (incomplete package name) is not installed. It can be understood easily by the example below:<\/p>\n<p>We generally substitute\u00a0<strong>vim<\/strong>\u00a0command with\u00a0<strong>vi<\/strong>. But if we find package vi\/vim we will get no result on the standard output.<\/p>\n<pre># vi\r\n# vim\r\n<\/pre>\n<p>However we can clearly see that the package is installed by firing vi\/vim command. Here is culprit is incomplete file name. If we are not sure of the exact file-name we can use wildcard as:<\/p>\n<pre># rpm -qa vim*\r\n\r\n<strong>vim-minimal-7.4.160-1.el7.x86_64<\/strong>\r\n<\/pre>\n<p>This way we can find information about any package, if installed or not.<\/p>\n<\/div>\n<h6>2. How will you install a package XYZ using rpm?<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>We can install any package (*.rpm) using rpm command a shown below, here options\u00a0<strong>-i<\/strong>\u00a0(install),\u00a0<strong>-v<\/strong>\u00a0(verbose or display additional information) and\u00a0<strong>-h<\/strong>\u00a0(print hash mark during package installation).<\/p>\n<pre># rpm -ivh peazip-1.11-1.el6.rf.x86_64.rpm\r\n\r\nPreparing...                          ################################# [100%]\r\nUpdating \/ installing...\r\n   1:peazip-1.11-1.el6.rf             ################################# [100%]\r\n<\/pre>\n<p>If upgrading a package from earlier version\u00a0<strong>-U<\/strong>\u00a0switch should be used, option\u00a0<strong>-v<\/strong>\u00a0and -h follows to make sure we get a verbose output along with hash Mark, that makes it readable.<\/p>\n<\/div>\n<h6>3. You have installed a package (say httpd) and now you want to see all the files and directories installed and created by the above package. What will you do?<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>We can list all the files (Linux treat everything as file including directories) installed by the package httpd using options\u00a0<strong>-l<\/strong>\u00a0(List all the files) and\u00a0<strong>-q<\/strong>\u00a0(is for query).<\/p>\n<pre># rpm -ql httpd\r\n\r\n\/etc\/httpd\r\n\/etc\/httpd\/conf\r\n\/etc\/httpd\/conf.d\r\n...\r\n<\/pre>\n<\/div>\n<h6>4. You are supposed to remove a package say postfix. What will you do?<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>First we need to know postfix was installed by what package. Find the package name that installed postfix using options\u00a0<strong>-e<\/strong>\u00a0erase\/uninstall a package) and \u2013<strong>v<\/strong>\u00a0(verbose output).<\/p>\n<pre># rpm -qa postfix*\r\n\r\npostfix-2.10.1-6.el7.x86_64\r\n<\/pre>\n<p>and then remove postfix as:<\/p>\n<pre># rpm -ev postfix-2.10.1-6.el7.x86_64\r\n\r\nPreparing packages...\r\npostfix-2:3.0.1-2.fc22.x86_64\r\n<\/pre>\n<\/div>\n<h6>5. Get detailed information about an installed package, means information like Version, Release, Install Date, Size, Summary and a brief description.<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>We can get detailed information about an installed package by using option\u00a0<strong>-qa<\/strong>\u00a0with rpm followed by package name.<\/p>\n<p>For example to find details of package openssh, all I need to do is:<\/p>\n<pre># rpm -qa openssh\r\n\r\n[root@tecmint tecmint]# rpm -qi openssh\r\nName        : openssh\r\nVersion     : 6.8p1\r\nRelease     : 5.fc22\r\nArchitecture: x86_64\r\nInstall Date: Thursday 28 May 2015 12:34:50 PM IST\r\nGroup       : Applications\/Internet\r\nSize        : 1542057\r\nLicense     : BSD\r\n....<\/pre>\n<h6>6. You are not sure about what are the configuration files provided by a specific package say httpd. How will you find list of all the configuration files provided by httpd and their location.<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>We need to run option\u00a0<strong>-c<\/strong>\u00a0followed by package name with rpm command and it will list the name of all the configuration file and their location.<\/p>\n<pre># rpm -qc httpd\r\n\r\n\/etc\/httpd\/conf.d\/autoindex.conf\r\n\/etc\/httpd\/conf.d\/userdir.conf\r\n\/etc\/httpd\/conf.d\/welcome.conf\r\n\/etc\/httpd\/conf.modules.d\/00-base.conf\r\n\/etc\/httpd\/conf\/httpd.conf\r\n\/etc\/sysconfig\/httpd\r\n<\/pre>\n<p>Similarly we can list all the associated document files as:<\/p>\n<pre># rpm -qd httpd\r\n\r\n\/usr\/share\/doc\/httpd\/ABOUT_APACHE\r\n\/usr\/share\/doc\/httpd\/CHANGES\r\n\/usr\/share\/doc\/httpd\/LICENSE\r\n...\r\n<\/pre>\n<p>also, we can list the associated License file as:<\/p>\n<pre># rpm -qL openssh\r\n\r\n\/usr\/share\/licenses\/openssh\/LICENCE\r\n<\/pre>\n<p>Not to mention that the option\u00a0<strong>-d<\/strong>\u00a0and option\u00a0<strong>-L<\/strong>\u00a0in the above command stands for \u2018<strong>documents<\/strong>\u2018 and \u2018<strong>License<\/strong>\u2018, respectively.<\/p>\n<\/div>\n<h6>7. You came across a configuration file located at \u2018\/usr\/share\/alsa\/cards\/AACI.conf\u2019 and you are not sure this configuration file is associated with what package. How will you find out the parent package name?<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>When a package is installed, the relevant information gets stored in the database. So it is easy to trace what provides the above package using option\u00a0<strong>-qf<\/strong>\u00a0(<strong>-f<\/strong>\u00a0query packages owning files).<\/p>\n<pre># rpm -qf \/usr\/share\/alsa\/cards\/AACI.conf\r\nalsa-lib-1.0.28-2.el7.x86_64\r\n<\/pre>\n<p>Similarly we can find (what provides) information about any sub-packge, document files and License files.<\/p>\n<\/div>\n<h6>8. How will you find list of recently installed software\u2019s using rpm?<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>As said earlier, everything being installed is logged in database. So it is not difficult to query the rpm database and find the list of recently installed software\u2019s.<\/p>\n<p>We can do this by running the below commands using option\u00a0<strong>\u2013last<\/strong>\u00a0(prints the most recent installed software\u2019s).<\/p>\n<pre># rpm -qa --last\r\n<\/pre>\n<p>The above command will print all the packages installed in a order such that, the last installed software appears at the top.<\/p>\n<p>If our concern is to find out specific package, we can grep that package (say\u00a0<strong>sqlite<\/strong>) from the list, simply as:<\/p>\n<pre># rpm -qa --last | grep -i sqlite\r\n\r\nsqlite-3.8.10.2-1.fc22.x86_64                 Thursday 18 June 2015 05:05:43 PM IST\r\n<\/pre>\n<p>We can also get a list of 10 most recently installed software simply as:<\/p>\n<pre># rpm -qa --last | head\r\n<\/pre>\n<p>We can refine the result to output a more custom result simply as:<\/p>\n<pre># rpm -qa --last | head -n 2\r\n<\/pre>\n<p>In the above command\u00a0<strong>-n<\/strong>\u00a0represents number followed by a numeric value. The above command prints a list of 2 most recent installed software.<\/p>\n<\/div>\n<h6>9. Before installing a package, you are supposed to check its dependencies. What will you do?<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>To check the dependencies of a rpm package (<strong>XYZ.rpm<\/strong>), we can use switches\u00a0<strong>-q<\/strong>\u00a0(query package),\u00a0<strong>-p<\/strong>\u00a0(query a package file) and\u00a0<strong>-R<\/strong>\u00a0(Requires \/ List packages on which this package depends i.e., dependencies).<\/p>\n<pre># rpm -qpR gedit-3.16.1-1.fc22.i686.rpm \r\n\r\n\/bin\/sh\r\n\/usr\/bin\/env\r\nglib2(x86-32) &gt;= 2.40.0\r\ngsettings-desktop-schemas\r\ngtk3(x86-32) &gt;= 3.16\r\ngtksourceview3(x86-32) &gt;= 3.16\r\ngvfs\r\nlibX11.so.6\r\n...<\/pre>\n<\/div>\n<h6>10. Is rpm a front-end Package Management Tool?<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong><strong>No!<\/strong>\u00a0rpm is a back-end package management for RPM based Linux Distribution.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/20-linux-yum-yellowdog-updater-modified-commands-for-package-mangement\/\" target=\"_blank\" rel=\"noopener\">YUM<\/a>\u00a0which stands for\u00a0<strong>Yellowdog Updater Modified<\/strong>\u00a0is the front-end for rpm. YUM automates the overall process of resolving dependencies and everything else.<\/p>\n<p>Very recently\u00a0<a href=\"https:\/\/www.tecmint.com\/dnf-commands-for-fedora-rpm-package-management\/\" target=\"_blank\" rel=\"noopener\">DNF<\/a>\u00a0(<strong>Dandified YUM<\/strong>) replaced YUM in Fedora 22. Though YUM is still available to be used in RHEL and CentOS, we can install dnf and use it alongside of YUM. DNF is said to have a lots of improvement over YUM.<\/p>\n<p>Good to know, you keep yourself updated. Lets move to the front-end part.<\/p>\n<h6>11. How will you list all the enabled repolist on a system.<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>We can list all the enabled repos on a system simply using following commands.<\/p>\n<pre><strong># yum repolist<\/strong>\r\nor\r\n<strong># dnf repolist<\/strong>\r\n\r\nLast metadata expiration check performed 0:30:03 ago on Mon Jun 22 16:50:00 2015.\r\nrepo id                                                                           repo name                                                                                             status\r\n*fedora                                                                           Fedora 22 - x86_64                                                                                    44,762\r\nozonos                                                                            Repository for Ozon OS                                                                                    61\r\n*updates                                                                          Fedora 22 - x86_64 - Updates   \r\n<\/pre>\n<p>The above command will only list those repos that are enabled. If we need to list all the repos, enabled or not, we can do.<\/p>\n<pre><strong># yum repolist all<\/strong>\r\nor\r\n<strong># dnf repolist all<\/strong>\r\n\r\nLast metadata expiration check performed 0:29:45 ago on Mon Jun 22 16:50:00 2015.\r\nrepo id                                                                         repo name                                                                                      status\r\n*fedora                                                                         Fedora 22 - x86_64                                                                             enabled: 44,762\r\nfedora-debuginfo                                                                Fedora 22 - x86_64 - Debug                                                                     disabled\r\nfedora-source                                                                   Fedora 22 - Source                                                                             disabled\r\nozonos                                                                          Repository for Ozon OS                                                                         enabled:     61\r\n*updates                                                                        Fedora 22 - x86_64 - Updates                                                                   enabled:  5,018\r\nupdates-debuginfo                                                               Fedora 22 - x86_64 - Updates - Debug<\/pre>\n<\/div>\n<h6>12. How will you list all the available and installed packages on a system?<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>To list all the available packages on a system, we can do:<\/p>\n<pre><strong># yum list available<\/strong>\r\nor\r\n<strong># dnf list available<\/strong>\r\n\r\nast metadata expiration check performed 0:34:09 ago on Mon Jun 22 16:50:00 2015.\r\nAvailable Packages\r\n0ad.x86_64                               0.0.18-1.fc22                   fedora \r\n0ad-data.noarch                          0.0.18-1.fc22                   fedora \r\n0install.x86_64                          2.6.1-2.fc21                    fedora \r\n0xFFFF.x86_64                            0.3.9-11.fc22                   fedora \r\n2048-cli.x86_64                          0.9-4.git20141214.723738c.fc22  fedora \r\n2048-cli-nocurses.x86_64                 0.9-4.git20141214.723738c.fc22  fedora \r\n....\r\n<\/pre>\n<p>To list all the installed Packages on a system, we can do.<\/p>\n<pre><strong># yum list installed<\/strong>\r\nor\r\n<strong># dnf list installed<\/strong>\r\n\r\nLast metadata expiration check performed 0:34:30 ago on Mon Jun 22 16:50:00 2015.\r\nInstalled Packages\r\nGeoIP.x86_64                            1.6.5-1.fc22                     @System\r\nGeoIP-GeoLite-data.noarch               2015.05-1.fc22                   @System\r\nNetworkManager.x86_64                   1:1.0.2-1.fc22                   @System\r\nNetworkManager-libnm.x86_64             1:1.0.2-1.fc22                   @System\r\naajohan-comfortaa-fonts.noarch          2.004-4.fc22                     @System\r\n....\r\n<\/pre>\n<p><center><ins class=\"adsbygoogle\" data-ad-client=\"ca-pub-2601749019656699\" data-ad-slot=\"5590002574\" data-ad-format=\"auto\" data-adsbygoogle-status=\"done\"><ins id=\"aswift_4_expand\"><ins id=\"aswift_4_anchor\"><iframe id=\"aswift_4\" name=\"aswift_4\" width=\"758\" height=\"94\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" allowfullscreen=\"allowfullscreen\" data-mce-fragment=\"1\"><\/iframe><\/ins><\/ins><\/ins><\/center>To list all the available and installed packages on a system, we can do.<\/p>\n<pre><strong># yum list<\/strong>\r\nor\r\n<strong># dnf list<\/strong>\r\n\r\nLast metadata expiration check performed 0:32:56 ago on Mon Jun 22 16:50:00 2015.\r\nInstalled Packages\r\nGeoIP.x86_64                             1.6.5-1.fc22                    @System\r\nGeoIP-GeoLite-data.noarch                2015.05-1.fc22                  @System\r\nNetworkManager.x86_64                    1:1.0.2-1.fc22                  @System\r\nNetworkManager-libnm.x86_64              1:1.0.2-1.fc22                  @System\r\naajohan-comfortaa-fonts.noarch           2.004-4.fc22                    @System\r\nacl.x86_64                               2.2.52-7.fc22                   @System\r\n....<\/pre>\n<\/div>\n<h6>13. How will you install and update a package and a group of packages separately on a system using YUM\/DNF?<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>To Install a package (say\u00a0<strong>nano<\/strong>), we can do,<\/p>\n<pre># yum install nano\r\n<\/pre>\n<p>To Install a Group of Package (say\u00a0<strong>Haskell<\/strong>), we can do.<\/p>\n<pre><strong># yum groupinstall 'haskell'<\/strong>\r\n<\/pre>\n<p>To update a package (say\u00a0<strong>nano<\/strong>), we can do.<\/p>\n<pre><strong># yum update nano<\/strong>\r\n<\/pre>\n<p>To update a Group of Package (say Haskell), we can do.<\/p>\n<pre><strong># yum groupupdate 'haskell'<\/strong><\/pre>\n<\/div>\n<h6>14. How will you SYNC all the installed packages on a system to stable release?<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>We can sync all the packages on a system (say\u00a0<strong>CentOS<\/strong>\u00a0or\u00a0<strong>Fedora<\/strong>) to stable release as,<\/p>\n<pre><strong># yum distro-sync <\/strong>     [On <strong>CentOS\/RHEL<\/strong>]\r\nor\r\n<strong># dnf distro-sync<\/strong>      [On <strong>Fedora 20<\/strong> Onwards]<\/pre>\n<\/div>\n<p>Seems you have done a good homework before coming for the interview,Good!. Before proceeding further I just want to ask one more question.<\/p>\n<h6>15. Are you familiar with YUM local repository? Have you tried making a Local YUM repository? Let me know in brief what you will do to create a local YUM repo.<\/h6>\n<div>\n<p><strong>Answer :\u00a0<\/strong>First I would like to Thank you Sir for appreciation. Coming to question, I must admit that I am quiet familiar with Local YUM repositories and I have already implemented it for testing purpose in my local machine.<\/p>\n<p><strong>1.<\/strong>\u00a0To set up Local YUM repository, we need to install the below three packages as:<\/p>\n<pre># yum install deltarpm  python-deltarpm  createrepo\r\n<\/pre>\n<p><strong>2.<\/strong>\u00a0Create a directory (say\u00a0<strong>\/home\/$USER\/rpm<\/strong>) and copy all the RPMs from RedHat\/CentOS DVD to that folder.<\/p>\n<pre># mkdir \/home\/$USER\/rpm\r\n# cp \/path\/to\/rpm\/on\/DVD\/*.rpm \/home\/$USER\/rpm\r\n<\/pre>\n<p><strong>3.<\/strong>\u00a0Create base repository headers as.<\/p>\n<pre># createrepo -v \/home\/$USER\/rpm\r\n<\/pre>\n<p><strong>4.<\/strong>\u00a0Create the\u00a0<strong>.repo<\/strong>\u00a0file (say\u00a0<strong>abc.repo<\/strong>) at the location\u00a0<strong>\/etc\/yum.repos.d<\/strong>\u00a0simply as:<\/p>\n<pre>cd \/etc\/yum.repos.d &amp;&amp; cat &lt;&lt; EOF &gt; abc.repo\r\n[local-installation]name=yum-local\r\nbaseurl=file:\/\/\/home\/$USER\/rpm\r\nenabled=1\r\ngpgcheck=0\r\nEOF<\/pre>\n<\/div>\n<p><strong>Important<\/strong>: Make sure to remove\u00a0<strong>$USER<\/strong>\u00a0with user_name.<\/p>\n<p>That\u2019s all we need to do to create a Local YUM repository. We can now install applications from here, that is relatively fast, secure and most important don\u2019t need an Internet connection.<\/p>\n<p>Okay! It was nice interviewing you. I am done. I am going to suggest your name to\u00a0<strong>HR<\/strong>. You are a young and brilliant candidate we would like to have in our organization. If you have any question you may ask me.<\/p>\n<p><strong>Me:<\/strong>\u00a0Sir, it was really a very nice interview and I feel very lucky today, to have cracked the interview..<\/p>\n<p>Obviously it didn\u2019t end here. I asked a lots of questions like the project they are handling. What would be my role and responsibility and blah..blah..blah<\/p>\n<p>Friends, by the time all these were documented I have been called for HR round which is 3 days from now. Hope I do my best there as well. All your blessings will count.<\/p>\n<p>When we share ours experience with other, other get to know many things from us and we get to know our mistakes.<\/p>\n<p>It enhances our confidence level. If you have given any such interview recently, don\u2019t keep it to yourself. Spread it! Let all of us know that. You may use the below form to share your experience with us.<\/p>\n<p><a style=\"font-size: 1rem;\" href=\"https:\/\/www.tecmint.com\/category\/interview-questions\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/article>\n","protected":false},"excerpt":{"rendered":"<p>11 Basic Linux Interview Questions and Answers Theories apart, we are proud to announce a new section on\u00a0Tecmint, dedicated to\u00a0Linux Interview. Here we will bring to you\u00a0Linux Interview Questions\u00a0and all other aspects of Linux, which is must for a professional in this cut-throat competition world. Basic Linux Interview Questions A new article in this section &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/04\/03\/linux-interview-questions-answers\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Linux INTERVIEW QUESTIONS &#038; ANSWERS&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-13534","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13534","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=13534"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13534\/revisions"}],"predecessor-version":[{"id":13539,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/13534\/revisions\/13539"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=13534"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=13534"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=13534"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}