Top 50 Linux/unix/solaris Interview Questions You Must Prepare 26.May.2022

This so-called Free software movement allows several advantages, such as the freedom to run programs for any purpose and freedom to study and modify a program to your needs. It also allows you to redistribute copies of a software to other people, as well as freedom to improve software and have it released to the public.

LILO is a boot loader for Linux. It is used mainly to load the Linux operating system into main memory so that it can begin its operations.

Files in a directory can actually be a directory itself; it would be called a subdirectory of the original. This capability makes it possible to develop a tree-like structure of directories and files, which is crucial in maintaining an organizational scheme.

In general, one desktop environment, like KDE or Gnome, is good enough to operate without issues. It’s all a matter of preference for the user, although the system allows switching from one environment to another. Some programs will work on one environment and not work on the other, so it could also be considered a factor in selecting which environment to use.

It is a portable operating system that is designed for both efficient multi-tasking and mult-user functions. Its portability allows it to run on different hardware platforms. It was written is C and lets user do processing and control under a shell.

Shell variables are a combination of a name ( identifier), and an assigned value, which exist within the shell. These variables may have default values, or whose values can be manually set using the appropriate assignment command. Examples of shell variable are PATH, TERM and HOME.

-l, which is normally used in listing command like ls, is used to show files in a long format, one file per line. Long format refers to additional information that is associated with the file, such as ownership, permissions, data and filesize.

The cmp command is used mainly to compare two files byte by byte, after which the first encountered mismatch is shown. On the other hand, the diff command is used to indicate the changes that is to be made in order to make the two files identical to each other.

FSCK Utility is for checking and repairing the files system inconsistencies, It has 5 phases 

Phase 1: Check Blocks and Sizes - checks inodes for inconsistencies
Phase 2: Check Path-Names - checks directory inode consistencies
Phase 3: Check Connectivity - checks that all directories are connected to the file system
Phase 4: Check Reference Counts - compares link count information from Phases 2 & 3, correcting discrepancies
Phase 5: Check Cylinder Groups - checks free blocks and the used inode maps for consistency
Phase 6: Salvage Cylinder Groups - update the tables to reflect any changes made in earlier passes

Serial ports are identified as /dev/ttyS0 to /dev/ttyS@These are the equivalent names of COM1 to COM8 in Windows.

Whereas under Windows you refer to the parallel port as the LPT port, under Linux you refer to it as /dev/lp . LPT1, LPT2 and LPT3 would therefore be referred to as /dev/lp0, /dev/lp1, or /dev/lp2 under Linux.

To open the default shell (which is where the command prompt can be found), press Ctrl-Alt-F@This will provide a command line interface (CLI) from which you can run commands as needed.

Yes, it does. Just like Windows, you can use this key combination to perform a system restart. One difference is that you won’t be getting any confirmation message and therefore, reboot is immediate.

Boot process dived into 4 phases. 

  1. POST : Power on self test (POST), It will detect hardware, machine host ID,serial No, architecture type, memory and Ethernet address and it will load the primary program called bootblk. 
  2. OBPROM : Open boot programmable Diagnosing all the system hardware and memory. Initializing the boot parameter. Creating device trees and load the boot block from (0-15 sector), it is called as secondary boot -- programmable ufsboot. 
  3. KERNEL INITIALIZATION : ufsboot load the kernel (generic unix) kernel will load all the necessary devices modules to mount the root partition to continue the booting process .
  4. INIT PHASES : It will started by executing of /etc/init program and start other process reading the /etc/inittab files, as the directory in the /etc/inittab files. 

Piping, represented by the pipe character “|”, is used to combine two or more commands together. The output of the first command serves as input the next command, and so on.

  • telnet – used for remote login
  • ping – an echo request for testing connectivity
  • su – user switching command
  • ftp – file trfer protocol used for copying files
  • finger – information gathering command

Linux assigns numbers at the end of the drive identifier. For example, if the first IDE hard drive had three primary partitions, they would be named/numbered, /dev/hda1, /dev/hda2 and /dev/hda3.

An inode is an entry created on a section of the disk set aside for a file system. The inode contains nearly all there is to know about a file, which includes the location on the disk where the file starts, the size of the file, when the file was last used, when the file was last changed, what the various read, write and execute permissions are, who owns the file, and other information.

The preferred size for a swap partition is twice the amount of physical memory available on the system. If this is not possible, then the minimum size should be the same as the amount of memory installed.

  • Disk Based FS : ufs  (Unix FS), hsfs (High Sierra FS), pcfs (PC FS for DOS FAT32), 
  • udfs : Universal Disk Format FS  
  • Network FS      : nfs (Network FS) 
  • Memory based FS (Pseudo FS) :  tmpfs, swapfs, procfs, mntfs

A shell acts as an interface between the user and the system. As a command interpreter, the shell takes commands and sets them up for execution.

This will reduce the reserved space to 2%
# tunefs –m 2 /dev/rdsk/c1d0s0 

CLI is short for Command Line Interface. This interface allows user to type declarative commands to instruct the computer to perform operations. CLI offers an advantage in that there is greater flexibility. However, other users who are already accustom with using GUI find it difficult to remember commands including attributes that come with it.

