FX2 Flashcards
Question: Which of the following commands will search for the file foo.txt under the directory /home?
A. find /home – file foo.txt
B. find /home –name foo.txt
C. find /home foo.txt
D. search /home –file foo.txt
E. search /home foo.txt
Answer:
B. find /home –name foo.txt
Explanation:
Correct Answer (B): The find command is used to search for files. The -name flag is used to specify the name of the file you’re looking for (foo.txt). So, find /home -name foo.txt will search for foo.txt under the /home directory.
Incorrect Answers:
A: The –file option is not a valid option for the find command.
C: find /home foo.txt does not specify a search pattern for the file. It’s missing the correct syntax to search for the file by name.
D & E: The search command does not exist in this context, and the syntax is wrong.
Question: A directory contains the following files: a.txt and b.txt. What would be the output of the following shell script?
for file in *.txt
A. a b
B. *.txt
C. c.cav
D. a.txt
E. a.txt b.txt
Answer:
E. a.txt b.txt
Explanation:
Correct Answer (E): The script uses *.txt, which matches all files ending in .txt. So the script will loop over a.txt and b.txt and print them as a space-separated list.
Incorrect Answers:
A: This answer is incorrect because it doesn’t account for both a.txt and b.txt.
B: The literal *.txt is not the output; it’s a pattern that matches the files.
C: c.cav is unrelated to the files present in the directory.
D: It would only output a.txt, not b.txt.
Question: The current directory contains the following file: -rw-r–r– 1 root exec 24551 Apr 2 12:36 test.sh. The file contains a valid shell script, but executing this file using ./test.sh leads to the error: bash: ./test.sh: Permission denied. What should be done to successfully execute the script?
A. The file’s extension should be changed from .sh to .bin.
B. The script should be run using #!./test.sh instead of ./test.sh.
C. The execute bit should be set in the file’s permissions.
D. The user executing the script should be added to the exec group.
E. The SetUID bit should be set in the file’s permissions.
Answer:
C. The execute bit should be set in the file’s permissions.
Explanation:
Correct Answer (C): The error is due to the lack of execute permissions on the script. You need to use chmod +x test.sh to make the script executable.
Incorrect Answers:
A: The file extension does not affect its ability to be executed in Linux; the problem is with permissions.
B: The #! is used to specify a shell interpreter at the beginning of the script, not for execution.
D: Adding the user to the exec group isn’t necessary. The issue is the execute permission.
E: The SetUID bit is used for running a program with the permissions of the file owner, which is unnecessary here.
Question: Which of the following commands sorts the output of the command export-logs?
A. export-logs < sort
B. export-logs & sort
C. export-logs <> sort
D. export-logs | sort
E. export-logs > sort
Answer:
D. export-logs | sort
Explanation:
Correct Answer (D): The pipe | is used to send the output of one command (export-logs) as input to another command (sort), which sorts the output.
Incorrect Answers:
A: The < operator is used for input redirection, not for piping output.
B: The & operator is used to run a command in the background, not to redirect or pipe output.
C: The <> operator is used for bidirectional redirection, not in this context.
E: The > operator is used for output redirection, but it would overwrite a file named sort, which is not the intended behavior here.
Question: What is a Linux distribution?
A. A set of changes to Linux which enable Linux to run on another processor architecture.
B. An operating system based on Linux but incompatible to the regular Linux kernel.
C. The Linux file system as seen from the root account after mounting all file systems.
D. The set of rules which governs the distribution of Linux kernel source code.
E. A bundling of the Linux kernel, system utilities, and other software.
Answer:
E. A bundling of the Linux kernel, system utilities, and other software.
Explanation:
Correct Answer (E): A Linux distribution is a complete operating system that includes the Linux kernel, system utilities, libraries, and various software packages to make it usable by end-users.
Incorrect Answers:
A: This is not what defines a Linux distribution; it’s related to system architecture.
B: Linux distributions are based on the Linux kernel, which is not incompatible with the kernel.
C: This describes the file system layout, not a distribution.
D: This refers to the licensing and distribution of the kernel source, not a distribution.
Question: Where is the operating system of a Raspberry Pi stored?
A. On a removable SD card which is put into the Raspberry Pi.
B. On rewritable flash storage which is built into the Raspberry Pi.
C. On a read-only partition on the Raspberry Pi’s firmware, next to the BIOS.
D. On the master device attached to the Raspberry Pi’s IDE bus.
E. On a Linux extension module connected to the Raspberry Pi’s GPIO pins.
Answer:
A. On a removable SD card which is put into the Raspberry Pi.
Explanation:
Correct Answer (A): The operating system for Raspberry Pi is typically stored on a removable SD card. This is how the device boots and runs.
Incorrect Answers:
B: Raspberry Pi does not use built-in flash storage for the operating system.
C: The firmware on the Raspberry Pi does not store the operating system, just the bootloader.
D & E: These options are not relevant for storing the Raspberry Pi OS.
Question: Which of the following programs is a graphical editor for vector graphics?
A. NGINX
B. Python
C. MySQL
D. Samba
E. Inkscape
Answer:
E. Inkscape
Explanation:
Correct Answer (E): Inkscape is a popular open-source graphical editor for creating vector graphics.
Incorrect Answers:
A: NGINX is a web server software.
B: Python is a programming language.
C: MySQL is a relational database management system.
D: Samba is a software suite that provides file and print services for SMB/CIFS clients.
Question: Which package management tool is used in Red Hat-based Linux Systems?
A. rpm
B. apt-get
C. dpkg
D. packagectl
E. portage
Answer:
A. rpm
Explanation:
Correct Answer (A): rpm (Red Hat Package Manager) is the default package management tool for Red Hat-based systems such as CentOS and Fedora.
Incorrect Answers:
B: apt-get is used in Debian-based distributions (like Ubuntu).
C: dpkg is used in Debian-based distributions for package management.
D: packagectl is not a standard package management tool.
E: portage is used in Gentoo Linux.
Question: Which of the following characters in a shell prompt indicates the shell is running with root privileges?
A. *
B. &
C. $
D. #
E. !
Answer:
D. #
Explanation:
Correct Answer (D): The # symbol in a shell prompt indicates that the shell is running with root (administrator) privileges.
Incorrect Answers:
A: * is not used in this context.
B: & is used to run commands in the background.
C: $ is used for regular user privileges.
E: ! is not a standard prompt indicator for root access.
Question: Which of the following are typical services offered by public cloud providers? (Choose three.)
A. Internet as a Service (IaaS)
B. Graphics as a Service (GaaS)
C. Platform as a Service (PaaS)
D. Infrastructure as a Service (IaaS)
E. Software as a Service (SaaS)
Answer:
D. Infrastructure as a Service (IaaS)
C. Platform as a Service (PaaS)
E. Software as a Service (SaaS)
Explanation:
Correct Answers (D, C, E): These are the three typical services offered by public cloud providers:
IaaS provides basic infrastructure resources like virtual machines.
PaaS offers platforms for developers to build applications without managing underlying hardware.
SaaS provides software applications over the cloud.
Incorrect Answers:
A: “Internet as a Service” is not a standard term in cloud computing.
B: “Graphics as a Service” is not a typical cloud service.
Question: What is defined by a Free Software license?
A. Conditions for modifying and distributing the licensed software.
B. Details of the technical documentation each contributor has to provide.
C. A complete list of libraries required to compile the licensed software.
D. The programming languages which may be used to extend the licensed program.
E. Limits on the purposes for which the licensed software may be used.
Answer:
A. Conditions for modifying and distributing the licensed software.
Explanation:
Correct Answer (A): A Free Software license specifies the rights and conditions regarding the modification and distribution of software.
Incorrect Answers:
B: Technical documentation is not the primary focus of Free Software licenses.
C: The list of libraries is often separate from the license itself.
D: Free Software licenses are not concerned with programming languages used to extend software.
E: Free Software licenses generally promote freedom of use rather than restricting it.
Question: Why are web browser cookies considered dangerous?
A. Cookies store critical data which is lost when a cookie is deleted.
B. Cookies are always public and accessible to anyone on the internet.
C. Cookies support identification and tracking of users.
D. Cookies can contain and execute viruses and malware.
E. Cookies consume significant amounts of storage and can exhaust disk space.
Answer:
C. Cookies support identification and tracking of users.
Explanation:
Correct Answer (C): Cookies can store information about a user’s activity, which can be used for tracking purposes across websites, potentially violating privacy.
Incorrect Answers:
A: While cookies store data, it’s not usually critical, and deleting them doesn’t lead to major data loss.
B: Cookies are not typically accessible to anyone on the internet; they are domain-specific.
D: Cookies cannot execute viruses directly; they’re just small data files.
E: Cookies generally don’t consume much storage space.
Question: Running the command rm Downloads leads to the following error: rm: cannot remove ‘Downloads/’: Is a directory. Which of the following commands can be used instead to remove Downloads, assuming Downloads is empty? (Choose two.)
A. rmdir Downloads
B. rm –r Downloads
C. rem Downloads
D. dir –r Downloads
E. undir Downloads
Answer:
A. rmdir Downloads
B. rm –r Downloads
Explanation:
Correct Answers (A, B):
A: rmdir is used to remove empty directories.
B: rm -r removes directories and their contents recursively, but since Downloads is empty, this will work as well.
Incorrect Answers:
C: rem is not a valid command in Linux.
D: dir -r is not a valid command to remove directories.
E: undir is not a valid command.
Question: What is true about a recursive directory listing?
A. It includes ownership information for the files.
B. It includes details of file system internals, such as inodes.
C. It includes a preview of content for each file in the directory.
D. It includes the content of sub-directories.
E. It includes the permissions of the directory listed.
Answer:
D. It includes the content of sub-directories.
Explanation:
Correct Answer (D): A recursive directory listing shows the contents of sub-directories as well, not just the files in the current directory.
Incorrect Answers:
A: Ownership information can be included with ls -l but is not specifically part of a recursive listing.
B: File system internals such as inodes are not typically included in a recursive directory listing.
C: A recursive listing shows file names and directories but not previews of their content.
E: Permissions are often shown with the ls -l command, but they are not inherently part of a recursive listing.
Question: Which of the following commands are used to get information on the proper use of ls? (Choose two.)
A. option ls
B. info ls
C. usage ls
D. manual ls
E. man ls
Answer:
E. man ls
B. info ls
Explanation:
Correct Answers (E, B):
E: man ls provides the manual (documentation) for the ls command.
B: info ls provides detailed information about the ls command, sometimes in a different format than man.
Incorrect Answers:
A: option ls is not a valid command.
C: usage ls is not a valid command to get usage information.
D: manual ls is not a valid command.
Question: Which of the following directories contains information, documentation, and example configuration files for installed software packages?
A. /usr/share/doc/
B. /etc/defaults/
C. /var/info/
D. /usr/examples/
E. /doc/
Answer:
A. /usr/share/doc/
Explanation:
Correct Answer (A): /usr/share/doc/ is the standard directory for documentation files, including examples and configuration information, for installed software.
Incorrect Answers:
B: /etc/defaults/ contains configuration files for system services, not documentation.
C: /var/info/ is not a standard location for software documentation.
D: /usr/examples/ may contain example files but not the main documentation.
E: /doc/ is not a standard directory for documentation in Linux.
Question: A user is currently in the directory /home/user/Downloads/ and runs the command ls ../Documents/. Assuming it exists, which directory’s content is displayed?
A. /home/user/Documents/Downloads/
B. /home/user/Documents/
C. /home/user/Downloads/Documents/
D. /Documents/
E. /home/Documents
Answer:
B. /home/user/Documents/
Explanation:
Correct Answer (B): The command ls ../Documents/ lists the contents of the Documents directory that is one level up from Downloads, so it shows /home/user/Documents/.
Incorrect Answers:
A: ls ../Documents/ does not include the Downloads directory in the path.
C: The command does not specify a directory within Downloads.
D & E: These options are not valid paths based on the user’s current location.
Question: Which of the following commands adds the directory /new/dir/ to the PATH environment variable?
A. export PATH=/new/dir: PATH
B. PATH=/new/dir: PATH
C. export $PATH=/new/dir: $PATH
D. $PATH=/new/dir: $PATH
E. export PATH=/new/dir: $PATH
Answer:
E. export PATH=/new/dir: $PATH
Explanation:
Correct Answer (E): This command correctly appends /new/dir to the existing PATH variable and exports it for the current session.
Incorrect Answers:
A: This command has a syntax issue, as there is no $ before PATH in the second part.
B: This doesn’t export the change, which means it won’t be applied to the current shell session.
C & D: These commands are incorrect due to syntax issues with how the PATH variable is referenced.
Question: A directory contains the following three files: texts 1.txt, texts 2.txt, texts 3.csv. Which command copies the two files ending in .txt to the /tmp/ directory?
A. cp ..txt /tmp/
B. cp *.txt /tmp/
C. cp ?.txt /tmp/
D. cp ?? .txt /tmp/
E. cp $?.txt /tmp/
Answer:
B. cp *.txt /tmp/
Explanation:
Correct Answer (B): cp .txt /tmp/ uses a wildcard () to match all .txt files and copy them to the /tmp/ directory.
Incorrect Answers:
A: The syntax cp ..txt is incorrect; . is not needed before the wildcard.
C: cp ?.txt would match files with exactly one character before .txt, which does not apply here.
D: cp ?? .txt would match files with exactly two characters before .txt, which also does not apply.
E: cp $?.txt is incorrect because $? refers to the exit status of the last command, not a file name.
Question: When typing a long command line at the shell, what single character can be used to split a command across multiple lines?
A. /
B. \
Answer:
B. \
Explanation:
Correct Answer (B): The backslash () is used to split a long command across multiple lines in the shell.
Incorrect Answer (A): The forward slash (/) is not used for this purpose.