Font size
WorksheetsLinux Interview questions
Total questions: 100
Worksheet time: 50mins
The difference between the df and du commands is:
df shows disk space usage of file systems, while du shows disk usage of files and directories.
df shows memory usage, while du shows CPU usage.
df deletes files, while du updates directories.
df is used for formatting disks, while du is used for defragmenting them.
The scp (secure copy protocol) command in Linux is used for:
Transferring files securely between hosts on a network
Changing file permissions
Monitoring system processes
Editing text files
3. The command that can be used to search for a file on a Linux host is:
find
ls
cd
pwd
The file that contains the iSCSI IQN for a Linux host is:
/etc/iscsi/initiatorname.iscsi
/etc/iscsi/iscsi.conf
/etc/iscsi/iqn.conf
/etc/iscsi/initiator.conf
The following are tools you can use to read a file:
cat , less, vi, vim.
Paint program
Web browser
Calculator
6. The command that can be utilized to determine which process is using the highest CPU and Memory is:
ps aux
ls -l
top
cd /proc
How do you view a list of open files for the host?
lsof
ps
netstat
df
What is the syntax to tar/zip/compress a file? (Fill in the blank)
tar -cvf to create or compress a new archive; tar -xvf to extract or uncompress the archive
tar -zcvf to extract a file; tar -zxvf to compress a file
tar -cvf to delete a file; tar -xvf to rename a file
tar -xvf to create a new archive; tar -cvf to extract the archive
Which command shows the total memory and free memory for the Linux server?
free -m
ls -l
df -h
ps aux
Where can be find the WWPN from a Linux server?
In directory /sys/class/fc_host
In file /etc/hosts
In directory /var/log/wwpn
In command /usr/bin/wwpn
Where would you look to find system logs?
In the /var/log directory
In the /home directory
In the /etc directory
In the /usr/bin directory
If you don't know the options to a command, where do you go to look them up? (Fill in the blank)
In the man pages.
In the recycle bin.
In the downloads folder.
In the task manager.
Which command can be issued to enumerate all users logged into the Linux server?
w
ls
cat
ps
What is an inode in Linux?
When a file is created, an inode is also created to store its metadata. Each file in a Linux system is associated with an inode. Inodes contain information like file size, timestamps, and pointers to data blocks.
An inode is a type of Linux command used to manage user permissions.
An inode is a special type of file that stores the contents of directories only.
An inode is a process that runs in the background to monitor system performance.
Write a command to display the last 10 lines of a file.
tail -n 10 filename.
head -n 10 filename.
cat filename | tail 5
less -n 10 filename.
Which command shows you the file type?
file
cat
ls
grep
Name the file that is used to automatically mount file systems?
/etc/fstab
/etc/hosts
/etc/passwd
/etc/shadow
How do you change the password for a user in Linux?
The “passwd” command is used to change the password for a user in Linux. Running “passwd username” prompts you to enter a new password for the specified user.
The “usermod” command is used to change the password for a user in Linux. Running “usermod -p username” prompts you to enter a new password for the specified user.
The “chuser” command is used to change the password for a user in Linux. Running “chuser password username” prompts you to enter a new password for the specified user.
The “setpass” command is used to change the password for a user in Linux. Running “setpass username” prompts you to enter a new password for the specified user.
How do you view a hidden file in Linux?
ls -a
ls -h
ls --hidden
ls -l
Describe the Process of Starting and Stopping a Service
systemctl start
service start
start-service
initctl start
What are the 3 permission types for Linux?
read, write, and execute
read, delete, and modify
owner, group, and others
create, remove, and update
What is the Linux kernel?
The Linux kernel is the core of the Linux operating system, acting as the central interface between the hardware and the software.
The Linux kernel is a type of computer virus that infects operating systems.
The Linux kernel is a popular web browser used for internet surfing.
The Linux kernel is a programming language used to develop mobile applications.
What are the differences between UNIX and Linux Operating System?
Linux is free and open sourced software.
Linux is a proprietary software developed by Apple.
UNIX is only used for gaming purposes.
Linux cannot be used on servers.
What is linux swap space and when is it used?
Swap space is a designated area on a hard drive (or a dedicated file) that acts as a temporary extension of physical memory (RAM). It's used when the system's RAM is full and needs to free up space for active processes.
Swap space is a special type of RAM that increases the speed of the CPU during heavy computation.
Swap space is a partition used only for storing user files and documents temporarily.
Swap space is a backup area for storing system logs in case of a crash.
The difference between hard links and soft links (symlinks) in Linux is:
Hard links point directly to the inode of a file, while soft links point to the file name.
Soft links can only be created within the same filesystem, while hard links can span filesystems.
Hard links can link to directories, while soft links cannot.
Soft links and hard links are identical in functionality.
The command that can be issued to list the groups you are part of and your UID is:
id
whoami
groups
ls -l
Identify the command used to determine which shell you are using.
echo $SHELL
ls -l
pwd
whoami
The Linux Shell is:
A command-line interface for interacting with the operating system
A type of hardware component in Linux systems
A graphical user interface for Linux games
A programming language used only for web development
Select the correct sequence of steps to create a new user in Linux.
Use the 'useradd' command, set a password with 'passwd', and assign user details as needed.
Edit the /etc/passwd file directly, reboot the system, and assign a password.
Install a new Linux distribution, create a user during installation, and never change it.
Use the 'deluser' command, then set a password with 'passwd', and assign user details.
The distinction between the /etc/passwd and /etc/shadow files is:
/etc/passwd stores user account information, while /etc/shadow stores encrypted passwords.
/etc/passwd stores encrypted passwords, while /etc/shadow stores user account information.
Both files store the same information.
/etc/shadow is used only for system logs.
What are File Permission groups in Linux?
Owner, Group, All Users
Admin, User, Guest
Root, User, System
Primary, Secondary, Tertiary
How can we run a program in the background?
Add the ampersand ( & ) symbol at the end of the command.
Use the exclamation mark ( ! ) at the end of the command.
Type 'runbg' before the command.
Enclose the command in square brackets [ ]
How do we list all processes running in the background?
Run the jobs command. Use fg
Use the ps aux command. Use bg
Run the top command. Use kill
Use the ls command. Use cd
What is LVM?
Logical Volume Manager. LVM allows for the collection of multiple physical hard drives and partitions into a single volume group which can then be divided into logical volumes.
Linux Virtual Machine. LVM is a virtualization tool for running multiple operating systems.
Local Volume Mount. LVM is used to mount local drives automatically.
Lightweight Virtual Memory. LVM is a memory management technique.
Different types of volumes you can have with Linux include which of the following?
Physical, Logical, and Network volumes
Only Logical volumes
Only Physical volumes
Only Network volumes
How do you format a disk in Linux?
mkfs.ext4
ls -l
cat /dev/sda
grep disk
What is sudo in Linux? The word "sudo" is the short form of ________ that allows you to run the command with system privileges. With this command, you can get the system's administrative access to perform various tasks. The sudo command requires a password before the execution to verify the user's authorization.
Superuser Do
System User Domain
Super Utility Domain Operator
System Update Download
What is the lsblk command? The command prints all ________ in a tree-like format.
block devices
network interfaces
user accounts
system logs
Linux users place a ./ in front of the script name to:
specify the current directory for execution
run the script as an administrator
indicate a hidden file
compile the script before running
The command that can be issued to list all environmental variables is:
printenv
ls
pwd
cd
A packet trace can be created on a Linux server using which of the following commands?
tcpdump
ping
netstat
traceroute
The wget command is used for which of the following purposes?
Downloading files from the internet
Compressing files
Editing text files
Monitoring system performance
Configuring a static IP address for a Linux server can be done by editing which file?
/etc/network/interfaces
/etc/hostname
/etc/resolv.conf
/etc/fstab
How do you perform a system backup in Linux?
By using the 'tar' command to archive files and directories
By deleting unnecessary files
By formatting the hard drive
By changing file permissions
The purpose of the /etc/hosts file is to:
Map hostnames to IP addresses locally
Store user account information
Configure network interfaces
Log system events
Which command can be used to list latency, utilization and traffic for the disks?
iostat -x
df -h
lsblk
du -sh
What is a process in Linux?
A process is an instance of a running program. It represents the execution of a program in memory and includes information such as the program’s code, data, and resources.
A process is a type of hardware device used to store data in Linux.
A process is a user account with administrative privileges in Linux.
A process is a file format used for saving documents in Linux.
How do you kill a process in Linux?
The “kill” command is used to terminate a process. It requires the process ID (PID) of the process to be killed. The PID can be obtained using the “ps” command.
The “ls” command is used to terminate a process. It requires the process ID (PID) of the process to be killed. The PID can be obtained using the “ps” command.
The “cd” command is used to terminate a process. It requires the process ID (PID) of the process to be killed. The PID can be obtained using the “ps” command.
The “pwd” command is used to terminate a process. It requires the process ID (PID) of the process to be killed. The PID can be obtained using the “ps” command.
Which command can be used to find and replace text in a file?
Sed
Ls
Cat
Pwd
What do the chmod +t and chmod +x commands do? How do they differ from each other?
You can use the chmod +t and chmod +x commands to modify permissions and files on a Linux system.
chmod +t sets the execute permission for all users, while chmod +x sets the sticky bit.
chmod +t removes all permissions from a file, while chmod +x adds read permission.
chmod +t and chmod +x are used to change file ownership, not permissions.
How can you examine a compressed log without having to decompress it first?
use the zcat command
use the cat command
use the less command
use the tail command
You have a file called dsd.log that is almost 4,000 lines long. What text filter can you use to split it into four pieces each 1,000 lines long?
split - The split text filter will divide files into equally sized pieces. The default length of each piece is 1,000 lines.
grep - The grep command is used for searching text using patterns.
cat - The cat command is used to concatenate and display files.
sort - The sort command is used to sort lines of text files.
How do you rename a file in Linux?
mv
cp
renamefile
edit
How to see the list of mounted devices on Linux?
By running command mount -l
By running command ls -a
By running command ps aux
By running command ifconfig
What is the command to see the default gateway?
ip route show
ls -l
ping 8.8.8.8
cat /etc/passwd
When should we use kill -9?
If the process cannot be stopped gracefully we would only use kill -9 as a last resort.
Whenever we want to stop any process, regardless of its state.
To pause a process temporarily.
To restart a process safely.
11. The command used to show a historical listing of the last logged in users is:
last
whoami
ps
ls
The command that can be issued to enumerate the dependencies for a specific file is:
ldd
ls
cat
chmod
The nice command is used for:
Changing the priority of a process
Displaying disk usage
Listing files in a directory
Monitoring network traffic
14. The command used to create a RAID array on a Linux server is:
mdadm
ifconfig
chmod
ps
Changing the hostname for a Linux server can be done using which command?
hostnamectl set-hostname
sudo apt-get update
chmod 755
service restart
16. The fdisk -l output typically displays which of the following?
Partition tables and disk information
Network interface statistics
Running processes and their IDs
System memory usage
15. Steps to create a new RAID Group for Linux include:
Use 'mdadm' to create and manage RAID arrays.
Install RAID hardware only.
Format the drives with NTFS file system.
Use 'chkdsk' to initialize RAID.
Which command shows the file system type each drive has been formatted with?
blkid
lsblk
df
du
Which section of the iostat command shows the read and write latency?
w_await shows the disks write latency. r_await displays the read latency in mS.
%util shows the read and write latency.
svctm shows the read and write latency.
tps shows the read and write latency.
Which command can be issued to search for and install the multithreaded IO generation tool FIO?
dnf search fio dnf install fio.x86_64
yum remove fio yum erase fio.x86_64
apt-get update apt-get remove fio
zypper search fio zypper remove fio
How can we list the servers CPU details including the number of cores?
run command cat /proc/cpuinfo
run command cat /proc/meminfo
run command ls /etc/cpuinfo
run command top -m cpu
How can we check the load average of a linux server? and what is considered high?
The load average can be found in the top or uptime command outputs.
The load average can only be checked by rebooting the server.
The load average is displayed in the /etc/passwd file.
The load average can be checked using the ls command.
3 averages are provided in the load average output for Linux because:
They represent the system load over the last 1, 5, and 15 minutes.
They show the CPU temperature at three different times.
They indicate the number of users logged in at different intervals.
They display the memory usage for three different processes.
The different modes for vi are:
Command mode, Insert mode, and Visual mode
Edit mode, Save mode, and Command mode
Insert mode, Delete mode, and Replace mode
View mode, Edit mode, and Command mode
6. A file or folder can be made hidden in Linux by:
Adding a dot (.) at the beginning of its name
Changing its file extension to .hidden
Moving it to the /hidden directory
Setting its permissions to 000
7. A Linux distribution can be used on a Windows host by:
using Windows Subsystem for Linux (WSL)
installing Linux directly over Windows
using only Windows command prompt
removing Windows and installing Linux
The file that must be edited to allow NFS access is:
/etc/exports
/etc/fstab
/etc/hosts
/etc/nfs.conf
Explain how you would download and install the iscsi initiator for Linux.
Use the package manager to install the open-iscsi package.
Download the iscsi initiator from the official website and run the installer script.
Compile the iscsi initiator from source code only.
Install iscsi initiator by copying binaries from another system.
Which command can be used to scan for open network ports?
nmap
ls
cat
ping
Which command can be used to check if port 80 is open for an external server?
We can use netcat command nc -z -v -s
We can use the ping command ping
We can use the cp command cp
We can use the mkdir command mkdir
How do you run a MTU ping test from a Linux based server?
ping -I 192.168.1.154 -M do -s 1472 -w 5 192.168.1.166
ping -t 192.168.1.154 -l 1472 192.168.1.166
ping -m 1472 -d 192.168.1.154 192.168.1.166
ping -S 192.168.1.154 -M do -s 1500 192.168.1.166
What is lsmod?
lsmod is a command-line utility in Linux used to display information about the kernel modules currently loaded into the system, showing which modules are active and their usage status.
lsmod is a Linux command used to list all running processes and their memory usage.
lsmod is a tool for managing user permissions in Linux systems.
lsmod is a command to display disk usage statistics in Linux.
A Zombie is:
processes that have completed their execution, but their entries are not removed from the process table.
a type of fruit
a musical instrument
a kind of weather phenomenon
The following commands can be leveraged to list USB drives:
lsusb and fdisk -l
ping and traceroute
mkdir and rmdir
ps and top
7. To enumerate a list of all user accounts added to the Linux server, which command should be used?
cat /etc/passwd
ls /home
whoami
ps aux
The Linux directory structure includes directories such as /bin and /etc. What do these directories typically contain?
/bin contains essential user command binaries, and /etc contains configuration files.
/bin contains user home directories, and /etc contains log files.
/bin contains temporary files, and /etc contains device drivers.
/bin contains system libraries, and /etc contains executable scripts.
The Linux boot process involves which of the following sequences?
BIOS/UEFI → Bootloader → Kernel → Init/Systemd → Runlevel programs/services
Kernel → BIOS/UEFI → Bootloader → Init/Systemd → Runlevel programs/services
Bootloader → BIOS/UEFI → Kernel → Init/Systemd → Runlevel programs/services
BIOS/UEFI → Kernel → Bootloader → Runlevel programs/services → Init/Systemd
LVM is:
Logical Volume Manager
Linux Virtual Machine
Local Volume Management
Large Volume Module
To append two files and not overwrite the existing data, which file mode should be used?
Use >> (two greater than symbols)
Use the write mode ("w")
Use the read mode ("r")
Use the exclusive creation mode ("x")
How do you create a support log bundle for a Linux server?
We run the sosreport command which will compress all logs and place the output in /var/tmp.
We use the tar command to archive the /etc directory only.
We run the dmesg command and save its output to /tmp/log.txt.
We use the cp command to copy /var/log to /home/user/logs.
Which command can be viewed to list all open network ports on the server?
netstat -tuln
ls -l
df -h
ps aux
Provide a command to change the user ownership of a file.
chown
chmod
usermod
chgrp
How would you troubleshoot a DNS issue?
1. View /etc/resolv.conf to verify the DNS servers have been added. 2. Confirm the DNS servers are available over the network with ping. 3. run nslookup against the hostname to see if its being resolved properly. 4. verify DNS port 53 is open with netcat and or with firewall-cmd. 5. Inspect logs or collect a packet trace with tcpdump.
Check the system time and date settings only.
Reboot the server without checking any configuration.
Update the operating system to the latest version without checking DNS settings.
Which command set is used to manage and install applications for Ubuntu Linux?
apt which stands for Advanced Package Tool
yum which stands for Yellowdog Updater Modified
dnf which stands for Dandified YUM
pacman which stands for Package Manager
Select the command that can be used to show all items for LVM.
pvs to print physical volumes
vgs to print volume groups
lvs to print logical volumes
ls
df
ps
The correct sequence of steps to create an LVM volume is:
Create physical volume, create volume group, create logical volume, format and mount
Create logical volume, create volume group, create physical volume, format and mount
Format and mount, create logical volume, create volume group, create physical volume
Create volume group, create physical volume, create logical volume, format and mount
Select the option that lists some common directories for Linux.
/bin, /etc, /home, /usr
/docs, /win, /mac, /sys
/apple, /windows, /data, /user
/main, /root, /temp, /files
Some popular Linux shells are:
Bash, Zsh, Fish, Tcsh
Notepad, WordPad, Paint, Calculator
Chrome, Firefox, Safari, Edge
Excel, PowerPoint, Access, OneNote
Fill in the blank: The /var directory contains ________.
rapidly changing files like logs
user home directories
system kernel files
device drivers
Fill in the blank: The /boot directory contains ________.
the kernel and files required for the initial boot process
user home directories and personal files
system log files and error reports
temporary files created by running processes
Fill in the blank: The /root directory is the home directory for ________.
the super user
regular users
the guest account
system processes
Fill in the blank: The /etc directory contains ________.
many configuration files
user home directories
system log files
temporary files
Fill in the blank: The /home directory is the home directory for ________.
users
system files
administrators
temporary files
Fill in the blank: The /bin directory contains ________.
binaries or programs
configuration files
user documents
system logs
