What is the primary purpose of the chmod command in Linux?
- Changing file permissions
- Creating new directories
- Deleting files
- Displaying file contents
The primary purpose of the chmod command in Linux is to change file permissions. It allows you to modify the access permissions of files and directories. You can use it to control who can read, write, and execute a particular file or directory.
The _________ special variable in a shell script provides an option for random number generation.
- $RANDOM
- $PID
- $USER
- $HOME
The $RANDOM special variable in a shell script provides an option for random number generation. You can use $RANDOM to generate random integers within a specific range. It's commonly used for tasks like creating random passwords or simulating randomness in scripts.
A system administrator wants to dynamically alter the kernel's behavior without rebooting. What feature of the Linux kernel allows for this?
- Sysctl
- init.d
- Kernel Modules
- Udev
The Sysctl feature allows a system administrator to dynamically alter the kernel's behavior without rebooting. It provides a way to modify kernel parameters at runtime, making it a powerful tool for fine-tuning system behavior.
Which operator would you use in Bash to check if two strings are equal?
- =
- ==
- #NAME?
- equals
In Bash, to check if two strings are equal, you use the == operator. It is used in conditional statements to compare two strings. Remember to enclose the strings in double square brackets for the comparison, like [[ string1 == string2 ]].
What is the primary distinction between top and htop when monitoring system processes?
- top is a basic system monitoring tool, while htop is an advanced alternative.
- top displays real-time data, while htop provides more interactivity and customization.
- top is text-based, while htop offers a graphical interface.
- top shows memory usage, while htop focuses on CPU usage.
The primary distinction between top and htop is that top displays real-time data about system processes, whereas htop provides more interactivity and customization. htop allows users to sort and filter processes, view detailed information, and easily send signals to processes directly from the interface. While both tools show similar information, htop offers a more user-friendly and feature-rich experience for process monitoring.
The set -x command in a shell script is used to enable __________ for debugging purposes.
- Debugging mode
- Profiling mode
- Tracing mode
- Script execution
The set -x command in a shell script is used to enable debugging mode for debugging purposes. When this mode is activated, the shell script will display each command before it is executed, making it useful for tracking the script's execution and finding errors.
While configuring a VPN on a Linux server, you're asked to ensure that the VPN supports both L2TP and IPsec. Which software solution would you likely consider?
- OpenVPN
- StrongSwan
- WireGuard
- PPTP
To support both L2TP and IPsec in a VPN setup, you would likely consider using StrongSwan. StrongSwan is an open-source IPsec-based VPN solution that supports both L2TP and IPsec, providing secure and reliable VPN connectivity.
Which file in the /proc directory can be inspected to gather information about the system's CPU?
- /proc/cpuinfo
- /proc/meminfo
- /proc/filesystems
- /proc/sys/kernel
The /proc/cpuinfo file in the /proc directory is used to gather information about the system's CPU. It provides details about the processor, including its model, speed, and features. This is a valuable resource for understanding the CPU's capabilities and characteristics.
You've written a script that processes a list of files. You want to ensure that even if a filename contains spaces, it's treated as a single argument. Which built-in variable should you modify?
- IFS (Internal Field Separator)
- PS1 (Prompt String 1)
- OIFS (Original Internal Field Separator)
- FS (Field Separator)
To ensure that filenames with spaces are treated as single arguments in a script, you should modify the OIFS (Original Internal Field Separator) variable. This allows you to temporarily change the IFS value to a specific character (e.g., newline) and then restore it to its original value after processing the filenames. This ensures that spaces don't break the filenames into multiple arguments.
The _________ feature in btrfs allows for creating a readable/writable "snapshot" of a subvolume.
- snapshot
- backup
- mirroring
- subvolume copy
The correct option is snapshot. Btrfs, a modern file system for Linux, provides a feature that allows for creating a readable/writable "snapshot" of a subvolume. Snapshots are a powerful tool for data protection and efficient use of disk space.