You've been given a task to review the startup scripts of a system. Where would you primarily look to find the initialization scripts for different run levels?
- /etc/init.d
- /etc/rc.d
- /etc/runlevels
- /usr/bin/init
To find the initialization scripts for different run levels, you would primarily look in the /etc/init.d directory. This directory contains the scripts and links used for managing services and their run levels on a Linux system.
How can a user put a running process into the background from the terminal?
- Press Ctrl + Z
- Press Ctrl + B
- Press Ctrl + C
- Press Ctrl + D
To put a running process into the background from the terminal, you can press Ctrl + Z. This action suspends the process and places it in the background, allowing you to continue using the terminal for other tasks while the process runs in the background.
When managing disk partitions, the term _________ refers to a method that allows for spanning a filesystem across multiple physical disks.
- RAID
- LVM
- EXT4
- XFS
When managing disk partitions, the term "LVM" (Logical Volume Manager) refers to a method that allows for spanning a filesystem across multiple physical disks. LVM provides flexibility in managing storage by creating logical volumes that can span multiple physical drives.
In a shell script, the _________ command is used to parse options and arguments.
- grep
- sed
- getopts
- awk
In a shell script, the getopts command is used to parse options and arguments. It's particularly useful for handling command-line options and arguments in a structured way.
You're troubleshooting a network issue and want to see if any dropped packets are occurring on your server's main network interface. Which command would you likely use?
- ifconfig
- netstat
- tcpdump
- iperf
To monitor network traffic and identify dropped packets, you would likely use the "tcpdump" command. Tcpdump is a packet analyzer that allows you to capture and inspect network packets on a specific network interface.
You are writing a Bash script to automate server maintenance. You want to check if a directory exists before trying to create it. Which command would you use within your script to check for the directory's existence?
- if [ -d "$directory" ]
- if [ -e "$directory" ]
- if [ -f "$directory" ]
- if [ -s "$directory" ]
The correct command to check if a directory exists in a Bash script is if [ -d "$directory" ]. This condition tests whether the given directory path, represented by $directory, exists as a directory. Option 2 -e checks for the existence of any file or directory, not specifically a directory. Option 3 -f checks for regular files, and Option 4 -s checks if the file has a size greater than zero.
If you want to shift the positional parameters to the left, which command would you use?
- shift
- mv
- leftshift
- change
The correct answer is a) shift. The 'shift' command is used in shell scripts to shift the positional parameters to the left. When you use 'shift' without an argument, it discards the value of $1 and shifts the rest of the positional parameters, updating $1 to the previous $2, $2 to the previous $3, and so on. This is useful when processing command-line arguments.
For VPN connections in Linux, which tool can be used to set up a tunnel based on SSL/TLS?
- OpenVPN
- IPsec
- PPTP
- SSH
OpenVPN is a widely-used tool in Linux for setting up VPN connections with SSL/TLS-based tunnels. It provides a secure and reliable way to establish encrypted communication over the internet or private networks, ensuring data privacy and integrity.
Which command is used to add a new user in Linux?
- useradd
- adduser
- newuser
- createuser
The correct command to add a new user in Linux is useradd. This command creates a new user account and associated files. It is used to specify user details like the home directory and shell.
Which file defines the rules for the sudo command in Linux?
- /etc/sudoers
- /etc/sudo
- /etc/sudoconfig
- /etc/sudopolicy
The file that defines the rules for the sudo command in Linux is /etc/sudoers. This file specifies who is allowed to run what commands with administrative privileges and how. It's a crucial part of managing user access and privileges in a Linux system.