{"id":8764,"date":"2019-02-22T15:48:25","date_gmt":"2019-02-22T10:18:25","guid":{"rendered":"https:\/\/www.monsterindia.com\/career-advice\/top-15-frequently-asked-shell-scripting-interview-questions-8764\/"},"modified":"2023-07-21T11:02:31","modified_gmt":"2023-07-21T05:32:31","slug":"frequently-asked-shell-scripting-interview-questions","status":"publish","type":"post","link":"https:\/\/www.monster.co.th\/career-advice\/frequently-asked-shell-scripting-interview-questions\/","title":{"rendered":"Top 15 frequently asked Shell Scripting Interview Questions"},"content":{"rendered":"\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">Computers have revolutionized the way in which we interact with the world. Today we use this technology for even the most basic of our daily tasks. Charting out our weekly schedule, making grocery lists or just small reminders about a friend\u2019s anniversary.<\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">However, the way in which we interact with computers too has greatly changed. The first-generation computers were huge and operated through the input of binary code-1s and 0&#8217;s. Today, there are programs that have substituted this method of instruction input.<\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">Shell are programs that interpret your instructions written in plain English and communicate with the system kernel in order to carry out the instructions. Writing these programs, called Shell Scripting, is a sought-after job by both freshers and experienced programmers in the field. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">Here are the 15 of the most commonly asked questions for Shell Scripting that you can go through before heading for a job interview.<\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>1. What is Shell Scripting and why is it important?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">Shell acts as a link between you and the operating system, allowing you to give commands to the computer. Shell Scripting is important because you can use it to execute a sequence of commands in bulk rather than one instruction at a time. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>2. What are the most common Shell types?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">There are 4 major Shell types: Bourne Shell (sh), C Shell (csh), Korn Shell (ksh) and Bourne Again Shell (bash). <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">Of this, the (bash) type is the most frequently used. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>3. How do you begin and end execution of a Shell Script?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">You can make the script executable through the UNIX chmod command. <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">To terminate the program, you can use the \u2018fi\u2019 command. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>4. What are hard links and soft links?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">\u2018Links\u2019 are shortcuts that you can create on Linux. <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">Soft link can be kept on different file systems and are linked to the file name. Hard links, however, are linked to the inode of your file and need to be kept on the same file system as your file. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>5. What is a zombie process?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">A zombie process is a program that is no longer functional but still hasn\u2019t had its exit status picked up by the [aren\u2019t process. This way it still has its process id entry in the table. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>6. How many kernels and shells come with a UNIX OS?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">Typically, you can have about 280 shell scripts that are available with the UNIX OS, while one kernel is available in the environment. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>7. Can shell scripting be used for all situations?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">It is recommended that you avoid shell scripting in situations that require a high degree of productivity, complex writing task or when various software tools are required.<\/span><\/p>\n\n\n\n<p><strong><span style=\"font-size: 12pt\">You may also like:<\/span><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><a title=\"How to dress for a job interview: Top tips from experts\" href=\"https:\/\/www.monsterindia.com\/career-advice\/how-to-dress-for-a-job-interview-top-tips-from-experts\/\" target=\"_blank\" rel=\"noopener\">How to dress for a job interview: Top tips from experts<\/a><\/span><\/li><li><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><a title=\"Watch your moves: The importance of body language in an interview\" href=\"https:\/\/www.monsterindia.com\/career-advice\/watch-your-moves-the-importance-of-body-language-in-an-interview\/\" target=\"_blank\" rel=\"noopener\">Watch your moves: The importance of body language in an interview<\/a><\/span><\/li><\/ul>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>8. What is the default file permission and how can we modify it?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">When you create a file, its default permission is set at 666 (rw-rw-rw). <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">You can modify this setting using the command umask. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>9. What is the function of shell variables?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">You can use shell variables to store and modify data within a shell program. They are the main component of shell scripting. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>10. What are the types of shell variables in UNIX OS?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">You can use two main types of variables. <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>a. UNIX Defined or System Variables<\/strong>: These are standard variables that are defined in capital letters. <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>b. User Defined Variables<\/strong>: these are variables that you can define and are usually in lower case letters. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>11. How can you debug a shell script problem?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">You can debug your shell script in many ways. <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">One way is to insert debug statement within the script that will output data that can help you pinpoint the problem. <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">You can also use \u2018set-x\u2019 statement to help the debugging process. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>12. What is the difference in using break and continue statements?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">Within a loop script, you can use the break statement to completely terminate the entire loop. However, using the continue statement will only terminate your current iteration, while the loop script will continue on to the next iteration. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>13. What do shell scripts rely on?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">They rely on the fact that commands can be accepted from both the keyboard and the files. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>14. How can variables be manipulated?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">You can use two common commands to manipulate variables. <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">\u2018Readonly\u2019 helps you set a particular value for the variable and makes it unchangeable. <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">\u2018Unset\u2019 command can be used to erase a variable\u2019s previous value and set a new one. <\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>15. What are the types of blocks in a file system?<\/strong> <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">In a file system there are four blocks: <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>a. Boot Block<\/strong>: tells you the state of your file systems. <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>b. Super Block<\/strong>: represent the beginning of a file system. <\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>c. Inode Table<\/strong>: stores information related to files.<\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\"><strong>d. Data Block<\/strong>: contains actual files and their content.<\/span><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">Reading through the above questions should give you a good idea of what to expect during your job interview. For those of you looking to explore a little further and get a better understanding of what to expect in a job interview for programmers, check out our Top 20 most frequently asked <a title=\"Java Interview Questions\" href=\"https:\/\/www.monsterindia.com\/career-advice\/top-20-most-frequently-asked-java-interview-questions\/\" target=\"_blank\" rel=\"noopener\">Java Interview Questions<\/a> and the <a title=\"SQL Interview Questions\" href=\"https:\/\/www.monsterindia.com\/career-advice\/top-8-pl-sql-interview-questions-you-must-prepare-for-your-next-interview\/\" target=\"_blank\" rel=\"noopener\">SQL Interview Questions<\/a>. <\/span><br><strong><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">All the best!&nbsp;<\/span><\/strong><\/p>\n\n\n\n<p><strong><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">Looking for Shell Scripting Jobs in top cities? Click at the links below:<\/span><\/strong><\/p>\n\n\n\n<p><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">\u2022 <a title=\"Shell Scripting Jobs in Bengaluru\" href=\"https:\/\/www.monsterindia.com\/shell-scripting-jobs-in-bengaluru\/\" target=\"_blank\" rel=\"noopener\">Shell Scripting Jobs in Bengaluru<\/a><\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">\u2022 <a title=\"Shell Scripting Jobs in&nbsp;Pune\" href=\"https:\/\/www.monsterindia.com\/shell-scripting-jobs-in\/\" target=\"_blank\" rel=\"noopener\">Shell Scripting Jobs in&nbsp;Pune<\/a><\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">\u2022 <a title=\"Shell Scripting Jobs in Mumbai\" href=\"https:\/\/www.monsterindia.com\/shell-scripting-jobs-in\/\" target=\"_blank\" rel=\"noopener\">Shell Scripting Jobs in Mumbai<\/a><\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">\u2022 <a title=\"Shell Scripting Jobs in Hyderabad\" href=\"https:\/\/www.monsterindia.com\/shell-scripting-jobs-in-hyderabad\/\" target=\"_blank\" rel=\"noopener\">Shell Scripting Jobs in Hyderabad<\/a><\/span><br><span style=\"font-size: 12pt;font-family: verdana, geneva, sans-serif\">\u2022 <a title=\"Shell Scripting Jobs\" href=\"https:\/\/www.monsterindia.com\/shell-scripting\/\" target=\"_blank\" rel=\"noopener\">Shell Scripting Jobs<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Computers have revolutionized the way in which we interact with the world. Today we use this technology for even the most basic of our daily tasks. Charting out our weekly schedule, making grocery lists or just small reminders about a friend\u2019s anniversary. However, the way in which we interact with computers too has greatly changed. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":8765,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[147],"tags":[],"class_list":{"0":"post-8764","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-interview-questions"},"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.monster.co.th\/career-advice\/wp-json\/wp\/v2\/posts\/8764","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.monster.co.th\/career-advice\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.monster.co.th\/career-advice\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.monster.co.th\/career-advice\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.monster.co.th\/career-advice\/wp-json\/wp\/v2\/comments?post=8764"}],"version-history":[{"count":1,"href":"https:\/\/www.monster.co.th\/career-advice\/wp-json\/wp\/v2\/posts\/8764\/revisions"}],"predecessor-version":[{"id":10186,"href":"https:\/\/www.monster.co.th\/career-advice\/wp-json\/wp\/v2\/posts\/8764\/revisions\/10186"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.monster.co.th\/career-advice\/wp-json\/wp\/v2\/media\/8765"}],"wp:attachment":[{"href":"https:\/\/www.monster.co.th\/career-advice\/wp-json\/wp\/v2\/media?parent=8764"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.monster.co.th\/career-advice\/wp-json\/wp\/v2\/categories?post=8764"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.monster.co.th\/career-advice\/wp-json\/wp\/v2\/tags?post=8764"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}