Which symbol is used in Bash scripting to execute a command?
- $
- %
- #
- @
In Bash scripting, the '$' symbol is used to execute a command. When you prefix a command with '$', it's interpreted as a variable and executed. For example, $ ls would execute the 'ls' command.
Which command is used to send ICMP echo requests to test network connectivity?
- ping
- ifconfig
- traceroute
- netstat
The correct command to send ICMP echo requests to test network connectivity is 'ping.' When you run 'ping' followed by an IP address or hostname, it sends ICMP echo requests to that address and waits for responses, allowing you to determine if the network connection is working.
You've been given a task to find all occurrences of the word "error" in a directory containing numerous log files. Which command would you primarily use for this search?
- grep
- find
- sed
- awk
To find all occurrences of the word "error" in a directory with log files, you would primarily use the grep command. grep is a powerful tool for searching text and regular expressions in files and can be used to quickly locate specific content, like error messages, within files.
Which command-line tool is used to view real-time system processes in Linux?
- top
- ls
- cat
- ps
The correct answer is "top." The top command is a real-time system monitoring tool in Linux that provides information about system processes, CPU usage, memory usage, and more. It allows users to monitor and manage running processes interactively.
AppArmor policies are commonly defined using which type of files?
- Profiles
- Blueprints
- Rules
- Directories
AppArmor policies are commonly defined using profiles. These profiles specify the access controls for individual applications or processes, allowing you to confine their behavior and enhance system security.
Which column in the top command output represents the percentage of CPU usage for a process?
- %CPU
- %MEM
- PID
- COMMAND
In the top command output, the %CPU column represents the percentage of CPU usage for each process. This column shows the proportion of CPU resources that a process is currently utilizing.
When you want to continue to the next iteration of a loop without executing the subsequent commands in the current iteration, you use the __________ command.
- continue
- break
- exit
- return
When you want to continue to the next iteration of a loop without executing the subsequent commands in the current iteration, you use the **continue** command. It allows you to skip the current iteration and proceed to the next iteration of the loop.
A colleague informs you that they're unable to access a service on a remote server. You suspect it might be a firewall issue. How would you list the current firewall rules to diagnose the issue?
- iptables -L
- firewall-cmd --list-all
- ufw status
- netstat -an
To list the current firewall rules on a Linux system using iptables, you can use the command iptables -L. This command will display the current firewall rules, allowing you to diagnose potential issues and ensure that the necessary ports are open for the service your colleague is trying to access.
The __________ command in Linux allows mounting of NFS shared directories.
- mount
- nfs
- fstab
- showmount
The mount command in Linux allows mounting of NFS (Network File System) shared directories. You can use this command to make remote file systems accessible on your local system through NFS.
A user reports that their application occasionally freezes. You suspect it's due to the application waiting for some I/O operations to complete. Which state might the process be in during these freezes?
- D (Uninterruptible Sleep)
- R (Running)
- S (Sleeping)
- Z (Zombie)
During an I/O operation, a process might enter the "D" state, which stands for Uninterruptible Sleep. This state indicates that the process is waiting for a resource to become available, and it cannot be interrupted. It's often associated with I/O-related delays or problems.
The command used to resize the filesystem on a partition in Linux is _________.
- resize2fs
- mv
- chmod
- cp
The command used to resize the filesystem on a partition in Linux is resize2fs. This command is used after resizing a partition to adjust the filesystem to use the newly available space.
Which file in Linux is used to set the hostname and the order in which the system resolves addresses?
- /etc/hostname
- /etc/hosts
- /etc/resolv.conf
- /etc/networks
The /etc/hosts file is used to set the hostname and the order in which the system resolves addresses. It contains mappings of IP addresses to hostnames and can be used to define the local system's hostname.