Chapter 8: Unix and Linux Operating Systems (Set-6)
On a Linux terminal, which key usually auto-completes commands and file names to reduce typing
A Enter key
B Tab key
C Esc key
D Space key
Explanation: The Tab key completes command names and paths in many shells like Bash. It improves speed and reduces mistakes, especially for long filenames. Double-Tab often lists available matching options.
To display a text file one screen at a time in a simple pager, which command is commonly used
A cat command
B touch command
C more command
D mv command
Explanation: more shows file content page-by-page. It is useful when files are long and you want controlled viewing. It is simpler than less but still common on many Unix-like systems.
Which command prints a short message or variable value directly to the terminal
A show command
B echo command
C print command
D write command
Explanation: echo displays text or variable values in the terminal. It is widely used in shell scripts for messages, debugging, and building output lines that can be redirected to files.
Which command changes the current working directory to the user’s home directory quickly
A cd /
B cd ..
C cd –
D cd ~
Explanation: cd ~ takes you to your home directory, like /home/user. It’s a fast way to return to your personal workspace from anywhere without remembering the full path.
Which command changes the current working directory to the previous directory you were in
A cd ~
B cd /
C cd –
D cd .
Explanation: cd – switches back to the last directory you visited. This is helpful when jumping between two folders repeatedly while editing files or running commands.
Which command displays the last few lines of a file by default, helpful for logs
A tail command
B head command
C wc command
D cut command
Explanation: tail shows the end of a file, usually the last 10 lines. Since logs grow at the end, it helps quickly view the most recent events and errors.
Which command prints only the first few lines of a file by default
A tail command
B head command
C sort command
D uniq command
Explanation: head shows the beginning of a file, usually the first 10 lines. It helps confirm file format, headers, or initial configuration settings without opening a full editor.
In Linux, which command displays the currently logged-in user sessions and terminals
A id command
B last command
C who command
D uname command
Explanation: who shows users currently logged in, along with terminal and login time. It helps check active sessions, especially on multi-user systems or servers.
Which command shows the numeric user ID and group IDs for the current user
A whoami command
B groups command
C pwd command
D id command
Explanation: id shows UID, primary GID, and supplementary groups. Permissions are checked using these IDs, so this command helps troubleshoot “permission denied” problems accurately.
Which command lists the groups that the current user belongs to
A id command
B groups command
C who command
D last command
Explanation: groups prints group membership. Being in the correct group can allow access to shared directories and files, so this command is useful during permission troubleshooting.
Which command changes a user’s password securely from the terminal
A passwd command
B pass command
C userpass command
D authset command
Explanation: passwd changes the user’s password and updates secure password data. Administrators can also change others’ passwords. Password rules may be enforced, like complexity or expiry policy.
Which command displays disk usage summary for a folder tree when used with suitable options
A df command
B ps command
C du command
D top command
Explanation: du estimates disk usage of files and directories. It helps identify large folders and manage storage. With options, it can summarize sizes in human-readable form.
Which command shows free and used space of each mounted filesystem
A du command
B df command
C free command
D ls command
Explanation: df reports disk space usage for mounted filesystems. It helps detect low disk space issues that can cause system errors, failed updates, and log write failures.
Which command displays free and used RAM and swap memory
A df command
B du command
C top command
D free command
Explanation: free shows memory usage including RAM and swap. It helps check whether the system is under memory pressure and whether swap usage is high, which can slow performance.
Which command checks network connectivity by sending ICMP echo requests
A ssh command
B scp command
C ping command
D grep command
Explanation: ping tests reachability and measures response time. It confirms basic network path, but it does not guarantee that specific services like HTTP or SSH ports are open.
Which command securely logs in to a remote Linux server using encryption
A ftp command
B ssh command
C telnet command
D rlogin command
Explanation: SSH provides encrypted remote login and commands. It protects passwords and data from interception and supports stronger authentication like SSH keys for better security.
Which command copies a local file to a remote host securely using SSH transport
A scp command
B cp command
C mv command
D tar command
Explanation: scp uses SSH to copy files securely between local and remote systems. It is easy for simple transfers and keeps data encrypted during transmission.
In Linux directory structure, which folder holds essential system commands needed for basic operation
A /home directory
B /var directory
C /bin directory
D /tmp directory
Explanation: /bin contains essential commands like ls, cp, and cat. These utilities are required for basic operation and recovery, so they are available even in minimal environments.
Which directory usually stores system configuration files and service settings
A /usr directory
B /etc directory
C /proc directory
D /dev directory
Explanation: /etc stores configuration files for the system and services. Network settings, user configuration files, and service configs are often kept here, requiring admin privileges to modify.
Which directory typically stores changing data like logs, caches, and spool files
A /bin directory
B /etc directory
C /proc directory
D /var directory
Explanation: /var holds variable data that changes during normal operation. This includes logs under /var/log, caches, and mail spools. It helps separate changing data from system binaries.
Which directory contains device files representing disks, terminals, and other hardware devices
A /usr directory
B /home directory
C /dev directory
D /etc directory
Explanation: /dev contains device files that represent hardware and virtual devices. Linux treats many devices like files, allowing software to interact with them using standard file operations.
Which directory shows kernel and process information through a virtual filesystem
A /var directory
B /proc directory
C /tmp directory
D /home directory
Explanation: /proc is generated by the kernel and exposes system and process details. It helps monitor CPU, memory, and running processes. Files here are virtual, not stored on disk.
In Linux permissions, which letter represents write permission
A w permission
B r permission
C x permission
D d permission
Explanation: w allows modifying a file or creating and deleting directory entries. Without write permission, you cannot save changes to files or create new files in a directory.
In Linux permissions, which letter indicates execute permission
A w permission
B r permission
C x permission
D s permission
Explanation: Execute permission allows running a file as a program or script. For directories, execute permission allows entering the directory and accessing items if their names are known.
Which command changes file permissions using numeric modes like 644 or 755
A chown command
B chmod command
C chgrp command
D umask command
Explanation: chmod changes permissions of files and directories. Numeric modes represent read, write, and execute permissions for owner, group, and others, allowing consistent permission setting quickly.
Which command changes the owner of a file to another user
A chmod command
B mv command
C cp command
D chown command
Explanation: chown changes file ownership to a new user, and optionally a group. It is often used after copying files or setting up services that require specific ownership.
Which command runs a single command with administrator privileges for permitted users
A su command
B top command
C sudo command
D ps command
Explanation: sudo lets authorized users run commands as root or another user. It reduces the need for direct root login and improves auditing by logging administrative actions.
Which command shows a continuously updating list of processes and resource usage
A top command
B ps command
C grep command
D cat command
Explanation: top displays processes and updates regularly, showing CPU and memory usage. It helps identify which program is slowing the system and supports sorting and process management.
Which command shows a snapshot list of processes currently running
A top command
B ps command
C who command
D df command
Explanation: ps shows process information at that moment, such as PID and command name. It is useful to find whether a program is running and can be combined with grep for searching.
Which command stops a process by sending a signal using its PID
A stop command
B end command
C kill command
D close command
Explanation: kill sends signals to processes. By default it requests termination. If needed, stronger signals can be used, but that may cause unsaved data loss, so use carefully.
Which tool displays help pages for commands and options from the terminal
A help command
B docs command
C infofile command
D man command
Explanation: man opens manual pages describing commands, options, and usage. It is the standard offline reference for Linux commands and helps users understand proper syntax.
Which command searches inside a file for matching text patterns and prints matching lines
A grep command
B find command
C locate command
D sort command
Explanation: grep searches for patterns in files or command output. It is widely used for log analysis and configuration checks. Options allow case-insensitive search and showing line numbers.
Which command creates an empty file if it does not exist
A create command
B newfile command
C touch command
D makefile command
Explanation: touch creates a new empty file or updates timestamps if it exists. It is useful for placeholders, quick file creation, and triggering builds that depend on timestamps.
Which command displays file contents in the terminal without opening an editor
A nano command
B cat command
C vi command
D edit command
Explanation: cat prints a file’s contents to the terminal. It is useful for quick viewing, combining files, and piping content into other commands for processing.
Which command shows the path of the current working directory
A path command
B where command
C locate command
D pwd command
Explanation: pwd prints the current directory path. It helps confirm location before file operations, especially when using relative paths that depend on the working directory.
Which Linux feature allows running multiple commands at scheduled times repeatedly
A root account
B kernel module
C cron scheduler
D GUI desktop
Explanation: Cron runs scheduled tasks based on a time pattern in crontab files. It is used for routine automation like backups, cleanup tasks, log rotation, and periodic reports.
Which system command installs packages from online repositories in Debian/Ubuntu systems
A yum install
B apt install
C rpm install
D tar install
Explanation: apt install installs packages from configured repositories on Debian-based systems. It downloads required files and resolves dependencies automatically, making it easy to install software safely.
Which command updates the package list from repositories on Debian-based systems
A apt update
B apt upgrade
C apt remove
D apt search
Explanation: apt update refreshes package information from repositories. It should be run before installing or upgrading to ensure the system knows the latest versions and security updates available.
Which command upgrades installed packages to newer versions on Debian-based systems
A apt update
B apt install
C apt upgrade
D apt purge
Explanation: apt upgrade updates installed packages to newer versions based on the latest package lists. It helps apply bug fixes and security patches while keeping the system up to date.
Which package manager command installs software on many Red Hat family systems
A apt install
B yum install
C dpkg install
D zip install
Explanation: yum install installs packages on many Red Hat-based systems. It manages dependencies and downloads software from configured repositories. Newer systems may use dnf, but yum is widely known.
Which command shows the system’s kernel name and version details
A whoami -r
B pwd -r
C echo -r
D uname -r
Explanation: uname -r prints the kernel release version. This helps verify kernel updates, driver compatibility, and system details during troubleshooting.
Which directory commonly stores user personal files like documents and downloads
A /etc directory
B /home directory
C /bin directory
D /sbin directory
Explanation: /home contains user home folders where personal files and settings are stored. Keeping user data separate from system directories helps protect system files and supports multi-user environments.
Which command checks whether a command exists and shows its location in PATH
A which command
B where command
C show command
D findcmd command
Explanation: which displays the path of an executable found in PATH. It helps confirm which version will run when multiple versions exist, reducing confusion during administration.
Which command shows detailed file information like permissions, owner, and size
A ls -a
B ls -t
C ls -l
D ls -R
Explanation: ls -l prints long format output including permissions, owner, group, file size, and time. It is essential for checking access rights and diagnosing permission issues.
Which command shows hidden files along with normal files in a directory
A ls -l
B ls -a
C ls -h
D ls -p
Explanation: ls -a includes hidden files beginning with dot. Many important settings are stored in hidden files like .bashrc, so this option helps when configuring user environments.
Which command creates a new directory and also creates missing parent directories
A mkdir -a
B mkdir -x
C mkdir -d
D mkdir -p
Explanation: mkdir -p creates parent directories automatically. It prevents errors when intermediate folders do not exist and is very useful in scripts and when setting up nested project structures.
Which command moves a file to a new name or location
A cp command
B rm command
C mv command
D cd command
Explanation: mv moves or renames files and directories. It does not copy data like cp; it relocates the same file entry, making renaming and reorganizing fast and simple.
Which command copies files from source to destination without removing the original
A mv command
B cp command
C rm command
D ls command
Explanation: cp duplicates files so the original remains unchanged. It is used for backups and making copies for editing. Recursive options allow copying complete directories as well.
Which command removes an empty directory only, and fails if the directory contains files
A rmdir command
B rm command
C deldir command
D erasedir command
Explanation: rmdir deletes only empty directories, which helps avoid accidental deletion of important files. For non-empty directories, rm with recursive options is needed and should be used carefully.
Which command opens a simple terminal editor suitable for beginners to edit text files
A vi editor
B grep tool
C nano editor
D tar tool
Explanation: Nano is a simple terminal-based text editor with visible shortcut keys. It is easier for beginners than modal editors and is commonly used for quick edits in configuration files.