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

In Linux, which command shows the full path to the current user’s home directory variable quickly

A echo $PATH
B echo $SHELL
C echo $USER
D echo $HOME

Which command prints the list of directories searched when you run commands by name

A echo $HOME
B echo $SHELL
C echo $PATH
D echo $LANG

Which command prints the current shell name or path using an environment variable

A echo $HOME
B echo $SHELL
C echo $USER
D echo $PWD

Which command prints the current working directory using an environment variable

A echo $OLDPWD
B echo $HOME
C echo $PATH
D echo $PWD

Which variable stores the previous directory used before the last cd operation

A OLDPWD variable
B HOME variable
C PATH variable
D SHELL variable

Which command lists file permissions for a specific file without listing the whole directory

A chmod -l file
B ls -l filename
C stat -l file
D cat -l file

In Linux, which command displays detailed file metadata including inode, timestamps, and permission bits

A file command
B type command
C name command
D stat command

Which command shows inode numbers along with filenames in a directory listing

A ls -a
B ls -h
C ls -i
D ls -t

Which command searches for files by name under a directory path and supports filters like type and size

A locate command
B find command
C grep command
D whereis command

Which command requires an updated database and provides very fast filename searching

A find command
B grep command
C ps command
D locate command

Which command prints the path that will be used for an executable command based on PATH order

A command -v
B file -v
C whereis -v
D grep -v

Which command searches manual page descriptions for a keyword like “compression”

A man command
B info command
C apropos command
D help command

In Linux, which command shows a file’s contents with line numbers for easier reference

A cat command
B nl command
C less command
D head command

Which command prints only the unique lines after sorting to remove duplicates properly

A uniq | sort
B cat | uniq
C grep | uniq
D sort | uniq

Which command prints a sorted list in reverse order without changing file content

A sort -r
B sort -u
C sort -n
D sort -k

Which command sorts numbers correctly instead of treating them as plain text

A sort -r
B sort -n
C sort -u
D sort -h

Which command shows the first N lines of a file when used with the -n option

A tail -n
B wc -n
C head -n
D cut -n

Which command shows the last N lines of a file when used with the -n option

A head -n
B tail -n
C less -n
D cut -n

Which command follows a log file live and prints new lines as they are appended

A head -f
B grep -f
C sort -f
D tail -f

Which signal is commonly used to request a program to reload configuration without stopping

A SIGKILL signal
B SIGSTOP signal
C SIGHUP signal
D SIGINT signal

Which key combination sends SIGINT to stop a foreground command safely

A Ctrl+Z
B Ctrl+C
C Ctrl+R
D Ctrl+D

Which key combination suspends a running foreground process and returns control to shell

A Ctrl+C
B Ctrl+D
C Ctrl+R
D Ctrl+Z

Which command resumes the most recently stopped job in the foreground

A bg command
B jobs command
C fg command
D kill command

Which command shows background and stopped jobs associated with the current shell session

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

Which operator connects command output to another command input in a pipeline

A > operator
B < operator
C & operator
D | operator

Which redirection overwrites a file with command output

A >> operator
B > operator
C 2> operator
D < operator

Which redirection appends output to an existing file without deleting old content

A > operator
B < operator
C >> operator
D | operator

Which redirection sends a file as input to a command that reads from standard input

A < operator
B > operator
C >> operator
D | operator

Which command changes the group owner of a file for shared access management

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

Which command changes both owner and group using user:group format

A chgrp user:group
B chown user:group
C chmod user:group
D usermod user:group

31) Which directory commonly stores vendor-provided systemd service unit files on many systems

A /etc/systemd/system
B /home/systemd/system
C /tmp/systemd/system
D /usr/lib/systemd/system

Which directory is typically used for local overrides and custom systemd unit files

A /usr/lib/systemd/system
B /var/systemd/system
C /etc/systemd/system
D /tmp/systemd/system

Which command shows whether a systemd service is running and shows recent log lines

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

Which systemctl command starts a service immediately without changing boot behavior

A systemctl enable
B systemctl start
C systemctl mask
D systemctl daemon-reload

Which command enables a systemd service so it starts automatically at boot

A systemctl start
B systemctl status
C systemctl reload
D systemctl enable

Which command reloads systemd unit definitions after editing unit files

A systemctl reload
B systemctl restart
C systemctl daemon-reload
D systemctl reenable

Which command displays logs stored by systemd journal for the current boot only

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

Which journalctl option continuously follows new log entries like tail -f

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

Which command checks active listening ports and sockets using modern tooling

A cat command
B ss command
C du command
D ps command

Which file typically stores allowed SSH public keys for passwordless authentication

A known_hosts file
B ssh_config file
C authorized_keys file
D shadow file

Which file stores known host fingerprints to warn about SSH server identity changes

A authorized_keys file
B sshd_config file
C resolv.conf file
D known_hosts file

Which command prints kernel messages and hardware events from the kernel ring buffer

A dmesg command
B history command
C last command
D who command

Which directory is recommended for locally installed software separate from distro packages

A /usr/bin
B /usr/local
C /etc/local
D /var/local

Which directory often stores optional vendor applications installed outside standard package locations

A /sbin directory
B /bin directory
C /opt directory
D /proc directory

Which file contains local host-to-IP mappings that can override DNS resolution

A /etc/resolv.conf
B /etc/fstab
C /etc/shadow
D /etc/hosts

Which file commonly defines DNS servers used for name resolution on many systems

A /etc/hosts
B /etc/resolv.conf
C /etc/hostname
D /etc/profile

Which command calculates a SHA-256 checksum for verifying file integrity

A md5sum command
B cksum command
C sha256sum command
D sum command

Which command creates a compressed gzip file from a single file

A gzip command
B tar command
C zip command
D rsync command

Which command bundles many files into one archive, often combined with gzip compression

A zip command
B tar command
C cat command
D grep command

Which command schedules repeated jobs based on time patterns, such as daily backups

A ssh service
B sudo service
C cron service
D init service

Leave a Reply

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