Chapter 8: Unix and Linux Operating Systems (Set-9)

When you need to search inside many files under a directory tree for a word like “error”, which approach is most suitable

A cat all files
B ls -R option
C grep -R option
D pwd -R option

Which grep option inverts the match and prints only lines that do NOT contain the pattern

A grep -v option
B grep -n option
C grep -i option
D grep -c option

Which grep option prints only the count of matching lines rather than the lines themselves

A grep -l option
B grep -c option
C grep -r option
D grep -s option

Which grep option prints only filenames that contain a match, not the matching lines

A grep -n option
B grep -i option
C grep -o option
D grep -l option

Which command searches for a string in files but also supports regular expressions for flexible matching

A grep tool
B cat tool
C tar tool
D mv tool

In Linux file viewing, which command is best to view compressed .gz logs without manual decompression

A gzcat command
B cat -z
C zcat command
D unzip cat

Which utility rotates and manages log files automatically on many Linux systems

A logrotate tool
B journalctl tool
C sysctl tool
D rsync tool

Which Linux file contains the main logrotate configuration on many systems

A /var/logrotate.conf
B /etc/logrotate.d
C /var/logrotate.d
D /etc/logrotate.conf

Which directory commonly stores per-service logrotate rule snippets

A /etc/rotate.d
B /var/logrotate.d
C /etc/logrotate.d
D /usr/logrotate.d

Which command shows the currently running processes in a detailed full-screen interactive view and allows sorting

A top command
B ps command
C who command
D df command

To list processes sorted by memory usage for a quick snapshot, which command is most suitable

A df -h command
B du -sh command
C who command
D ps aux –sort=-%mem

Which command reads a text file and outputs only selected columns based on whitespace by default

A awk tool
B cut tool
C paste tool
D join tool

Which tool is commonly used to do simple stream edits like replacing text patterns in output

A tar tool
B ping tool
C sed tool
D ln tool

When a script must stop immediately if a command fails, which exit code meaning is most commonly treated as success

A Exit code 1
B Exit code 0
C Exit code 2
D Exit code 127

Which exit code commonly indicates “command not found” in many shells

A Exit code 127
B Exit code 0
C Exit code 2
D Exit code 255

In Bash scripting, which operator tests if a file exists and is a regular file

A -d test
B -x test
C -r test
D -f test

Which test operator checks whether a path exists and is a directory

A -f test
B -s test
C -d test
D -n test

Which test operator checks if a file is executable by the current user

A -x test
B -r test
C -w test
D -f test

Which command changes the default permissions for new files by masking bits, not granting them

A chmod command
B umask command
C chown command
D chgrp command

Which default permission is typically created for new regular files before umask is applied

A 777 default
B 755 default
C 666 default
D 644 default

Which default permission is typically used as the base for new directories before umask

A 777 default
B 666 default
C 700 default
D 600 default

Which permission combination is required to list directory contents with ls successfully

A Write + execute
B Read + write
C Read only
D Read + execute

Which permission is required to create or delete files inside an existing directory

A Read + execute
B Read only
C Write + execute
D Execute only

Which command changes file permissions by applying a numeric mode like 640

A chmod 640
B chown 640
C chgrp 640
D umask 640

Which octal permission best matches “owner full, group read, others none” for a file

A 744 mode
B 740 mode
C 700 mode
D 640 mode

Which command creates a compressed tar archive and names the output file with -f

A tar -xzf
B tar -tzf
C tar -czf
D tar -rzf

Which tar option extracts a gzip-compressed archive named with -f

A tar -xzf
B tar -czf
C tar -tzf
D tar -uzf

Which command lists files inside a gzip-compressed tar archive without extracting

A tar -xzf
B tar -czf
C tar -lzf
D tar -tzf

When a service fails to start due to configuration errors, which command shows the most direct status and last logs together

A systemctl status
B systemctl enable
C systemctl list-units
D systemctl get-default

Which journalctl option shows only kernel messages, similar to kernel log view

A journalctl -b
B journalctl -u
C journalctl -k
D journalctl -f

Which command checks detailed distribution name and version on most modern Linux systems

A cat /etc/profile
B cat /etc/os-release
C cat /etc/fstab
D cat /etc/hosts

Which package tool installs a .deb file directly on Debian-based systems

A dpkg -i
B apt -i
C yum -i
D rpm -i

Which command removes a package on Debian-based systems while keeping configuration files

A apt purge
B dpkg -i
C dpkg -S
D apt remove

Which command removes a package and also deletes its configuration files on Debian systems

A apt remove
B apt update
C apt purge
D apt upgrade

On RPM systems, which command installs or upgrades a local RPM package file

A rpm -Uvh
B rpm -qa
C rpm -qi
D rpm -ql

Which tool is commonly preferred for remote backups because it copies only differences and preserves metadata

A mv tool
B rm tool
C cat tool
D rsync tool

Which command checks open ports and listening services using the legacy net-tools package

A netstat command
B ping command
C grep command
D top command

Which file stores SSH server configuration that controls root login and port settings

A /etc/ssh/ssh_config
B ~/.ssh/config
C /etc/ssh/sshd_config
D ~/.ssh/known_hosts

Which tool edits /etc/sudoers safely and checks syntax before saving

A nano tool
B visudo tool
C chmod tool
D usermod tool

Which command shows a file’s ownership and permissions for troubleshooting “Permission denied” quickly

A ls -l
B pwd -P
C cat -n
D who -a

Which command lists block storage devices like disks and partitions in a readable tree format

A lsof command
B lsmod command
C pstree command
D lsblk command

Which command displays UUIDs of partitions, helpful for stable /etc/fstab entries

A dfid command
B uuidgen command
C blkid command
D mountid command

Which Linux file shows currently mounted filesystems and mount options in a quick readable list

A /proc/mounts
B /etc/fstab
C /var/mounts
D /etc/mounts

Which command checks filesystem type and label information for a device partition

A lsblk command
B blkid command
C df command
D du command

Which command starts a one-time job to run at a specified time without cron repetition

A cron command
B anacron command
C at command
D nohup command

Which Linux feature runs scheduled jobs even if the system was off at the scheduled time, on many desktops

A anacron tool
B cron tool
C ssh tool
D sudo tool

Which tool checks and repairs ext filesystem inconsistencies, typically used on unmounted partitions

A chkntfs tool
B mount tool
C lsblk tool
D fsck tool

Which tool schedules disk checking automatically at boot based on mount count or time

A tune2fs tool
B tar tool
C chmod tool
D grep tool

When troubleshooting boot issues, which single-user recovery mode target is commonly used on systemd systems

A multi-user.target
B graphical.target
C rescue.target
D reboot.target

Which mode provides the most minimal emergency shell with very few services for deep recovery

A rescue.target
B emergency.target
C graphical.target
D multi-user.target

Leave a Reply

Your email address will not be published. Required fields are marked *