L4 - Lieutenant
QUESTION 1 Which command is used to display Access Control Lists and show fine-grained permissions on a file in Ubuntu?
A) chmod B) getfacl C) setfacl D) id
QUESTION 2 What is the primary purpose of the rsync command compared to scp?
A) It provides encrypted connections only B) It synchronizes files efficiently by transferring only changed data C) It can only work with local directories D) It requires manual authentication for each file
QUESTION 3 Which command traces system calls made by a process and is essential for low-level debugging?
A) lsof B) strace C) watch D) time
QUESTION 4 What does the lsof -i :8080 command do?
A) Lists all files in the current directory B) Lists open files and network connections on port 8080 C) Displays memory statistics D) Shows kernel ring buffer messages
QUESTION 5 Which command re-runs another command at specified intervals for live system monitoring?
A) vmstat B) iostat C) watch D) journalctl
QUESTION 6 What is the purpose of the time command in Ubuntu?
A) To display the current system time B) To measure real, user, and system execution time of a command C) To set the system clock D) To schedule tasks for later execution
QUESTION 7 Which command is used for secure remote login to a system?
A) scp B) rsync C) ssh D) nc
QUESTION 8 What does scp stand for and what is its primary function?
A) Secure Copy Protocol - copies files securely over SSH B) System Control Protocol - manages system processes C) Secure Connection Protocol - establishes encrypted connections D) Simple Copy Protocol - copies files locally
QUESTION 9 Which command is used for network testing and debugging by reading and writing raw network data?
A) ssh B) rsync C) nc (netcat) D) scp
QUESTION 10 What does the setfacl command do?
A) Displays Access Control Lists B) Modifies Access Control Lists and adds user-specific permissions C) Changes file ownership D) Sets file read/write permissions
QUESTION 11 Which command displays user and group IDs and is used to verify privilege context?
A) whoami B) id C) groups D) sudo
QUESTION 12 What is the purpose of the mountpoint command?
A) To mount a filesystem B) To check if a directory is a mount point C) To list all mounted filesystems D) To unmount a filesystem
QUESTION 13 Which command flushes write buffers to disk to prevent data loss?
A) fallocate B) sync C) mountpoint D) fsck
QUESTION 14 What does fallocate -l 1G test.img do?
A) Deletes a 1GB file B) Preallocates 1GB of space for a file C) Formats a 1GB partition D) Copies 1GB of data
QUESTION 15 Which command is used to query systemd logs in Ubuntu?
A) dmesg B) journalctl C) syslog D) tail
QUESTION 16 What does the dmesg command display?
A) System error messages only B) Kernel ring buffer messages C) Application logs D) Network connection logs
QUESTION 17 Which command reports memory and CPU statistics for performance monitoring?
A) iostat B) vmstat C) free D) top
QUESTION 18 What does the xclip command do?
A) Clips files into smaller pieces B) Provides clipboard access from the terminal C) Compresses files D) Displays clipboard contents
QUESTION 19 Which command aligns text output into columns for improved readability?
A) sort B) column C) paste D) cut
QUESTION 20 What is the purpose of the select command in Bash?
A) Selects files matching a pattern B) Creates interactive shell menus C) Selects specific columns from text D) Selects processes to terminate
QUESTION 21 Which command manages user sessions in systemd environments?
A) usermod B) loginctl C) useradd D) passwd
QUESTION 22 What does the ulimit command do?
A) Displays the maximum file size B) Sets resource usage limits to prevent resource exhaustion C) Lists all running processes D) Unlocks user accounts
QUESTION 23 Which command views or sets the system hostname in Ubuntu?
A) hostnamectl B) hostname C) uname D) systemctl
QUESTION 24 What does the poweroff command do?
A) Suspends the system to RAM B) Shuts down the system safely C) Restarts the system D) Logs out the current user
QUESTION 25 Which of the following is NOT a command in the L4 syllabus?
A) strace B) tar C) journalctl D) vmstat
QUESTION 26 What is the correct syntax to copy a file securely over SSH to a remote server?
A) ssh file.txt user@server:/path B) scp file.txt user@server:/path C) rsync file.txt user@server:/path D) nc file.txt user@server:/path
QUESTION 27 Which command would you use to synchronize a large directory efficiently, transferring only changed data?
A) scp -r src/ user@server:/dest B) rsync -av src/ dest/ C) cp -r src/ dest/ D) ssh user@server cp -r src/ dest/
QUESTION 28 What does watch -n 2 free -h do?
A) Displays free memory once B) Displays free memory every 2 seconds repeatedly C) Frees up 2GB of memory D) Watches for memory changes every 2 minutes
QUESTION 29 Which command would you use to test if a specific port is open on localhost?
A) ssh localhost 80 B) nc -zv localhost 80 C) ping localhost:80 D) lsof localhost 80
QUESTION 30 What is the primary difference between getfacl and chmod?
A) getfacl is faster than chmod B) getfacl shows fine-grained permissions while chmod only shows basic permissions C) chmod is deprecated in favor of getfacl D) They do exactly the same thing
QUESTION 31 How would you add read permission for a specific user to a file using ACLs?
A) chmod u+r file.txt B) setfacl -m u:user:r file.txt C) getfacl -m u:user:r file.txt D) chown user file.txt
QUESTION 32 Which command shows disk I/O statistics and helps detect bottlenecks?
A) vmstat B) iostat C) dmesg D) journalctl
QUESTION 33 What does journalctl -xe do?
A) Exports journal logs to a file B) Queries systemd logs with extended information C) Executes a command from the journal D) Erases all journal logs
QUESTION 34 Which command displays the last 10 lines of kernel messages?
A) dmesg | tail -10 B) journalctl -n 10 C) tail -10 /var/log/kernel D) less dmesg
QUESTION 35 What is the purpose of running time python script.py?
A) To schedule the script to run at a specific time B) To measure the execution time of the script C) To display the current time before running the script D) To set a timeout for the script
QUESTION 36 Which command would you use to check if /mnt/data is actually a mounted filesystem?
A) ls /mnt/data B) mount | grep /mnt/data C) mountpoint /mnt/data D) df /mnt/data
QUESTION 37 What does echo "text" | xclip -selection clipboard do?
A) Displays text on the screen B) Saves text to a file C) Copies text to the system clipboard D) Sends text to a remote server
QUESTION 38 Which command creates an interactive menu in a Bash script?
A) menu B) select C) dialog D) zenity
QUESTION 39 What does ulimit -n display?
A) The number of open files B) The maximum number of file descriptors allowed C) The number of users logged in D) The network connection limit
QUESTION 40 Which command would you use to list all active user sessions in a systemd environment?
A) who B) w C) loginctl list-sessions D) ps aux
QUESTION 41 Which command is used to trace system calls and is essential for understanding low-level process behavior?
A) lsof B) strace C) watch D) journalctl
QUESTION 42 What does lsof stand for?
A) List System Operations Files B) List Open Files C) List Operating System Functions D) List Output File System
QUESTION 43 Which command would you use to monitor CPU and memory usage in real-time at 2-second intervals?
A) watch -n 2 vmstat B) vmstat 2 C) iostat 2 D) dmesg -f 2
QUESTION 44 What is the output of time ls command?
A) Lists files with timestamps B) Shows real, user, and system execution time of the ls command C) Displays the current time D) Lists files sorted by time
QUESTION 45 Which networking command is used for secure file transfer and is simple but less efficient than rsync?
A) ssh B) scp C) rsync D) nc
QUESTION 46 What does the -av flag combination do in rsync -av src/ dest/?
A) Archive mode and verbose output B) All files and verify C) Append and validate D) Automatic and verbose
QUESTION 47 Which command tests network connectivity by reading and writing raw network data?
A) ping B) ssh C) nc (netcat) D) telnet
QUESTION 48 What is the purpose of nc -zv localhost 8080?
A) Compresses files on port 8080 B) Tests if port 8080 is open and listening C) Connects to a service on port 8080 D) Displays verbose output of port 8080
QUESTION 49 Which command displays fine-grained file permissions using Access Control Lists?
A) ls -l B) stat C) getfacl D) chmod -l
QUESTION 50 What does setfacl -m u:alice:rwx file.txt do?
A) Removes all permissions from alice B) Grants read, write, and execute permissions to user alice on file.txt C) Sets file ownership to alice D) Displays alice's permissions on file.txt
QUESTION 51 Which command displays the current user's ID and group IDs?
A) whoami B) groups C) id D) sudo -l
QUESTION 52 What does id -u display?
A) The user's login name B) The user's numeric ID only C) The user's group ID D) The user's home directory
QUESTION 53 Which command checks if a directory is a mount point in a script?
A) mount B) df C) mountpoint D) lsblk
QUESTION 54 What is the purpose of the sync command?
A) Synchronizes files between directories B) Flushes write buffers to disk C) Synchronizes system time D) Syncs with remote servers
QUESTION 55 Which command preallocates disk space for a file?
A) dd B) fallocate C) truncate D) touch
QUESTION 56 What does fallocate -l 500M test.img create?
A) A 500MB file with random data B) A 500MB preallocated file space C) A 500MB compressed file D) A 500MB backup file
QUESTION 57 Which command queries systemd journal logs?
A) syslog B) journalctl C) tail -f /var/log/syslog D) dmesg
QUESTION 58 What does journalctl -n 50 display?
A) The last 50 lines of kernel messages B) The last 50 journal entries C) 50 lines of system errors D) The next 50 journal entries
QUESTION 59 Which command displays kernel ring buffer messages?
A) journalctl B) dmesg C) syslog D) tail
QUESTION 60 What does dmesg | grep -i error do?
A) Displays all kernel messages B) Filters kernel messages for lines containing "error" (case-insensitive) C) Counts error messages D) Removes error messages from kernel log
QUESTION 61 Which command reports memory and CPU statistics?
A) free B) top C) vmstat D) ps
QUESTION 62 What does vmstat 1 5 do?
A) Displays memory stats once B) Displays memory stats every 1 second for 5 iterations C) Displays 5 memory snapshots D) Monitors for 5 minutes
QUESTION 63 Which command shows disk I/O statistics and requires installation first?
A) vmstat B) iostat C) iotop D) df
QUESTION 64 What does xclip -selection clipboard do?
A) Displays clipboard contents B) Clears the clipboard C) Copies stdin to the system clipboard D) Pastes clipboard contents to stdout
QUESTION 65 Which command aligns columnar data for better readability?
A) sort B) column C) paste D) awk
QUESTION 66 What does the select command do in Bash?
A) Selects files matching a pattern B) Creates an interactive menu for user selection C) Selects specific columns from input D) Selects processes to run
QUESTION 67 Which command manages user login sessions in systemd?
A) systemctl B) loginctl C) userctl D) sessionctl
QUESTION 68 What does loginctl show-user username do?
A) Shows the user's login history B) Displays detailed information about a user's sessions C) Shows the user's password D) Displays user's file permissions
QUESTION 69 Which command sets resource usage limits for processes?
A) limit B) ulimit C) setlimit D) resource
QUESTION 70 What does ulimit -c unlimited do?
A) Limits CPU usage B) Sets unlimited core dump file size C) Limits memory usage D) Sets unlimited connections
QUESTION 71 Which command would you use to trace all system calls made by a running process for debugging purposes?
A) lsof -p B) strace -p C) watch -p D) time -p
QUESTION 72 What does strace -e trace=open ls do?
A) Traces only open file system calls made by ls B) Opens and traces all ls commands C) Traces all system calls of ls D) Opens a trace file for ls
QUESTION 73 Which command lists all network connections and open ports?
A) netstat B) lsof -i C) ss D) nc
QUESTION 74 What does lsof -i TCP:22 display?
A) All TCP connections on port 22 B) All processes using SSH port 22 C) All files related to SSH D) TCP configuration for port 22
QUESTION 75 Which command continuously monitors a specific command's output?
A) tail -f B) watch C) monitor D) observe
QUESTION 76 What does watch -d free -h do?
A) Displays free memory with differences highlighted B) Deletes free memory display C) Watches disk free space D) Displays free memory once
QUESTION 77 Which command measures the performance of a Python script?
A) python -m cProfile script.py B) time python script.py C) strace python script.py D) watch python script.py
QUESTION 78 What does time -v command display?
A) Verbose output of the command B) Detailed timing and resource usage information C) Version information D) Video output of command execution
QUESTION 79 Which command is used to establish a secure shell connection to a remote server?
A) telnet user@server B) ssh user@server C) rsh user@server D) ftp user@server
QUESTION 80 What does ssh -v user@server do?
A) Verifies the connection B) Provides verbose output for debugging SSH connection issues C) Validates the user D) Displays SSH version
QUESTION 81 Which command copies files from a local machine to a remote server?
A) ssh file.txt user@server:/path B) scp file.txt user@server:/path C) cp file.txt user@server:/path D) rsync file.txt user@server:/path
QUESTION 82 What does scp -r directory/ user@server:/path do?
A) Recursively copies a directory to a remote server B) Removes a directory from remote server C) Restores a directory from remote server D) Renames a directory on remote server
QUESTION 83 Which command synchronizes files with only changed data being transferred?
A) scp B) cp C) rsync D) mv
QUESTION 84 What does rsync -av --delete src/ dest/ do?
A) Deletes the source directory B) Synchronizes files and deletes files in dest that don't exist in src C) Deletes all files in destination D) Archives and deletes source files
QUESTION 85 Which command tests network connectivity to a specific port?
A) ping host B) nc -zv host port C) ssh host D) telnet host
QUESTION 86 What does nc -l -p 8080 do?
A) Connects to port 8080 B) Listens on port 8080 for incoming connections C) Lists processes on port 8080 D) Logs connections to port 8080
QUESTION 87 Which command displays file permissions in ACL format?
A) ls -l B) stat C) getfacl D) chmod -l
QUESTION 88 What does getfacl -R directory/ do?
A) Recursively displays ACLs for all files in directory B) Removes ACLs from directory C) Resets ACLs to default D) Restores ACLs from backup
QUESTION 89 Which command modifies Access Control Lists for a file?
A) getfacl B) setfacl C) chmod D) chown
QUESTION 90 What does setfacl -x u:user file.txt do?
A) Executes a command as user B) Removes all ACL entries for user from file.txt C) Exports ACLs to a file D) Extends ACLs for user
QUESTION 91 Which command displays user and group information?
A) whoami B) groups C) id D) users
QUESTION 92 What does id -G display?
A) The user's primary group ID B) All group IDs the user belongs to C) The user's login name D) The user's home directory
QUESTION 93 Which command verifies if a directory is mounted?
A) mount B) df C) mountpoint D) lsblk
QUESTION 94 What does mountpoint -q /mnt/data && echo "mounted" do?
A) Mounts /mnt/data B) Checks if /mnt/data is mounted and prints "mounted" if true C) Queries mount information D) Displays mount point details
QUESTION 95 Which command ensures data is written to disk?
A) write B) sync C) flush D) save
QUESTION 96 What does sync && echo "Data synced" do?
A) Synchronizes files between directories B) Flushes buffers to disk and prints confirmation C) Synchronizes system time D) Syncs with remote servers
QUESTION 97 Which command preallocates space for a file without writing data?
A) dd B) touch C) fallocate D) truncate
QUESTION 98 What does fallocate -l 2G large_file.img create?
A) A 2GB file with random data B) A 2GB preallocated file C) A 2GB compressed file D) A 2GB backup file
QUESTION 99 Which command queries systemd journal logs with filtering?
A) tail -f /var/log/syslog B) journalctl C) dmesg D) syslog
QUESTION 100 What does journalctl -u ssh do?
A) Displays all journal entries B) Filters journal entries for the SSH service C) Updates SSH service logs D) Uninstalls SSH service logs
ANSWERS
Question 1:
Correct Answer: B) getfacl Explanation: The getfacl command displays Access Control Lists (ACLs) and shows fine-grained permissions on files. This is essential at the L4 level for understanding advanced permission management beyond basic chmod. Question 2:
Correct Answer: B) It synchronizes files efficiently by transferring only changed data Explanation: rsync is a fast file synchronization tool that transfers only the changed portions of files, making it much more efficient than scp which copies entire files. This is a key advantage for large-scale file transfers and backups at the Lieutenant level.
Question 3:
Correct Answer: B) strace Explanation: strace traces system calls made by a process and is essential for low-level debugging to understand how programs interact with the operating system kernel. Question 4:
Correct Answer: B) Lists open files and network connections on port 8080 Explanation: lsof -i :8080 lists open files and network sockets, specifically showing what's using port 8080. This is useful for finding port and file locks. Question 5:
Correct Answer: C) watch Explanation: The watch command executes another command repeatedly at specified intervals (default 2 seconds), making it useful for live system monitoring. Question 6:
Correct Answer: B) To measure real, user, and system execution time of a command Explanation: The time command measures the execution time of a command, showing real time, user CPU time, and system CPU time. It's used for performance profiling. Question 7:
Correct Answer: C) ssh Explanation: ssh (Secure Shell) is the primary tool for securely logging into a remote system with encrypted communication. Question 8:
Correct Answer: A) Secure Copy Protocol - copies files securely over SSH Explanation: scp copies files securely over SSH connections. While simple, it's less efficient than rsync for large transfers. Question 9:
Correct Answer: C) nc (netcat) Explanation: nc (netcat) reads and writes raw network data and is used for port testing and network debugging. Question 10:
Correct Answer: B) Modifies Access Control Lists and adds user-specific permissions Explanation: setfacl modifies Access Control Lists, allowing you to add fine-grained user-specific permissions beyond standard chmod. Question 11:
Correct Answer: B) id Explanation: The id command displays user and group IDs and is used to verify the current privilege context. Question 12:
Correct Answer: B) To check if a directory is a mount point Explanation: mountpoint checks whether a directory is a mount point, which is useful in scripts and safety checks. Question 13:
Correct Answer: B) sync Explanation: The sync command flushes write buffers to disk, ensuring data is written and preventing data loss. Question 14:
Correct Answer: B) Preallocates 1GB of space for a file Explanation: fallocate -l 1G test.img preallocates 1GB of disk space for a file, commonly used in storage testing. Question 15:
Correct Answer: B) journalctl Explanation: journalctl queries systemd logs and is the primary log inspection tool in modern Ubuntu systems. Question 16:
Correct Answer: B) Kernel ring buffer messages Explanation: dmesg displays kernel ring buffer messages and is used for hardware debugging and system diagnostics. Question 17:
Correct Answer: B) vmstat Explanation: vmstat reports memory and CPU statistics, making it useful for performance monitoring and identifying bottlenecks. Question 18:
Correct Answer: B) Provides clipboard access from the terminal Explanation: xclip copies terminal output to the clipboard, bridging CLI and GUI workflows. Question 19:
Correct Answer: B) column Explanation: The column command aligns text output into columns, improving readability of tabular data. Question 20:
Correct Answer: B) Creates interactive shell menus Explanation: The select command creates interactive shell menus in Bash scripts, useful for user input selection. Question 21:
Correct Answer: B) loginctl Explanation: loginctl manages user sessions in systemd environments, allowing you to view and control active sessions. Question 22:
Correct Answer: B) Sets resource usage limits to prevent resource exhaustion Explanation: ulimit controls resource usage limits (like file descriptors, memory, CPU time) to prevent processes from exhausting system resources.
Question 23:
Correct Answer: A) hostnamectl Explanation: hostnamectl is used to view or set the system hostname in Ubuntu, updating the system identity. Question 24:
Correct Answer: B) Shuts down the system safely Explanation: The poweroff command safely shuts down the system and requires root access. Question 25:
Correct Answer: B) tar Explanation: tar is not part of the L4 Lieutenant syllabus. The other commands (strace, journalctl, vmstat) are all included in L4. Question 26:
Correct Answer: B) scp file.txt user@server:/path Explanation: scp (Secure Copy) is the correct command to copy files securely over SSH to a remote server. Question 27:
Correct Answer: B) rsync -av src/ dest/ Explanation: rsync is the most efficient for large directory synchronization as it transfers only changed data, making it faster than scp or cp. Question 28:
Correct Answer: B) Displays free memory every 2 seconds repeatedly Explanation: watch -n 2 executes the command every 2 seconds, so this continuously monitors free memory at 2-second intervals. Question 29:
Correct Answer: B) nc -zv localhost 80 Explanation: nc -zv (netcat with zero I/O mode and verbose) tests if a port is open and listening on the specified host. Question 30:
Correct Answer: B) getfacl shows fine-grained permissions while chmod only shows basic permissions Explanation: getfacl displays Access Control Lists with fine-grained user-specific permissions, while chmod only handles basic read/write/execute permissions. Question 31:
Correct Answer: B) setfacl -m u:user:r file.txt Explanation: setfacl -m (modify) with u:user:r adds read permission for a specific user to a file using ACLs. Question 32:
Correct Answer: B) iostat Explanation: iostat shows disk I/O statistics and helps identify I/O bottlenecks in system performance. Question 33:
Correct Answer: B) Queries systemd logs with extended information Explanation: journalctl -xe queries systemd logs and shows extended information, useful for detailed log inspection. Question 34:
Correct Answer: A) dmesg | tail -10 Explanation: dmesg displays kernel messages, and piping to tail -10 shows the last 10 lines of kernel output. Question 35:
Correct Answer: B) To measure the execution time of the script Explanation: The time command measures real, user, and system execution time of a command, used for performance profiling. Question 36:
Correct Answer: C) mountpoint /mnt/data Explanation: mountpoint checks if a directory is a mount point, which is useful in scripts and safety checks. Question 37:
Correct Answer: C) Copies text to the system clipboard Explanation: xclip -selection clipboard copies terminal output to the system clipboard, bridging CLI and GUI workflows. Question 38:
Correct Answer: B) select Explanation: The select command creates interactive shell menus in Bash scripts for user input selection. Question 39:
Correct Answer: B) The maximum number of file descriptors allowed Explanation: ulimit -n displays the maximum number of open file descriptors allowed for the current process. Question 40:
Correct Answer: C) loginctl list-sessions Explanation: loginctl list-sessions lists all active user sessions in systemd environments, providing session management information.
Question 41:
Correct Answer: B) strace Explanation: strace traces system calls made by a process and is essential for understanding low-level process behavior and debugging. Question 42:
Correct Answer: B) List Open Files Explanation: lsof stands for "List Open Files" and displays open files and network sockets used by processes. Question 43:
Correct Answer: B) vmstat 2 Explanation: vmstat 2 displays memory and CPU statistics every 2 seconds, providing real-time monitoring of system performance. Question 44:
Correct Answer: B) Shows real, user, and system execution time of the ls command Explanation: The time command measures and displays the real, user, and system execution time of the command that follows it. Question 45:
Correct Answer: B) scp Explanation: scp (Secure Copy) is simple to use for secure file transfer over SSH but is less efficient than rsync for large transfers. Question 46:
Correct Answer: A) Archive mode and verbose output Explanation: In rsync, -a enables archive mode (preserves permissions, timestamps, etc.) and -v provides verbose output. Question 47:
Correct Answer: C) nc (netcat) Explanation: nc (netcat) reads and writes raw network data and is used for network testing and debugging. Question 48:
Correct Answer: B) Tests if port 8080 is open and listening Explanation: nc -zv localhost 8080 uses zero I/O mode (-z) and verbose output (-v) to test if port 8080 is open. Question 49:
Correct Answer: C) getfacl Explanation: getfacl displays Access Control Lists with fine-grained file permissions beyond basic read/write/execute. Question 50:
Correct Answer: B) Grants read, write, and execute permissions to user alice on file.txt Explanation: setfacl -m u:alice:rwx file.txt modifies ACLs to grant rwx permissions to user alice on the specified file. Question 51:
Correct Answer: C) id Explanation: The id command displays the current user's numeric ID, group IDs, and group names. Question 52:
Correct Answer: B) The user's numeric ID only Explanation: id -u displays only the user's numeric ID (UID), without group information. Question 53:
Correct Answer: C) mountpoint Explanation: mountpoint checks if a directory is a mount point, which is useful in scripts for safety checks. Question 54:
Correct Answer: B) Flushes write buffers to disk Explanation: The sync command flushes write buffers to disk, ensuring data is written and preventing data loss. Question 55:
Correct Answer: B) fallocate Explanation: fallocate preallocates disk space for a file, commonly used in storage testing and performance scenarios. Question 56:
Correct Answer: B) A 500MB preallocated file space Explanation: fallocate -l 500M test.img creates a 500MB file with preallocated space on disk. Question 57:
Correct Answer: B) journalctl Explanation: journalctl queries systemd journal logs and is the primary log inspection tool in modern Ubuntu systems. Question 58:
Correct Answer: B) The last 50 journal entries Explanation: journalctl -n 50 displays the last 50 entries from the systemd journal. Question 59:
Correct Answer: B) dmesg Explanation: dmesg displays kernel ring buffer messages and is used for hardware debugging and system diagnostics. Question 60:
Correct Answer: B) Filters kernel messages for lines containing "error" (case-insensitive) Explanation: dmesg | grep -i error pipes kernel messages to grep and filters for lines containing "error" with case-insensitive matching. Question 61:
Correct Answer: C) vmstat Explanation: vmstat reports memory and CPU statistics, making it useful for performance monitoring and identifying bottlenecks. Question 62:
Correct Answer: B) Displays memory stats every 1 second for 5 iterations Explanation: vmstat 1 5 displays vmstat output every 1 second, repeating 5 times total. Question 63:
Correct Answer: B) iostat Explanation: iostat shows disk I/O statistics and helps detect I/O bottlenecks, but requires the sysstat package to be installed first. Question 64:
Correct Answer: C) Copies stdin to the system clipboard Explanation: xclip -selection clipboard reads from stdin and copies the content to the system clipboard. Question 65:
Correct Answer: B) column Explanation: The column command aligns text into columns, improving readability of tabular data. Question 66:
Correct Answer: B) Creates an interactive menu for user selection Explanation: The select command creates an interactive shell menu in Bash scripts, allowing users to select from options. Question 67:
Correct Answer: B) loginctl Explanation: loginctl manages user login sessions in systemd environments, allowing session viewing and control. Question 68:
Correct Answer: B) Displays detailed information about a user's sessions Explanation: loginctl show-user username displays detailed information about a specific user's active sessions. Question 69:
Correct Answer: B) ulimit Explanation: ulimit sets resource usage limits for processes to prevent resource exhaustion. Question 70:
Correct Answer: B) Sets unlimited core dump file size Explanation: ulimit -c unlimited removes the limit on core dump file size, allowing full core dumps for debugging.
Question 71:
Correct Answer: B) strace -p Explanation: strace -p attaches to a running process and traces all system calls it makes, essential for debugging. Question 72:
Correct Answer: A) Traces only open file system calls made by ls Explanation: strace -e trace=open ls filters strace output to show only "open" system calls, reducing noise in debugging. Question 73:
Correct Answer: B) lsof -i Explanation: lsof -i lists all network connections and open ports, showing which processes are using network resources. Question 74:
Correct Answer: B) All processes using SSH port 22 Explanation: lsof -i TCP:22 displays all processes that have TCP connections on port 22 (SSH). Question 75:
Correct Answer: B) watch Explanation: The watch command continuously re-runs a command at intervals, displaying output updates in real-time. Question 76:
Correct Answer: A) Displays free memory with differences highlighted Explanation: watch -d highlights differences between successive outputs, making it easier to spot changes in memory usage. Question 77:
Correct Answer: B) time python script.py Explanation: The time command measures execution time of a Python script, showing real, user, and system time. Question 78:
Correct Answer: B) Detailed timing and resource usage information Explanation: time -v provides verbose output including CPU usage, memory, I/O statistics, and other resource metrics. Question 79:
Correct Answer: B) ssh user@server Explanation: ssh (Secure Shell) is the standard command for establishing secure remote connections to servers. Question 80:
Correct Answer: B) Provides verbose output for debugging SSH connection issues Explanation: ssh -v enables verbose mode, showing detailed connection information useful for troubleshooting SSH problems. Question 81:
Correct Answer: B) scp file.txt user@server:/path Explanation: scp (Secure Copy) copies files from local to remote machines over SSH securely. Question 82:
Correct Answer: A) Recursively copies a directory to a remote server Explanation: scp -r enables recursive copying, allowing entire directories to be transferred to remote servers. Question 83:
Correct Answer: C) rsync Explanation: rsync is designed to synchronize files efficiently by transferring only changed data, making it faster than scp. Question 84:
Correct Answer: B) Synchronizes files and deletes files in dest that don't exist in src Explanation: rsync --delete removes files from the destination that don't exist in the source, keeping directories in sync. Question 85:
Correct Answer: B) nc -zv host port Explanation: nc -zv tests network connectivity to a specific host and port without sending data. Question 86:
Correct Answer: B) Listens on port 8080 for incoming connections Explanation: nc -l -p 8080 puts netcat in listen mode, waiting for incoming connections on port 8080. Question 87:
Correct Answer: C) getfacl Explanation: getfacl displays file permissions in Access Control List format with fine-grained details. Question 88:
Correct Answer: A) Recursively displays ACLs for all files in directory Explanation: getfacl -R recursively shows ACLs for all files and subdirectories in a directory tree. Question 89:
Correct Answer: B) setfacl Explanation: setfacl modifies Access Control Lists, allowing you to set fine-grained permissions on files. Question 90:
Correct Answer: B) Removes all ACL entries for user from file.txt Explanation: setfacl -x removes ACL entries; -x u:user removes all entries for a specific user. Question 91:
Correct Answer: C) id Explanation: The id command displays comprehensive user and group information including UIDs and GIDs. Question 92:
Correct Answer: B) All group IDs the user belongs to Explanation: id -G displays all group IDs (both primary and supplementary) that the user is a member of. Question 93:
Correct Answer: C) mountpoint Explanation: mountpoint checks if a directory is a mount point, returning 0 if true, useful in scripts. Question 94:
Correct Answer: B) Checks if /mnt/data is mounted and prints "mounted" if true Explanation: mountpoint -q silently checks if a directory is mounted; the && operator executes the echo only if true. Question 95:
Correct Answer: B) sync Explanation: The sync command flushes all pending write operations to disk, ensuring data persistence. Question 96:
Correct Answer: B) Flushes buffers to disk and prints confirmation Explanation: sync flushes buffers, and && ensures the echo only runs if sync succeeds, providing confirmation. Question 97:
Correct Answer: C) fallocate Explanation: fallocate preallocates disk space for a file without writing actual data, making it fast. Question 98:
Correct Answer: B) A 2GB preallocated file Explanation: fallocate -l 2G creates a 2GB file with preallocated space on disk, useful for storage testing. Question 99:
Correct Answer: B) journalctl Explanation: journalctl queries systemd journal logs and supports various filtering options for targeted log inspection. Question 100:
Correct Answer: B) Filters journal entries for the SSH service Explanation: journalctl -u ssh displays only journal entries related to the SSH service, useful for service-specific debugging.
Last updated