Command substitution is one of the steps being performed every time commands are processed by the shell. Commands that are enclosed in backquotes are executed by the shell. This will then replace the standard output of the command and displayed on the command line.

Assuming you are the system administrator or the owner of a file or directory, you can grant permission using the chmod command. Use + symbol to add permission or – symbol to deny permission, along with any of the following letters: u (user), g (group), o (others), a (all), r (read), w (write) and x (execute). For example the command chmod go+rw FILE1.TXT grants read and write access to the file FILE1.TXT, which is assigned to groups and others.

Linux is an operating system based on UNIX, and was first introduced by Linus Torvalds. It is based on the Linux Kernel, and can run on different hardware platforms manufactured by Intel, MIPS, HP, IBM, SPARC and Motorola. Another popular element in Linux is its mascot, a penguin figure named Tux.

If you switch from multiuser mode to init s and switch it back to multiuser mode.then remote useres automatically reconnects to the system. where as in the case of init @they have to reconnect manually me they have to relogin 

The tee command does two things: one is to get data from the standard input and send it to standard output; the second is that it redirects a copy of that input data into a file that was specified.

Understanding file systems in UNIX has to do with knowing how files and inodes are stored on a system. What happens is that a disk or portion of a disk is set aside to store files and the inode entries. The entire functional unit is referred to as a file system.

Kernel is the UNIX operating system. It is the master program that controls the computer’s resources, allotting them to different users and to different tasks. However, the kernel doesn’t deal directly with a user. Instead, it starts up a separate, interactive program, called a shell, for each user when he/she logs on.

Yes, that is possible. Use “rm –r *” for this purpose. The rm command is for deleting files. The –r option will erase directories and subdirectories, including files within. The asterisk represents all entries.

In general, filenames that are preceded by a dot are hidden files. These files can be configuration files that hold important data or setup info. Setting these files as hidden makes it less likely to be accidentally deleted.

Symbolic links act similarly to shortcuts in Windows. Such links point to programs, files or directories. It also allows you instant access to it without having to go directly to the entire pathname.

Relative path refers to the path relative to the current path. Absolute path, on the other hand, refers to the exact path as referenced from the root directory.

Hard links point directly to the physical file on disk, and not on the path name. This me that if you rename or move the original file, the link will not break, since the link is for the file itself, not the path where the file is located.

Each time you enter a command, a variable named PATH or path will define in which directory the shell will search for that command. In cases wherein an error message was returned, the reason maybe that the command was not in your path, or that the command itself does not exist. You can also manually set the path using the “set path = [directory path]” command.

A superuser is a special type user who has open access to all files and commands on a system. Note that the superuser’s login is usually root, and is protected by a so-called root password.

The key differences between the BASH and DOS console lies in 3 areas:

  1. BASH commands are case sensitive while DOS commands are not.
  2. under BASH, / character is a directory separator and acts as an escape character. Under DOS, / serves as a command argument delimiter and is the directory separator.
  3. DOS follows a convention in naming files, which is 8 character file name followed by a dot and 3 character for the extension. BASH follows no such convention.

One important rule when naming files is that characters that have special meaning are not allowed, such as * / & and %. A directory, being a special type of file, follows the same naming convention as that of files. Letters and numbers are used, along with characters like underscore and dot characters.

  • ftp port : 21 
  • ssh port : 22 
  • Telnet port : 23 
  • ntp port : 123
  • smtp port : 25
  • printer port : 515

Every process is uniquely identified by a process identifier. It is possible to view details and status regarding a process by using the ps command.

A system call is part of the programming for the kernel. A library function is a program that is not part of the kernel but which is available to users of the system. UNIX commands, however, are stand-alone programs; they may incorporate both system calls and library functions in their programming.

There are 8 run level.

  1. Init0: Shutting down the system and bring back the system to OBP Prompt (OK)
  2. Init1: Single user mode for administrative
  3. Init2: Multi user mode without resource sharing
  4. Init3: Multi user mode with resource sharing
  5. Init4: Not in use
  6. Init5: Shutdown and power off the system
  7. Init6: Reboot the system to default run level
  8. Inits: Single user mode but user login are disabled

The root account is like a systems administrator account, and allows you full control of the system. Here you can create and maintain user accounts, assigning different permissions for each account. It is the default account every time you install Linux.

Any filename can have a maximum of 255 characters. This limit does not include the path name, so therefore the entire pathname and filename could well exceed 255 characters.

It is a free shell designed to work on the UNIX system. Being the default shell for most UNIX-based systems, it combines features that are available both in the C and Korn Shell.

Unix originally began as a propriety operating system from Bell Laboratories, which later on spawned into different commercial versions. On the other hand, Linux is free, open source and intended as a non-propriety operating system for the masses.

A swap space is a certain amount of space used by Linux to temporarily hold some programs that are running concurrently. This happens when RAM does not have enough memory to hold all programs that are executing.

Multiuser me that more than one person can use the computer at the same time. Multitask me that even a single user can have the computer work on more than one task or program at the same time.

The Linux Kernel is a low-level systems software whose main role is to manage hardware resources for the user. It is also used to provide an interface for user-level interaction.