Saturday, July 4, 2020
12 Linux Unix Interview Questions to Test Programmers (June 2020)
12 Linux Unix Interview Questions to Test Programmers (June 2020) 12 Tricky Linux Unix Interview Questions to Test Programmers in 2020 Image Source: PixabayUnix is a hardy perennial of operating systems, first devised almost half a century ago in the late 1960s in Bell Labs. With the exception of the Microsoft NT systems, Unixâs DNA is everywhere, most notably in Linux, but also the Mac OS X, iOS, Android, Chrome, even in the Orbis system in Playstation 4. And thatâs why, when going for a job in programming, that itâs good to know about Unix interview questions and especially the workings of its descendant Linux.Even if you consider the design philosophy underpinning Unixâ"itâs a collection of small modular utilities, each undertaking one task as part of a complex entiretyâ"you can appreciate the continued relevance of the âoriginal of the speciesâ Unix.This is why there are so many similarities between a Mac OS X terminal or file system, and Linuxâs, and why they are so different from Windows. The former two were inspired by the Unix operating systems, where as Windows does not.The original Unix h as two offshots: on the open-source side, BSD led ultimately to iOS, Orbis as well as the GNU project that birthed MINIX, which inspired Linux and then to GNU/Linux, which is the foundation stone for Android, Chrome, Steam and others.Meanwhile, the commercial descendants included those systems developed by large corporations and licensed as their own respective variants of Unix. These, some of which are still in operation today, include ATT UNIX, SCO UnixWare, Sun Microsystems Solaris, HP-UX, IBM AIX, and SGI IRIX.And while the march of Unix toward industry standard global domination was halted by DOS and IBM-compatible computers, especially Microsoftâs variant of DOS (which led to Windows NT and eventually to Windows XP), its influence endures, especially in Linux.Below we have compiled a list of 12 questions shared online by Unix and Linux developers and we encourage you to study them before you go for your interview. But alongside your preparations, make sure your general interview essential items are all in order. Be neat and tidy at all times, and carry any necessary paraphernalia in a quality briefcase, a slimline backpack, or a neat messenger bag / satchel.To follow up on this article, there are numerous books about Unix and Linux available online. A Practical Guide to Linux Commands, Editors, and Shell Programming (3rd Edition) by Mark G Sobell is regarded as one of the best sources on essential Linux commands. Another is The Linux Command Line: A Complete Introduction by William E Shotts Jr, which is highly rated and recommended for essential shell commands. Last but by no means least is How Linux Works: What Every Superuser Should Know, which is another highly rated Linux guide for programmers.asyazon_link]Image Source: Amazon (adsbygoogle = window.adsbygoogle || []).push({}); 12 Linux and Unix Interview Questions for Programmers DevelopersSo, as we have seen, the influence of Unix remains palpable and potent. Not to labour the point , but Linux is the most popular descendant, and displaced the SUS-certified Unix variant in the early 1990s. However and perhaps most significantly of all, Android, which is the most widely used mobile operating system in the world, is based on Linux. So, while Unix has a long history, experts will tell you online that interviews for Java programming, Android and other development jobs are almost bound to include Linux and Unix interview questions.What follows is a list of 12 Linux and Unix interview questions to get you into a state of readiness for what you might face during an interview. They range in difficulty from easy to complex, but none should be under-estimated. Good luck, Linux Unix AGENTs! (adsbygoogle = window.adsbygoogle || []).push({}); 1. What is UNIX?As the Udemy team point out, this may sound like a no-brainer, but itâs incredible just how many candidates struggle in an interview to give a clear definition of Unix. Udemyâs answer suggestion is as follows:UNI X is a multi-user multitasking-optimized operating system that can run on various hardware platforms.Question Answer Source: Udemy2. How do you find all the links in a folder in UNIX or Linux ?According to Java67.com, this is one of the trickier UNIX interview questions, as there is no specific command to find all symbolic links. The ln command creates and updates soft links, but nothing gives all the links in a directory.The one to use is the ls command which lists everything in the directory; then you need to list all the links, as they start with l as first characters. The actual UNIX command to find all links in a directory is:[emailprotected]:~ ls -lrt total 2.0K -rw-r--r-- 1 Linux Domain Users 0 Dec 6 2011 a drwxr-xr-x+ 1 Linux Domain Users 0 Sep 19 12:30 java/ lrwxrwxrwx 1 Linux Domain Users 4 Sep 19 12:31 version_1.0 - java/ [emailprotected]:~ ls -lrt | grep '^l' lrwxrwxrwx 1 Linux Domain Users 4 Sep 19 12:31 version_1.0 - java/Question Answer Source: Java67.com (adsbygoogle = window.adsbygoogle || []).push({}); 3. Technical coding questionsBe sure to research technical Unix interview questions, for your skills will undoubtedly put you to the test. Toptal provides a typical question: How would you count every occurrence of the term âpotatoâ in all the files appearing under the current directory,$ grep -orI potato . | wc -land its subdirectories, recursively?Answer: To list every occurrence of the term âpotatoâ on a separate line, one must run grep -o potato pathAdding the r flag to the command makes the search recursively process every file under the given path, and the I flag ensures that matches in binary files are ignored. In addition, the w flag can be included to match the exact term only, and ignore superstrings such as âpotatoesâ, and to make the search case-insensitive, the i flag can be added as well:$ grep -iworI p otato . | wc -lThe number of lines yielded by this grep command is the number of occurrences of the desired term, which can then be counted by piping it into the wc -l command.Question Answer Source: Toptal.com4. How do you print/display the first line of a file?TheProfessionalsPoint blog points out that there a number of ways to answer this question, but the easiest way to do it is by use of the [head] command.$ head -1 file.txtUsing [head -2] would print the first 2 records of the file.Another method is the [sed] command, a powerful text editor which can be used for various text manipulation purposes like this.$ sed '2,$ d' file.txtThe d parameter instructs [sed] to delete all the records from display from line 2 to the last line of the file (represented by $). The command does not actually delete the lines. Rather, it does not display the specified lines on a standard output screen, so the user will see only the remaining line, the first line.Question Answer Source: TheProfess ionalsPoint.Blogspot.ie (adsbygoogle = window.adsbygoogle || []).push({}); 5. What are shared, slave, private, and unbindable mountpoints?A mountpoint that is shared may be replicated as many times as needed, and each copy will continue to be the exact same. Other mount points that appear under a shared mount point in some subdirectory will appear in all the other replicated mount points as it is.A slave mountpoint is similar to a shared mount point with the small exception that the âsharingâ of mount point information happens in one direction. A mount point that is slave will only receive mount and unmount events. Anything that is mounted under this replicated mount point will not move towards the original mount point.A private mountpoint is exactly what the name implies: private. Mount points that appear under a private mount point will not be shown elsewhere in the other replicated mount points unless they are explicitly mounted there as well.An unbindable mountpoint, which by definition is also private, cannot be replicated elsewhere through the use of the bind flag of the mount system call or command.Question Answer Source: Toptal.com 6. How to run a program in the background in Unix or Linux ?As the Java67.com team point out, this is an easy Unix or Linux interview question, but only when you know. You can use amp; to run any process in the background and then use jobs to find the job id for that process. The fg and bg commands bring that process to the foreground and background respectively. Java67.com recommends candidates to read the book How Linux Works: What Every Superuser Should Know, to learn more about running a process in the background. Image Source: Amazon Check Price Question Answer Source: Java67.com (adsbygoogle = window.adsbygoogle || []).push({}); 7. How is UNIX different from Linux?Udemy advises that while Linux is an open-source clone of UNIX, with a lot of similarities, the candidate should be aware that there are a lot of d ifferences. The main advantage of UNIX is that all the core components of the operating system come from the same vendor, which means greater overall stability and better software support from vendors. UNIX releases are more stable and consistent than Linux releases, making UNIX the better choice for enterprise use.Question Answer Source: Udemy8. What is the meaning of â644 permissionâ for a file?As the Java67.com team points out, to answer UNIX interview questions such as this depends on your knowledge about the basics of UNIX files and directories. 644 represents permission 110 (for the owner), permission 100 (for a group) and 100 for others. This translates into read + write access for the creator of the file (the owner), and read-only permission for the group and others.The team further explains that in Unix, whenever a file is created, the file creation process uses default permission 666 (and 777 for a directory). The user is able to restrict permissions for that file o r directory through the unmask command. For example, a common unmask value is 022, which will grant the file read + write permission for the owner and group, but read-only for group members and other.Question Answer Source: Java67.com and JavaRevisited.Blogspot.com (adsbygoogle = window.adsbygoogle || []).push({}); 9. What is a Unix shell? Is Bash the only Unix shell?The experts at Toptal.com provide comprehensive answers to these and other Unix interview questions. Firstly, they define a Unix shell as software that provides a user interface for the underlying operating system. Unix shells typically provide a textual user interface a command line interpreter that may be used for entering and running commands, or create scripts that run a series of commands and can be used to express more advanced behaviour.Bash is not the only Unix shell, but just one of many. Short for Bourne-Again Shell, it is also one of the many Bourne-compatible shells. However, Bash is arguably one of the most popular shells around. There are other, modern shells available that often retain backwards compatibility with Bash but provide more functionality and features, such as the Z Shell (zsh).Question Answer Source: Toptal.com10. How do you check all the running processes in Unix?The standard command to see this, according to TheProfessionalsPoint blog, is [ps]. However, [ps] shows only a snapshot of the processes at that instance. If you need to monitor the processes for a certain period of time, and refresh the results in each interval, consider using the [top] command.$ ps â"efIf you wish to see the percentage of memory usage and CPU usage, then consider the switches below:$ ps auxIf you wish to use this command inside some shell script, or if you want to customize the output of [ps] command, you may use â-oâ switch, as in the example below. By using â-oâ switch, you can specify the columns that you want [ps] to print out.$ps -e -o stime,user,pid,args,%mem,%cpuQuestio n Answer Source: TheProfessionalsPoint.Blogspot.ie (adsbygoogle = window.adsbygoogle || []).push({}); 11. Your application home directory is full. How do you determine which directories are using most space?By using the disk usage (DU) command in Unix, according to TheProfessionalsPoint blog. For example,du â"sh . | grep Gwill list down all the directories which have GIGS in Size.Question Answer Source: TheProfessionalsPoint.Blogspot.ie12. What is a Linux null (or Blackhole) route? How can it be used to mitigate unwanted incoming connections?A Linux null (or Blackhole) route is a type of routing table entry which, upon matching a packet, discards it without forwarding the packet any further or sending any ICMP. Using this technique, it is possible to block an IP (or range of IP addresses) by running a simple command. For example, blocking 192.168.0.1 can simply be done with the following command:# ip route add blackhole 192.168.0.1/32Question Answer Source: Toptal.com
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.