Which option of the crontab command opens the current user's crontab in an editor?
Correct Answer: E
Explanation The -e option of the crontab command opens the current user's crontab in an editor. The editor used is determined by the environment variables VISUAL or EDITOR. If neither of these variables is set, the default editor is vi. The user can edit the crontab file to add, modify, or delete cron jobs, which are scheduled commands or scripts that run at a specified time or interval. The crontab file has the following format: minute hour day-of-month month day-of-week command Each field can be a number, a range, a list, or an asterisk (*), which means all possible values. The command can be any valid shell command or script. For example, the following crontab entry runs the backup.sh script every day at 2:30 AM: 30 2 * * * /home/user/backup.sh To save and install the crontab file, the user needs to exit the editor. The crontab command will check the syntax of the file and report any errors. If the file is valid, it will be installed and the cron daemon will execute the cron jobs according to the schedule. References: crontab(1) - Linux manual page FreeBSD Handbook: 11.6. Scheduling Tasks
Question 12
What command creates a new directory? (Specify ONLY the command without any path or parameters.)
Correct Answer:
mkdir Explanation The command mkdir (short for make directory) creates a new directory with the specified name. The command takes one or more arguments, which are the names of the directories to be created. If the name contains spaces or other special characters, it should be enclosed in quotes. For example, mkdir "My Documents" creates a directory named My Documents. The command also accepts some options, such as -p, which creates the parent directories if they do not exist, or -m, which sets the permissions of the new directory. For example, mkdir -p -m 755 /usr/local/bin creates the directory /usr/local/bin and its parent directories /usr and /usr/local, and sets the permissions of /usr/local/bin to 755 (read, write and execute for the owner, read and execute for the group and others). References: [mkdir(1) - FreeBSD Manual Pages] [How to Create a Directory in Linux - Linuxize]
Question 13
Which command and option can be used to perform a reverse DNS lookup?
Correct Answer: A
Explanation This command and option can be used to perform a reverse DNS lookup, which is the process of finding the domain name or hostname associated with an IP address. The dig command is a tool that can query DNS servers for various types of records, such as A, MX, NS, PTR, etc. The -x option tells dig to perform a reverse DNS lookup by sending a PTR query to the DNS server. For example, to perform a reverse DNS lookup for the IP address 8.8.8.8, the following command can be used: dig -x 8.8.8.8 The output of this command will show the PTR record for 8.8.8.8, which is dns.google. This means that the hostname for 8.8.8.8 is dns.google. Reverse DNS lookups are useful for verifying the identity of a host, checking for mail server configuration, or troubleshooting network problems
Question 14
Which command sets 192.168 1 1 as the default gateway on a BSD system'?
Correct Answer: A
Explanation The command route add default 192.168.1.1 is used to set the default gateway on a BSD system. This command adds a default route to the routing table, directing traffic to the specified gateway IP address when no other route matches. References: FreeBSD Handbook - Routing OpenBSD Change, Add or Display Default Gateway
Question 15
Which line in a cron job runs myscript once per hour?
Correct Answer: B
Explanation The cron job syntax consists of five fields that specify the time and date of execution, followed by the command or script to run. The fields are: minute, hour, day of month, month, and day of week. Each field can have a specific value, a range, a list, a wildcard (), or a step value. The wildcard () means any possible value for that field. The option B sets the minute field to 0 and the hour field to *, which means the script will run at the 0th minute of every hour, regardless of the day, month, or weekday. This is equivalent to once per hour. The other options are either invalid syntax or do not match the desired frequency. For example, option A sets all fields to *, which means the script will run every minute of every hour of every day, month, and weekday. Option C sets the minute field to * and the hour field to 0, which means the script will run every minute of the 0th hour, or once per day at midnight. Option D has a typo (o instead of *) and option E sets the day of month field to o, which is not a valid value. References: crontab - FreeBSD crontab(5) Manual Page1 Crontab Explained in Linux [With Examples] - Linux Handbook2