LINUX- Freshers Interview Q&A
1. What is Linux, and how does it differ from other operating systems?
Linux is an open-source, Unix-like operating system kernel that forms the basis of various Linux distributions (distros). Unlike proprietary operating systems, Linux is freely available and highly customizable.
2. Explain the file system hierarchy in Linux.
The Linux file system hierarchy includes directories like /bin, /usr, /home, /etc, and /var. These directories organize system files, user data, and configuration files in a structured manner.
3. What is the difference between a shell and a terminal in Linux?
A shell is a command-line interface that interprets user commands and executes them, while a terminal is a program that provides the user with access to the shell. The terminal displays the shell prompt.
4. What is a Linux distribution (distro), and name a few popular ones.
A Linux distribution is a complete operating system package that includes the Linux kernel, system libraries, utilities, and often a package manager. Examples of popular distros include Ubuntu, CentOS, Debian, and Fedora.
5. Explain the purpose of the sudo command.
The sudo (superuser do) command allows authorized users to execute commands with elevated privileges, typically as the root user, to perform administrative tasks.
6. How do you search for a file in Linux?
You can use the find command to search for files in Linux. For example, to find a file named “example.txt” in the current directory and its subdirectories, you can use find . -name “example.txt”.
7. What is a symbolic link (symlink) in Linux?
A symbolic link is a special type of file that acts as a reference or pointer to another file or directory. It allows for flexible file organization and redirection.
8. Explain the difference between hard links and symbolic links.
Hard links: Point to the same data blocks as the original file. Deleting the original file does not remove data until all hard links are deleted.
Symbolic links: Act as references to the original file or directory. They can span filesystems and point to files or directories that may not exist.
9.What is the purpose of the /etc/passwd file in Linux?
The /etc/passwd file stores user account information, including usernames, user IDs (UIDs), group IDs (GIDs), home directories, and default shells. It is used for user authentication.
10.How do you check the available disk space in Linux?
You can use the df (disk free) command to display information about disk space usage on mounted filesystems. The -h option provides human-readable output.
11.Explain how to archive and compress files in Linux using tar and gzip.
To create a compressed archive using tar and gzip, you can use the following command:
tar -czvf archive.tar.gz /path/to/files
12.What is the purpose of the /etc/fstab file?
The /etc/fstab file contains information about disk drives and partitions, specifying how they should be mounted at boot time. It defines mount points and options for each filesystem.
13.What is the significance of the chmod command in Linux?
The chmod command is used to change the permissions of files and directories. It allows users to control who can read, write, or execute a file or directory.
14.How do you schedule tasks in Linux using cron jobs?
To schedule tasks using cron jobs, you can edit the crontab file using the crontab -e command. You specify the timing and command to run in the crontab file.
15. Explain the use of the ps command in Linux for process management.
The ps command is used to list running processes on a Linux system. Common options include ps aux to display detailed information about all processes and ps -ef for a process tree view.