Which of the following commands extracts the contents of the compressed archive file1.tar.gz?
tar -czf file1.tar.gz
ztar file1.tar.gz
tar -xzf file1.tar.gz
tar --extract file1.tar.gz
detar file1.tar.gz
The correct command to extract the contents of the compressed archive file1.tar.gz is tar -xzf file1.tar.gz. This command uses the following options:
The other commands are incorrect for the following reasons:
References:
Which of the following commands adds the directory/new/dir/to thePATHenvironment variable?
$PATH=/new/dir: $PATH
PATH=/new/dir: PATH
export PATH=/new/dir: PATH
export $PATH=/new/dir: $PATH
export PATH=/new/dir: $PATH
The PATH environment variable is a colon-separated list of directories that the shell searches for commands. To add a new directory to the PATH, you need to append it to the existing value of the variable, using the syntax PATH=new/dir:PATH. However, this only changes the PATH for the current shell session. To make the change permanent, you need to use the export command, which makes the variable available to all child processes of the shell. The export command takes the name of the variable as an argument, without the dollar sign ($). Therefore, the correct command to add /new/dir/ to the PATH and export it is export PATH=/new/dir:PATH. References:
What is the UID of the user root?
1
-1
255
65536
0
The UID of the user root is always 0 on Linux systems. This is because the kernel uses the UID 0 to check for the superuser privileges and grant access to all system resources. The name of the user account with UID 0 is usually root, but it can be changed or have aliases. However, some applications may expect the name root and not work properly with a different name. The UID 0 is reserved for the root user and cannot be assigned to any other user. The UID 0 is stored in the /etc/passwd file along with other user information. References:
Which operator in a regular expression matches the preceding character either zero or one time?
?
*
+
%
$
The operator that matches the preceding character either zero or one time in a regular expression is the question mark (?). This operator is also known as the optional quantifier, because it makes the preceding character or group of characters optional. For example, the regular expression colou?r matches both color and colour, because the u is optional. The question mark can also be used to modify other quantifiers, such as * (zero or more), + (one or more), or {m,n} (between m and n times), to make them non-greedy, meaning they will match the shortest possible string instead of the longest. For example, the regular expression .*? matches any character zero or more times, but as few as possible. The question mark is one of the basic regular expression operators covered in the Linux Essentials certification program from the Linux Professional Institute (LPI). References:
What is true about the su command?
It is the default shell of the root account.
It can only be used by the user root.
It runs a shell or command as another user.
It changes the name of the main administrator account.
It locks the root account in specific time frames.
The su command stands for substitute user or switch user. It allows you to run a shell or a command as another user, usually the superuser or root. To use the su command, you need to know the password of the target user. For example, if you want to switch to the root user, you can type su - and enter the root password. This will give you a root shell, where you can execute commands with administrative privileges. To exit the root shell, you can type exit or press Ctrl-D. The su command is not the default shell of the root account, nor can it only be used by the root user. It can be used by any user who knows the password of another user. The su command does not change the name of the main administrator account, which is always root on Linux systems. The su command also does not lock the root account in specific time frames, although there are other ways to do that, such as using the pam_time module. References:
Which of the following outputs could stem from the commandlast?
1 ls
2 cat text.txt
3 logout
Password for user last changed at Sat Mar 31 16:38:57 EST 2018
Last login: Fri Mar 23 10:56:39 2018 from server.example.com
EXT4-fs (dm-7): mounted filesystem with ordered data mode. Opts: (null)
root tty2 Wed May 17 21:11 - 21:11 (00:00)
The last command in Linux is used to display the list of all the users logged in and out since the file /var/log/wtmp was created1. The output of the last command shows the username, the terminal, the IP address, the login time and date, and the duration of the session for each record2. The option E is the only one that matches this format. Theother options are not related to the last command. Option A shows a list of commands executed by a user. Option B shows the password change information for a user. Option C shows the last login information for a user. Option D shows the mount information for a filesystem. References:
Which of the following devices represents a hard disk partition?
/dev/ttyS0
/dev/sata0
/dev/part0
/dev/sda2
/dev/sda/p2
Section: (none)
The correct device name that represents a hard disk partition is /dev/sda2. This device name follows the Linux convention for naming hard disk devices and partitions. According to this convention123:
Therefore, /dev/sda2 means the second partition on the first serial drive, which is a valid hard disk partition. The other options are not valid hard disk partitions, because they do not follow the Linux convention. For example:
References: 1: Hard drive/device partition naming convention in Linux - Unix & Linux Stack Exchange 2: Hard drive partition naming convention in Linux - Ask Ubuntu 3: C.4. Device Names in Linux - Debian 4: What is /dev/ttyS0? - Quora
Explanation
The current directory contains the following file:
-rwxr-xr-x 1 root root 859688 Feb 7 08:15 test.sh
Given that the file is a valid shell script, how can this script be executed? (Choose two correct answers.)
run test.sh
${test.sh}
cmd ./test.sh
./test.sh
bash test.sh
A shell script is a file that contains a series of commands that can be executed by a shell interpreter. To execute a shell script, there are two main methods:
Therefore, the correct answers are D and E. A. run test.sh is incorrect because run is not a valid command in Linux. B. ${test.sh} is incorrect because this syntax is used for variable expansion, not for executing a script. C. cmd ./test.sh is incorrect because cmd is not a valid command in Linux. References:
Which of the following statements regarding Linux hardware drivers is correct?
Drivers are regular Linux programs which have to be run by the user who wants to use a device.
Drivers are not used by Linux because the BIOS handles all access to hardware on behalf of Linux.
Drivers are stored on their devices and are copied by the Linux kernel when a new device is attached
Drivers are downloaded from the vendor's driver repository when a new device is attached.
Drivers are either compiled into the Linux kernel or are loaded as kernel modules.
Linux hardware drivers are software components that enable the Linux kernel to communicate with various devices, such as keyboards, mice, printers, scanners, network cards, etc. Drivers are either compiled into the Linux kernel or are loaded as kernel modules. Kernel modules are pieces of code that can be loaded and unloaded into the kernelon demand. They extend the functionality of the kernel without requiring to rebuild or reboot the system. Drivers that are compiled into the kernel are always available, but they increase the size and complexity of the kernel. Drivers that are loaded as kernel modules are only available when needed, but they require a matching version of the kernel and the module. Linux supports a large number of hardware devices, thanks to the efforts of the open source community and some vendors who provide drivers for their products. However, some devices may not have a driver available for Linux, or may require a proprietary driver that is not included in the Linux distribution. In such cases, the user may need to install the driver manually from the vendor’s website or from a third-party repository. References:
Which of the following values could be a process ID on Linux?
/bin/bash
60b503cd-019e-4300-a7be-922f074ef5ce
/sys/pid/9a14
fff3
21398
A process ID on Linux is a unique integer value that identifies a running process. The process ID can range from 0 to a maximum limit, which is usually 32768 or higher, depending on the system configuration. The process ID of 0 is reserved for the kernel’s idle task, and the process ID of 1 is reserved for the init system, which is the first process launched by the kernel. The process IDs are assigned sequentially to new processes, and are recycled when a process terminates. Therefore, the only valid value for a process ID among the given options is 21398, which is an integer within the possible range. The other values are not valid process IDs because they are either strings, hexadecimal numbers, or file paths, which do not match the format of a process ID on Linux. References:
Which package management tool is used in Red Hat-based Linux Systems?
portage
rpm
apt-get
dpkg
packagectl
RPM stands for RPM Package Manager (formerly known as Red Hat Package Manager), which is a powerful, command-line package management tool developed for the Red Hat operating system. It is now used as a core component in many Linux distributions such as CentOS, Fedora, Oracle Linux, openSUSE and Mageia1. RPM can install, uninstall,and query individual software packages, but it cannot manage dependency resolution like YUM2. YUM is another package management tool that is based on RPM and can handle dependencies automatically. YUM is the primary package management tool for installing, updating, removing, and managing software packages in Red Hat Enterprise Linux2. Therefore, the correct answer is B. rpm, as it is the underlying package management tool used in Red Hat-based Linux systems. References:
What happens to a file residing outside the home directory when the file owner's account is deleted? (Choose two.)
During a file system check, the file is moved to /lost +found.
The file is removed from the file system.
The UID of the former owner is shown when listing the file's details.
The user root is set as the new owner of the file.
Ownership and permissions of the file remain unchanged.
When a user account is deleted, the files owned by that user are not automatically deleted from the file system, unless they are in the user’s home directory. The files residing outside the home directory will remain unchanged, but they will have an invalid owner. The owner of a file is identified by a numeric user ID (UID), which is mapped to a user name by the /etc/passwd file. When a user is deleted, the corresponding entry in the /etc/passwd file is removed, but the UID of the file is not changed. Therefore, when listing the file’s details, the UID of the former owner is shown instead of the user name. For example, if the user alice with UID 1001 is deleted, and she owns a file named report.txt in the /tmp directory, the output of ls -l /tmp/report.txt will look something like this:
-rw-r–r-- 1 1001 users 1024 Nov 20 14:11 /tmp/report.txt
The user root is not set as the new owner of the file, nor is the file moved to /lost+found or removed from the file system. The /lost+found directory is used to store files that are recovered from a corrupted file system after running the fsck command, not from deleted user accounts. The file system check does not affect the ownership or permissions of the files, unless there is a serious inconsistency that needs to be fixed. References:
Which of the following programs is a graphical editor for vector graphics?
Python
NGINX
Samba
Inkscape
MySQL
A vector graphics editor is a software program that allows users to create and edit vector graphics, which are images composed of mathematical curves and shapes. Vector graphics are scalable, meaning they can be resized without losing quality or clarity. Python, NGINX, Samba, and MySQL are not vector graphics editors, but rather other types of software. Python is a programming language, NGINX is a web server, Samba is a file and print server, and MySQL is a database management system. Inkscape is a free and open source vector graphics editor that supports the SVG (Scalable Vector Graphics) format, as well as other formats. Inkscape can be used to create logos, icons, diagrams, illustrations, and other graphics. Inkscape is one of the applications covered in the Linux Essentials certification program from the Linux Professional Institute (LPI). References:
What are the differences between hard disk drives and solid state disks? (Choose two correct answers.)
Hard disks have a motor and moving parts, solid state disks do not.
Hard disks can fail due to physical damage, while solid state disks cannot fail.
Solid state disks can store many times as much data as hard disk drives.
/dev/sdais a hard disk device while/dev/ssdais a solid state disk.
Solid state disks provide faster access to stored data than hard disks.
The main difference between hard disk drives (HDDs) and solid state drives (SSDs) is the way they store and access data. HDDs use a spinning disk (platter) and a moving head to read and write data, while SSDs use flash memory chips that have no moving parts. This makes SSDs faster, quieter, and more durable than HDDs, but also more expensive and less spacious. HDDs and SSDs are both I/O devices that can be used to boot the system and store data, but they have different advantages and disadvantages depending on the use case. References:
Which of the following programs are web servers? (Choose two.)
Apache HTTPD
Postfix
Curl
Dovecot
NGINX
A web server is a program that listens for requests from web browsers and serves web pages, images, or other resources. Apache HTTPD and NGINX are two popular web servers that can run on Linux systems. They can handle multiple protocols, such as HTTP, HTTPS, FTP, and SMTP. Postfix, Curl, and Dovecot are not web servers, but they are related to web or network services. Postfix is a mail transfer agent (MTA) that can send and receive emails. Curl is a command-line tool that can transfer data from or to a web server. Dovecot is a mail delivery agent (MDA) that can store and retrieve emails from a local mailbox. References:
Which statements about the directory /etc/skel are correct? (Choose two.)
The personal user settings of root are stored in this directory.
The files from the directory are copied to the home directory of the new user when starting the system.
The files from the directory are copied to the home directory of a new user when the account is created.
The directory contains a default set of configuration files used by the useradd command.
The directory contains the global settings for the Linux system.
The /etc/skel directory is a skeleton directory that contains the default files and directories that are automatically copied to the home directory of a new user when the account is created by the useradd command12. The purpose of this directory is to provide a consistent and uniform environment for all new users and to save the system administrator’s time and effort in configuring the user settings12. The /etc/skel directory can be customized by adding or removing files and directories as needed, depending on the desired default settings for the new users12.
The other options are incorrect because:
References:
Which of the following statements is true about Free Software?
It is developed by volunteers only.
It may be modified by anyone using it.
It must always be available free of charge.
It only runs on Linux.
It is only distributed as a compiled binary.
The correct statement about Free Software is that it may be modified by anyone using it. This is one of the four essential freedoms of Free Software, which are: the freedom to run the program as you wish, for any purpose; the freedom to study how the program works, and change it so it does your computing as you wish; the freedom to redistribute copies so you can help your neighbor; and the freedom to distribute copies of your modified versions to others1. Access to the source code is a precondition for these freedoms1.
The other statements are false for the following reasons:
References:
Which command adds the new usertuxand creates the user’s home directory with default configuration
files?
defaultuser tux
useradd –m tux
usercreate tux
useradd –o default tux
passwd –a tux
The useradd command in Linux is used to create new user accounts on the system1. The -m option tells the command to create the user’s home directory as /home/username and copy the files from /etc/skel directory to the user’s home directory2. The /etc/skel directory contains the default configuration files for new users3. Therefore, the command useradd -m tux will add the new user tux and create the user’s home directory with default configuration files. The other options are either invalid or do not create the user’s home directory. References:
What is true about links in a Linux file system?
A symbolic link can only point to a file and not to a directory.
A hard link can only point to a directory and never to a file.
When the target of the symbolic link is moved, the link is automatically updated.
A symbolic link can point to a file on another file system.
Only the root user can create hard links.
A symbolic link, also known as a symlink or soft link, is a special type of file that points to another file or directory by its name. A symbolic link can point to a file or directory on the same or different file system, as long as the target is accessible. For example, you can create a symbolic link to a file on a USB drive or a network share, as long as the device is mounted or the connection is established. However, if the target of the symbolic link is moved, renamed, or deleted, the link becomes broken and does not work. To create a symbolic link, you can use the ln command with the -s or --symbolic option, followed by the target name and the link name. For example, ln -s /mnt/usb/file.txt link.txt creates a symbolic link named link.txt that points to the file.txt on the USB drive mounted at /mnt/usb.
The other options are not true about links in a Linux file system. A symbolic link can point to a directory as well as a file. A hard link, which is a direct reference to the same data as another file, can only point to a file and not a directory. A hard link cannot span across different file systems, because it depends on the inode number, which is unique within a file system. When the target of the symbolic link is moved, the link is not automatically updated, but becomes broken. Any user can create hard links, as long as they have the permission to read and write the target file and the link directory.
References:
What information is stored in/etc/passwd? (Choose three correct answers.)
The user’s storage space limit
The numerical user ID
The username
The encrypted password
The user\s default shell
The /etc/passwd file is a plain text-based database that contains information for all user accounts on the system. It is owned by root and has 644 permissions. The file can only be modified by root or users with sudo privileges and readable by all system users. Each line of the /etc/passwd file contains seven comma-separated fields, representing a user account. The fields are as follows:
Therefore, the correct answers are B, C, and E. The user’s storage space limit (A) is not stored in the /etc/passwd file, but in the /etc/quota file. The encrypted password (D) is not stored in the /etc/passwd file, but in the /etc/shadow file. References:
What is the preferred source for the installation of new applications in a Linux based operating system?
The vendor's version management system
A CD-ROM disk
The distribution's package repository
The vendor's website
A retail store
The distribution’s package repository is the preferred source for the installation of new applications in a Linux based operating system. A package repository is a collection of software packages that are maintained by the distribution and can be easily installed, updated, or removed using a package manager. Package repositories offer several advantages, such as:
The other sources are not preferred because they may not offer these benefits and may cause problems with the system. The vendor’s version management system, the vendor’s website, or a CD-ROM disk may contain packages that are not compatible with the distribution or may conflict with other packages. A retail store may not have the latest or the most suitable packages for the system. References:
Which of the following characters in a shell prompt indicates the shell is running with root privileges?
!
#
*
&
$
The shell prompt is a symbol or a string of characters that indicates the shell is ready to accept commands. The shell prompt can be customized by the user or by the system administrator. The default shell prompt for a normal user is usually a dollar sign ($), while the default shell prompt for the root user is usually a hash sign (#). The root user is the superuser or the administrator of the system, who has full access and control over all files, commands, and resources. Running commands as root can be dangerous, as it can cause irreversible damage to the system if done incorrectly. Therefore, it is advisable to use sudo or su to run commands as root only when necessary, and to switch back to a normal user as soon as possible. The shell prompt indicates the shell is running with root privileges when it ends with a hash sign (#). References:
Why are web browser cookies considered dangerous?
Cookies support identification and tracking of users.
Cookies are always public and accessible to anyone on the internet.
Cookies consume significant amounts of storage and can exhaust disk space.
Cookies store critical data which is lost when a cookie is deleted.
Cookies can contain and execute viruses and malware.
Web browser cookies are small pieces of data that are stored by a website on a user’s browser. They are used to remember information about the user, such as preferences, login details, shopping cart items, etc. Cookies can also be used to identify and track users across different websites, which can have implications for privacy and security. For example, cookies can be used to show targeted ads based on the user’s browsing history, or to collect personal information without the user’s consent. Cookies are not inherently dangerous, but they can pose some risks if they are misused or compromised by malicious actors. References:
Which of the following commands finds all lines in the file operating-systems.txt which contain the term
linux, regardless of the case?
igrep linux operating-systems.txt
less -i linux operating-systems.txt
grep -i linux operating-systems.txt
cut linux operating-systems.txt
cut [Ll] [Ii] [Nn] [Uu] [Xx] operating-systems.txt
The grep command is used to search for a pattern in a file or input. The -i option makes the search case-insensitive, meaning that it will match both uppercase and lowercase letters. The grep command takes the pattern as the first argument and the file name as the second argument. Therefore, the command grep -i linux operating-systems.txt will find all lines in the file operating-systems.txt which contain the term linux, regardless of the case. References: Linux Essentials - Topic 103: Finding Linux Documentation and Linux Essentials - Topic 104: Command Line Basics