Chapter 8: Unix and Linux Operating Systems (Set-2)
In Linux, which command quickly shows the currently logged-in username in the terminal
A uname command
B whereis command
C whoami command
D which command
whoami prints the effective username of the current session. It is useful to confirm whether you are a normal user or using elevated privileges before running sensitive commands.
Which command displays system information such as kernel name and version in Linux
A uname command
B ps command
C df command
D du command
uname shows system details like kernel name and version. With common options, it can also show machine hardware type and operating system information for quick identification.
Which command shows the current date and time directly in the terminal
A time command
B date command
C cal command
D clock command
date prints the current system date and time. It’s useful for checking system clock accuracy, timestamps in logs, and confirming time settings on servers.
In Linux, which command clears the terminal screen without closing the session
A exit command
B reset command
C clear command
D close command
clear refreshes the terminal display by moving content out of view. It does not delete files or stop programs; it simply helps keep the terminal readable during work.
Which symbol refers to the current user’s home directory in many Linux shells
A ~ symbol
B / symbol
C . symbol
D .. symbol
~ expands to the current user’s home directory, such as /home/user. It makes navigation faster, like cd ~ to return home from any directory.
When working in Linux paths, what does “.” represent in a command
A Root directory
B Home directory
C System directory
D Current directory
. refers to the current directory. It is commonly used in relative paths and sometimes to run a program in the current folder, like ./script.sh.
In Linux path navigation, what does “..” represent
A Parent directory
B Current directory
C Root directory
D Home directory
.. points to the directory one level above the current location. It helps move upward in the filesystem tree, such as cd .. to go back one folder.
Which option is a GUI desktop environment commonly used on Linux systems
A Bash shell
B Linux kernel
C GNOME desktop
D Cron service
GNOME is a graphical desktop environment that provides windows, menus, and a user interface. It runs on top of the Linux system, making desktop use easier.
Which package manager command is commonly used on Debian/Ubuntu-based systems
A yum command
B apt command
C rpm command
D pacman command
apt is used on Debian/Ubuntu systems to install, update, and remove software packages from repositories. It automatically handles dependencies, making software management easier.
Which package manager tool is traditionally associated with Red Hat family systems
A yum tool
B apt tool
C dpkg tool
D brew tool
yum has been widely used on Red Hat-based systems to manage RPM packages and dependencies. Modern systems often use dnf, but yum remains a common basic term.
In Linux, which low-level tool directly installs or queries Debian package files
A apt tool
B yum tool
C dpkg tool
D snap tool
dpkg works with .deb package files on Debian-based systems. Unlike apt, it does not fetch from repositories by itself and may not resolve dependencies automatically.
Which directory commonly stores user-installed programs and read-only shared data
A /tmp directory
B /proc directory
C /dev directory
D /usr directory
/usr contains many user-level applications, libraries, and documentation. It includes subfolders like /usr/bin and /usr/lib, and typically holds large parts of installed software.
Which Linux directory often contains user command binaries on many systems
A /etc/bin folder
B /usr/bin folder
C /var/bin folder
D /home/bin folder
/usr/bin stores many commonly used executable commands. While /bin holds essential commands, /usr/bin contains a broader set of programs installed for users.
Which directory commonly stores system log files like authentication and service logs
A /etc/log folder
B /usr/log folder
C /var/log folder
D /home/log folder
/var/log contains many system logs, such as service messages and authentication logs. Reading logs helps diagnose errors, check security events, and verify system activity.
What is a “mount point” in Linux filesystem usage
A Attachment directory
B File permission
C Disk partition
D Shell command
A mount point is a directory where another filesystem is attached, such as a USB drive mounted at /mnt/usb. After mounting, its files appear inside that directory path.
Which command is commonly used to create a compressed gzip tar archive
A zip utility
B cat utility
C tar with gzip
D grep utility
tar can bundle files and, with gzip options, compress them into a smaller archive. This is widely used for backups and transfers while preserving directory structure and permissions.
Which compressed format is commonly produced by tar combined with gzip
A .tar.gz file
B .iso file
C .exe file
D .dll file
A .tar.gz file is a tar archive compressed using gzip. It’s common on Linux for distributing source code and backups because it combines many files into one compressed package.
Which command shows the first lines of a text file, useful for quick preview
A tail command
B head command
C less command
D more command
head prints the first lines of a file by default. It helps quickly check file headers, formats, or initial log entries without opening the entire file in an editor.
Which command shows the last lines of a log file, useful for recent events
A head command
B grep command
C tail command
D mkdir command
tail prints the last lines of a file, helpful for logs where newest messages appear at the end. With options, it can also follow live updates as logs grow.
Which command helps view long text output page-by-page inside the terminal
A less command
B pwd command
C touch command
D whoami command
less lets you scroll through large files and command output. It is more flexible than older pagers and supports searching within content, making it ideal for logs and configs.
Which command finds the full path of an executable based on the current PATH
A whereis command
B locate command
C who command
D which command
which shows where an executable will run from by searching the PATH. It helps confirm you’re using the correct version when multiple programs share the same name.
Which command searches for a command’s binary, source, and manual locations
A which command
B grep command
C whereis command
D cat command
whereis locates related files for a command, such as binaries and man pages. It’s useful when troubleshooting missing documentation or verifying installed components.
Which command searches a database to locate files by name quickly
A locate command
B find command
C grep command
D mv command
locate searches a prebuilt database of file paths, making it very fast. Results may be slightly outdated until the database is updated, unlike find which scans live.
Which command searches directories in real time to find files matching conditions
A locate command
B find command
C which command
D uname command
find scans directories and can match names, types, sizes, and more. It provides accurate real-time results and supports actions like deleting or executing commands on matches.
What is the main purpose of the PATH environment variable in Linux
A Encrypt files
B Set disk quota
C Find executables
D Create users
PATH lists directories searched for commands. When you type a command name, the shell checks each PATH directory to find the executable, so correct PATH settings improve usability and safety.
Which environment variable commonly stores the current user’s home directory path
A HOME variable
B PATH variable
C SHELL variable
D USER variable
HOME points to the user’s home directory location, such as /home/user. Many programs use it for storing user configuration files and default save locations.
Which file name is commonly used for the Bash shell startup configuration for a user
A .kernelrc file
B .bashrc file
C .loginsh file
D .systemrc file
.bashrc runs when an interactive Bash shell starts. It is used for aliases, environment variables, and prompt settings, helping customize the terminal experience per user.
Which symbol is commonly used as a wildcard to match any sequence of characters
A ? wildcard
B # wildcard
C * wildcard
D @ wildcard
* matches any number of characters in filenames. For example, *.txt matches all files ending in .txt. Wildcards help select multiple files quickly without typing each name.
Which wildcard matches exactly one character in many Linux shells
A ? wildcard
B * wildcard
C ! wildcard
D % wildcard
? matches exactly one character. For example, file?.txt matches file1.txt or fileA.txt but not file10.txt. It is useful for precise pattern matching.
Which command shows group membership information for a user session
A chmod command
B chown command
C rm command
D groups command
groups displays the groups a user belongs to. Group membership affects file permissions and access to resources, so this command helps diagnose permission-related issues.
Which file typically stores user account information like usernames and user IDs
A /etc/shadow file
B /var/log file
C /etc/passwd file
D /home/passwd file
/etc/passwd contains basic user account entries such as username, UID, GID, and home directory. Password hashes are not stored here on modern systems for security reasons.
Which file typically stores password hashes and is readable only by root
A /etc/passwd file
B /etc/shadow file
C /etc/group file
D /var/shadow file
/etc/shadow stores password hashes and password policy details. It is restricted because exposing hashes can support password attacks, so normal users cannot read it.
In Linux, which file stores group definitions and group IDs
A /etc/group file
B /etc/shadow file
C /etc/fstab file
D /var/group file
/etc/group lists system groups and their IDs, and may include members. Groups are important for shared permissions, letting multiple users access the same resources safely.
Which command is commonly used to change a user’s password in Linux
A password command
B passset command
C userpass command
D passwd command
passwd changes the password for the current user, and administrators can change others’ passwords. It updates secure password data and may enforce policy like minimum length or expiry.
Which Linux command displays recent login history of users
A who command
B id command
C last command
D ps command
last reads login records and shows who logged in and when, including reboots. It helps track usage, troubleshoot access issues, and review security-related activity.
Which command shows who is currently logged in to the system
A who command
B last command
C uname command
D top command
who displays users currently logged in and their terminals. It is useful on multi-user systems to see active sessions and verify remote logins.
Which command shows a user’s UID, GID, and group memberships in one output
A whoami command
B id command
C chmod command
D df command
id prints the numeric user ID, primary group ID, and supplementary groups. This helps diagnose permission issues because access checks use these IDs, not just usernames.
What is the main security advantage of SSH over Telnet
A Faster display
B Smaller commands
C Encrypted traffic
D No authentication
SSH encrypts data, protecting passwords and commands from being intercepted on the network. Telnet sends data in plain text, making it unsafe on untrusted networks.
Which Linux command tests whether an SSH service is reachable on a host using a secure login attempt
A ssh command
B ping command
C traceroute command
D ifconfig command
Running ssh user@host attempts a secure connection to the SSH server. It verifies network reachability and authentication access, and can also be used for remote command execution.
Which command shows network interface details on many older Linux systems
A ifconfig command
B grep command
C chmod command
D tar command
ifconfig displays network interfaces and IP details on many systems, especially older ones. Modern systems often use ip, but ifconfig remains a common basic command.
Which modern command is commonly recommended to view IP addresses and interfaces
A netcat command
B ip command
C echo command
D more command
The ip command is part of iproute2 and is the modern tool for network configuration. It shows addresses, links, and routes more consistently than older tools.
Which command can show the system’s routing table and network routes
A rm route
B tar route
C ip route
D cd route
ip route displays the routing table, showing how traffic leaves the system and which gateway is used. It helps troubleshoot internet access, wrong gateways, and subnet issues.
Which command prints a systemd service status and recent logs for that service
A service start
B syslog view
C logctl check
D systemctl status
systemctl status shows whether a service is running, its recent log messages, and any errors. It is a key command on systemd-based Linux systems for service troubleshooting.
Which command is used to start a service immediately on a systemd-based Linux system
A systemctl start
B systemctl stop
C systemctl list
D systemctl show
systemctl start launches a service right away. It does not necessarily enable it at boot; that is done separately. This separation helps control runtime behavior and startup policy.
Which systemd command enables a service to start automatically at boot
A systemctl start
B systemctl reload
C systemctl enable
D systemctl mask
systemctl enable configures a service to start during boot by setting up required links or unit settings. It ensures the service comes up after reboot without manual action.
Which directory commonly stores vendor systemd unit files on many Linux systems
A /etc/systemd/system
B /usr/lib/systemd/system
C /home/systemd/system
D /tmp/systemd/system
Vendor-provided unit files are commonly stored under /usr/lib/systemd/system on many distributions. Admin overrides and custom units are usually placed in /etc/systemd/system to survive package updates.
Which command checks whether a command exists and shows its type in the shell
A type command
B file command
C sort command
D tee command
type tells whether a name is a built-in, alias, function, or external command. It helps avoid confusion when aliases override real commands or when multiple versions exist.
Which utility can schedule a one-time job to run later, unlike repeated cron jobs
A top command
B df command
C at command
D ps command
at schedules a command to run once at a specified time. It is useful for delayed tasks like a one-time backup or restart, while cron is typically used for repeated schedules.
Which basic firewall tool is commonly referenced for Linux host firewall management
A iptables tool
B notepad tool
C package tool
D mount tool
iptables has been widely used to manage packet filtering rules in Linux. Many systems now use nftables or front-ends, but iptables remains a basic term for firewall control.
Which basic troubleshooting step helps confirm a DNS name resolves to an IP address
A chmod command
B mkdir command
C tar command
D nslookup command
nslookup queries DNS and shows the IP address returned for a hostname. If DNS fails, you may have connectivity or DNS server issues, even if raw IP ping works.