Chapter 8: Unix and Linux Operating Systems (Set-7)
In Unix/Linux, what term best describes a command-line interface program that reads commands and runs them
A Shell program
B Kernel module
C Desktop theme
D Device driver
A shell is the command interpreter that accepts typed commands, runs programs, and supports features like variables, scripts, pipes, and redirection. Common shells include bash and zsh.
Which Linux desktop environment is commonly known for a highly customizable GUI
A Bash shell
B Linux kernel
C KDE Plasma
D Cron daemon
KDE Plasma is a popular desktop environment offering a graphical interface with many customization options. It provides panels, widgets, and system settings, making desktop Linux easier to use.
Which directory is commonly used for optional third-party software installed separately from the OS base
A /etc directory
B /opt directory
C /bin directory
D /proc directory
/opt is often used for optional or vendor software packages that are not part of the core distribution. This keeps such software separate from standard system directories and reduces conflicts.
Which directory typically holds bootloader and kernel-related boot files on many systems
A /var directory
B /tmp directory
C /boot directory
D /home directory
/boot stores files needed during system startup, such as kernel images and bootloader configuration. Keeping boot files here helps the system load the kernel reliably at boot time.
Which directory is commonly used as a temporary mount location for removable media by admins
A /mnt directory
B /etc directory
C /sbin directory
D /usr directory
/mnt is a standard directory used for mounting filesystems temporarily, like external disks. It provides a clean place for admins to attach storage without affecting user directories.
Which directory is commonly used by desktop systems to auto-mount USB drives and DVDs
A /bin directory
B /proc directory
C /media directory
D /dev directory
Many desktop Linux systems mount removable media under /media, often inside a user-specific folder. This makes accessing USB drives and DVDs easier for normal users.
Which command displays the IP address information using modern iproute2 tooling
A ifconfig -a
B netstat -i
C ping -a
D ip addr
ip addr shows network interfaces and assigned IP addresses. It is the modern replacement for older tools and provides consistent output for IPv4 and IPv6 configuration checks.
Which command shows the system’s default gateway and routes in a compact form
A ip route
B ip link
C ip neigh
D ip rule
ip route prints routing entries, including the default gateway used for internet traffic. It helps diagnose wrong gateway issues and confirms how packets leave the system.
In Linux, which file concept best matches “a shortcut that stores a path to a target”
A Hard link
B Device file
C Symbolic link
D FIFO file
A symbolic link stores a pathname to another file or directory. It can cross filesystems and link to directories, but it may break if the target path changes or is removed.
Which command creates a hard link to an existing file on the same filesystem
A linkto command
B mkln command
C cp link
D ln command
ln source target creates a hard link, which points to the same inode as the original file. Both names refer to the same data, and the file remains until all links are removed.
Which command shows how many hard links a file currently has
A stat -u
B ls -l
C file -l
D du -l
In ls -l, a number appears after permissions indicating link count. For files, it shows how many hard links point to the same inode, useful when tracking shared file entries.
Which command displays the current shell’s environment variables in one list
A chmod command
B mount command
C printenv command
D mkdir command
printenv lists environment variables available to the current process. It helps verify settings like PATH, HOME, LANG, and proxy variables, especially when debugging scripts and user sessions.
Which built-in feature lets you create a short name for a longer command in the shell
A alias feature
B kernel feature
C mount feature
D cron feature
Aliases map a short name to a longer command, like alias ll=’ls -l’. They improve speed and consistency, but can also cause confusion if they override real commands.
Which command removes a previously set alias in a shell session
A unexport command
B unlink command
C unalias command
D unsetenv command
unalias name removes an alias definition. This is useful when an alias interferes with expected command behavior or when testing the original command without custom shortcuts.
In bash scripting, which symbol begins a comment that is ignored by the shell
A $ symbol
B # symbol
C & symbol
D | symbol
In shell scripts, # starts a comment (except in some special cases like #!). Comments help document what commands do, making scripts easier to maintain and debug.
Which first line makes a script run using Bash on most systems when executed directly
A #!/bin/sh
B #!/usr/bin/vi
C #!/etc/bash
D #!/bin/bash
The shebang #!/bin/bash tells the system to run the file using Bash. It enables direct execution like ./script.sh when execute permission is set for the script.
Which command makes a script executable for the file owner only using symbolic mode
A chmod g+x
B chmod o+x
C chmod u+x
D chmod a-w
chmod u+x script adds execute permission for the owner. This allows the owner to run the script while keeping group and others unchanged, supporting safer script sharing.
Which command changes the current user to root after asking for the root password
A su command
B sudo command
C ssh command
D id command
su switches to another user, commonly root, and usually requires that user’s password. It starts a new shell as that user, unlike sudo which runs specific commands with privileges.
Which file often controls system-wide environment settings for Bash interactive shells
A /etc/sudoers
B /etc/fstab
C /etc/bash.bashrc
D /etc/hosts
On many Debian-based systems, /etc/bash.bashrc holds system-wide settings for interactive Bash shells. It can set prompts, aliases, and environment tweaks applied to all users.
Which command shows file and directory permissions in a compact 10-character format
A pwd -l
B ls -l
C du -l
D df -l
ls -l shows permissions like drwxr-xr-x along with owner and group. This quick view helps diagnose access problems by revealing whether read, write, and execute bits are set.
For directories, which permission is required to enter the directory using cd
A Execute bit
B Write bit
C Read bit
D Sticky bit
On a directory, execute permission allows traversing into it and accessing entries if you know names. Read permission lists contents, but without execute you still cannot enter or access files.
Which command shows current running processes for all users in a full-format listing commonly
A ps -l
B ps -p
C ps aux
D ps -d
ps aux shows a wide list of processes with CPU and memory usage, user, and command details. It is commonly used to quickly inspect what’s running system-wide.
Which command sends a hangup-like signal often used to request a daemon reload
A kill -KILL
B kill -HUP
C kill -STOP
D kill -TERM
SIGHUP is often used to tell a daemon to reload configuration without full restart (if supported). It is helpful when changing config files and wanting changes applied with minimal disruption.
Which command pauses a running process without terminating it, using job control
A Ctrl+C
B Ctrl+R
C Ctrl+D
D Ctrl+Z
Ctrl+Z stops (suspends) the foreground process and returns control to the shell. The process can later be resumed in background using bg or brought back using fg.
Which command resumes a stopped job in the background in many shells
A bg command
B fg command
C jobs command
D kill command
bg continues a suspended job in the background. This is useful when a command was started in the foreground but you want to keep the terminal free while it completes.
Which command shows the full manual entry list matching a keyword topic
A uname command
B who command
C apropos command
D echo command
apropos keyword searches man page descriptions for the keyword and lists relevant commands. It is useful when you know the task but do not remember the exact command name.
Which command shows current logged-in username but not groups or IDs
A id command
B whoami command
C groups command
D last command
whoami prints only the effective username. It’s a simple way to confirm current identity, especially after switching users or using sudo in a terminal session.
Which command displays the current system hostname
A hostname command
B hostip command
C whohost command
D namehost command
hostname shows the system’s host name used for identification on a network. It helps confirm you are connected to the correct server during remote work and troubleshooting.
Which file usually stores the system hostname on many Linux distributions
A /etc/hosts
B /etc/resolv.conf
C /etc/hostname
D /etc/fstab
Many distributions store the persistent hostname in /etc/hostname. Changing it updates what the system uses across reboots, though some systems also manage hostname using systemd tools.
Which command changes the hostname temporarily until next reboot on many systems
A uname newname
B whoami newname
C chown newname
D hostname newname
Running hostname newname sets the hostname for the current session on many systems. For permanent changes, you usually update configuration files or use hostnamectl on systemd systems.
On systemd systems, which command is used to set a persistent hostname cleanly
A systemctl set-hostname
B journalctl set-hostname
C hostnamectl set-hostname
D hostctl set-name
hostnamectl set-hostname updates the system hostname in a systemd-friendly way. It applies immediately and persists across reboots, keeping related metadata consistent on modern Linux systems.
Which command shows active users and their current activity in a single short display
A w command
B who command
C id command
D ps command
w shows logged-in users and what they are doing, including terminal and running command. It is helpful for admins to quickly assess user activity on multi-user servers.
Which command displays the system’s currently running kernel release information
A uname -a
B name -r
C uname -r
D host -r
uname -r prints the kernel release version string. This helps verify which kernel is active after updates and aids compatibility checks for drivers and kernel modules.
Which command lists kernel modules currently loaded into the running kernel
A lspci command
B lsusb command
C lsof command
D lsmod command
lsmod shows loaded kernel modules and their usage counts. It helps troubleshoot hardware drivers and confirms whether required modules are active for devices and networking features.
Which command loads a kernel module into the running system, usually requiring admin rights
A moduleadd command
B modprobe command
C insuser command
D driveron command
modprobe loads modules and handles dependencies automatically. It’s preferred over low-level insertion because it can load required supporting modules, making driver management more reliable.
Which command removes a loaded kernel module when it is no longer needed
A modprobe -a
B lsmod -r
C modprobe -r
D rmmod -a
modprobe -r module removes a kernel module if it is not in use. It safely handles dependencies compared to direct removal and is useful during driver troubleshooting.
Which command shows the Linux distribution release details from a standard file
A cat /etc/os-release
B cat /etc/hostname
C cat /etc/fstab
D cat /etc/group
/etc/os-release contains identification data like distribution name and version. Viewing it helps confirm which distro you are on, which matters for package tools and service management commands.
Which package file format is used by Debian-based distributions
A .rpm package
B .msi package
C .deb package
D .pkg bundle
Debian-based systems use .deb packages managed by dpkg and apt. Understanding package format helps when installing offline files and choosing the correct tool for your distribution.
Which package file format is used by Red Hat family distributions
A .deb package
B .rpm package
C .dmg package
D .apk package
Red Hat–based systems use .rpm packages managed by tools like rpm and yum/dnf. The format supports signed packages and metadata used by repositories for updates.
Which command shows a list of all installed RPM packages on an RPM-based system
A rpm -qi
B rpm -ql
C rpm -qf
D rpm -qa
rpm -qa queries all installed packages and prints them. It helps audit software, confirm installation, and check whether needed tools are present during troubleshooting.
Which command shows details of a specific RPM package, such as version and description
A rpm -qa
B rpm -ql
C rpm -qi
D rpm -qf
rpm -qi package displays information like version, release, vendor, and summary. This helps verify correct package versions and understand what a package provides.
Which command lists files installed by a specific RPM package
A rpm -ql
B rpm -qi
C rpm -qa
D rpm -qR
rpm -ql package lists installed file paths from that package. This is useful when you need to locate configuration files, binaries, or documentation installed by a package.
In Debian systems, which command searches installed packages by name and status in one listing
A dpkg -i
B dpkg -l
C dpkg -r
D dpkg -S
dpkg -l lists packages and their status, showing whether they are installed. It is helpful to confirm installations and quickly check versions without using higher-level apt queries.
Which dpkg command finds which installed package owns a specific file path
A dpkg -l
B dpkg -i
C dpkg -S
D dpkg -P
dpkg -S /path/file identifies the package that installed that file. This is valuable when troubleshooting conflicts, missing files, or when you need to reinstall the owning package.
Which command checks the integrity of installed package files on many RPM-based systems
A rpm -V
B rpm -U
C rpm -e
D rpm -K
rpm -V package verifies installed files against package metadata, checking changes like missing files, altered permissions, or modified sizes. It helps detect corruption or unexpected changes.
Which Linux command changes the group ownership of a file to a new group
A chown command
B chmod command
C groups command
D chgrp command
chgrp group file changes the group owner. Group ownership controls access for team members and shared directories, helping multiple users collaborate using group read/write permissions.
Which command displays the system’s current date and time in the terminal
A cal command
B time command
C date command
D now command
date prints current date and time. It helps confirm system clock settings, correlate timestamps in logs, and verify time synchronization issues that can affect scheduled jobs and authentication.
Which command displays a calendar view for the current month in many Unix-like systems
A cal command
B date command
C time command
D month command
cal prints a simple text calendar. It’s useful for quick reference in terminals, especially on servers without a GUI, and helps plan cron schedules or maintenance windows.
Which command displays the current working directory but resolves physical paths and symlinks in many shells
A cd -P
B ls -P
C pwd -P
D du -P
pwd -P prints the physical directory path by resolving symbolic links. This helps when scripts or tools require the real filesystem path rather than a symlink-based working path.
Which command extracts a specific field from text output using a separator like “:” in many cases
A grep -d
B cut -d
C sort -d
D uniq -d
cut -d ‘:’ -f N splits lines using a delimiter and selects fields. It is commonly used to process files like /etc/passwd and extract columns for reports or scripts.