Linux interview questions and Answers

                        Now I am going to start a new post which will be updated on timely basis , helpful for the guys who are preparing for interview in Linux field....

1.What are the main difference from LINUX and WINDOWS ?

  1. Linux is an open source software and Windows is a closed source software.
  2. Because Linux is an open source software so whenever a users faces a threat or problem he report the same on community discussion form and developers starts to finding the solution. While Windows OS takes 2 to 3 month for correction of reported threat and error and after that releases new patches and updates.
  3. Linux OS is most secure than Windows OS.
  4. Linux systems are well known for their ability to run for years without failure
  5. Linux also handles a large number of processes running at once much better than Windows does--that's something, in fact, that tends to degrade Windows' stability quickly.
2. what is linux boot sequence ?
  1. BIOS                (basic input/output system executes MBR)
  2. MBR                (Master Boot Record executes Grub)
  3. GRUB              (Grand unified bootloader executes kernal)
  4. KERNAL         (Kernal executes /sbin/init)
  5. INIT                 (init executes runlevel programs)
  6. RUNLEVEL    (Runlevel programmes are executed from /etc/rc.d/rc*.d/)
3. What is sticky bit

     Sticky bit is a permission bit that is set on a file or a directory that lets only the owner of the file/directory or the root user to delete or rename the file. No other user is given privileges to delete the file created by some other user.

4. Why a newly created folder shows the size 4 KB ?

  It's the initial size necessary to store the meta-data about files contained in that directory (including names). The initial allocation equals the size of one sector, but can grow above that if necessary. Once allocated, space is not freed if files are removed, to reduce fragmentation.

5.What are inodes ?

    An inode is an entry in inode table, containing information ( the metadata ) about a regular file and directory. An inode is a data structure on a traditional Unix-style file system such as ext3 or ext4. Inode number also called as index number , it consists following attributes
File types ( executable, block special etc )
Permissions ( read, write etc )
UID ( Owner )
GID ( Group )
Time stamps including last access, last modification and last inode number change.
File deletion time
Number of links ( soft/hard )
Location of ile on harddisk.

Some other metadata about file.

6. Difference between soft link and Hard link ?

Hard Link acts like a mirror copy of the original file. These links share the same inodes. Changes made to the original or hard linked file will reflect in the other. When you delete Hard Link nothing will happen to the other file. Hard links can't cross file systems.
Soft Link is an actual link to the original file. These Links will have a different Inodes value. Soft link points to the original file so if the original file is deleted then the soft link fails. If you delete the Soft Link, nothing will happen to file. The reason for this is, the actual file or directory’s inode is different from the "soft link" created file's inodes. Soft links can cross file systems.
7. How to create our own command in linux ?

     Create a bash script and name that file like the command you wish and put it in a folder ( say /home/bin..or anywhere).make the file executable "chmod +x filename".Update your path variable to include this directory( where you placed the file ).Put this path in .profile or .bash_profle file to make it permanent.

8. How to copy file without using 'cp' command ?

          cat file_1 > file_2

9 what are the port number for pop3s and pop3 ?
                pop3   - 110
                pop3s - 995

10. What is the default permission of a newly created folder by a user ?

                 folder - 755

                 file     - 644

11. What is the difference between TCP and UDP ?

  1.  TCP is a connection-oriented protocol. and UDP is connection less
  2. As a message makes its way across the internet from one computer to another. This is connection based.UDP is also a protocol used in message transport or transfer. This is not connection based which means that one program can send a load of packets to another and that would be the end of the relationship.
  3. TCP is suited for applications that require high reliability, and transmission time is relatively less critical.UDP is suitable for applications that need fast, efficient transmission, such as games. UDP's stateless nature is also useful for servers that answer small queries from huge numbers of clients.
12.How can we find the ip address of a website ?
      We can find the ip address of a website by ping to the site or using the "nslookup" command

13.Explain the working of a mail server ?

    Email message is nothing but a text file plus the attachments.Like all data through the internet, an email is also broken into smaller packets. When the sender clicks the send button, all the packets are uploaded to a central computer (the email server) that hosts the email service
The email service then relays these packets through the internet to the server which holds the email service of the recipient. The mail server of the recipient looks for his email address, locates it and places the email within the inbox. The email client reassembles the packets into a complete mail. The recipient logs into his account and downloads the email.
Working of mail server
Working of mail server

( Will Continue )

No comments:

Post a Comment