Which command copies the contents of the directory /etc/, including all sub-directories, to /root/?
copy /etc /root
cp -r /etc/* /root
cp -v /etc/* /root
rcp /etc/* /root
cp -R /etc/*.* /root
The correct command to copy the contents of the directory /etc/, including all sub-directories, to /root/ is cp -r /etc/* /root. This command uses the cp command, which stands for copy, and is used to copy files and directories on Linux and Unix systems. The command also uses the following options and arguments123:
The other options are incorrect because they use different commands or syntax that do not copy the contents of the directory /etc/, including all sub-directories, to /root/. For example:
References: 1: Cp Command in Linux (Copy Files) | Linuxize 2: cp command in Linux with examples - GeeksforGeeks 3: How to Copy Files and Directories in the Linux Terminal
Which of the following statements are true regarding a typical shell script? (Choose two.)
It has the executable permission bit set.
It starts with the two character sequence #!.
It is located in /usr/local/scripts/.
It is located in /etc/bash/scripts/.
It is compiled into a binary file compatible with the current machine architecture.
A typical shell script is a text file that contains a series of commands or instructions that can be executed by a shell interpreter. A shell script usually has the executable permission bit set, which means that it can be run as a program by the user or another program. A shell script also starts with the two character sequence #!, which is called a shebang or a hashbang. This sequence tells the operating system which shell interpreter to use to run the script. For example, #!/bin/bash indicates that the script should be run by the bash shell. References:
Most commands on Linux can display information on their usage. How can this information typically be displayed?
By running the command with the option /? or /??.
By running the command with the option ?! or ?=!.
By running the command with the option /doc or /documentation.
By running the command with the option -h or --help.
By running the command with the option -m or --manpage.
Most commands on Linux can display information on their usage by running the command with the option -h or --help. This option shows a brief summary of the command syntax, options, arguments, and examples. For example, running ls -h or ls --help will display the usage information for the ls command, which lists files and directories. The -h or --help option is a standard convention for most Linux commands, and it is useful for learning how to use a command or checking its available options. However, some commands may not support this option, or may use a different option to display usage information. In that case, you can use the man command to access the manual page for the command, which provides more detailed information on the command usage, description, options, arguments, examples, and references. For example, running man ls will display the manual page for the ls command. The man command is one of the applications covered in the Linux Essentials certification program from the Linux Professional Institute (LPI). 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:
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:
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
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:
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:
What are the differences between a private web browser window and a regular web browser window? (Choose three.)
Private web browser windows do not allow printing or storing websites.
Private web browser windows do not store cookies persistently.
Private web browser windows do not support logins into websites.
Private web browser windows do not keep records in the browser history.
Private web browser windows do not send regular stored cookies.
A private web browser window is a mode of browsing that prevents the browser from saving your browsing history, cookies, and other site data, or information entered in forms. However, it does not prevent websites, your employer or school, or your internet service provider from tracking your online activity. The main differences between a private web browser window and a regular web browser window are:
References: Browse in private - Computer - Google Chrome Help, Browse InPrivate in Microsoft Edge - Microsoft Support, Private Browsing: What Is It and How to Use It | Edge Learning Center
What can be found in the /proc/ directory?
One directory per installed program.
One device file per hardware device.
One file per existing user account.
One directory per running process.
One log file per running service.
The /proc/ directory is a virtual file system that contains information about the system and the processes running on it. It is not a conventional file system that stores files on a disk, but rather a dynamic view of the kernel’s data structures. One of the features of the /proc/ directory is that it contains one subdirectory for each process running on the system, which is named after the process ID (PID). For example, the subdirectory /proc/1/ contains information about the process with PID 1, which is usually the init process. The process subdirectories contain various files that provide information about the process, such as its status, memory usage, open files, environment variables, command line arguments, and more. The /proc/ directory also contains a symbolic link called ‘self’, whichpoints to the process that is accessing the /proc/ file system. Therefore, the correct answer is D. One directory per running process.
The other options are incorrect because:
References:
What is the return value of a shell script after successful execution?
1
0
-1
-255
255
The return value of a shell script after successful execution is 0. This is a convention followed by most UNIX and Linux commands, programs, and utilities. A return value of 0 indicates that the command or script completed successfully, without any errors. A return value of non-zero (1-255) indicates that the command or script failed, and the value can be interpreted as an error code. The return value of a command or script is stored in the special variable $? and can be used to test the outcome of a command or script123. For example, the following script will print a message based on the return value of the ls command:
#!/bin/bash ls if [ $? -eq 0 ]; then echo “ls command executed successfully” else echo “ls command failed” fi
References: 1: Exit and Exit Status - Linux Documentation Project 2: Linux Passwd Command Help and Examples 3: bash - Which is the best way to check return result? - Unix & Linux Stack Exchange
What information can be displayed bytop?
Existing files, ordered by their size.
Running processes, ordered by CPU or RAM consumption.
User accounts, ordered by the number of logins.
User groups, ordered by the number of members.
User accounts, ordered by the number of files.
The top command is a Linux command that shows the running processes on the system. It provides a dynamic real-time view of the system performance and resource usage. The top command can display various information about the processes, such as their process ID, user, priority, state, CPU and memory usage, command name, and more. The top command can also sort the processes by different criteria, such as CPU or RAM consumption, by using the interactive commands. The top command is useful for monitoring the system load and identifying the processes that are consuming the most resources. References:
Which of the following permissions are set on the/tmp/directory?
rwxrwxrwt
------rwX
rwSrw-rw-
rwxrwS---
r-xr-X--t
The correct permissions for the /tmp directory are rwxrwxrwt, which means that the owner, group, and others have read, write, and execute permissions, and that the sticky bit is set. The sticky bit is a special permission that prevents users from deleting or renaming files that they do not own in a shared directory. The /tmp directory is used for storing temporary files that may be created by different users and processes, so it needs to be accessible and writable by all, but also protected from unauthorized deletion or modification of files. The rwxrwxrwt permissions can be set by using the chmod command with either the octal mode 1777 or the symbolic mode a+trwx. References: : [File system permissions] : [Sticky bit] : [chmod]
Which one of the following statements concerning Linux passwords is true?
All passwords can be decrypted using the system administrator's master password.
Passwords may never start with a non-letter.
Users cannot change their password once it has been set.
Passwords are only stored in hashed form.
Passwords may be at most six characters long.
Linux passwords are not stored in plain text, but in a scrambled or encrypted form known as a hash. A hash is a one-way function that transforms a string of characters into a fixed-length value. The same input always produces the same hash, but it is impossible to reverse the process and recover the original input from the hash. This way, the system can verify the user’s password without exposing it to anyone who can read the file where the hashes are stored. The file that contains the password hashes is /etc/shadow, which is only readable by the root user or members of the shadow group. The passwd utility is used to change the user’s password, which updates the hash in the /etc/shadow file. References: Linux Essentials 1.6 Topic 105: Security and File Permissions, How to Change Account Passwords on Linux, Where is my password stored on Linux?
What is a Linux distribution?
The Linux file system as seen from the root account after mounting all file systems.
A bundling of the Linux kernel, system utilities and other software.
The set of rules which governs the distribution of Linux kernel source code.
An operating system based on Linux but incompatible to the regular Linux kernel.
A set of changes to Linux which enable Linux to run on another processor architecture.
A Linux distribution is a collection of software that is based on the Linux kernel and can be installed on a computer or a device to create a functional operating system. A Linux distribution typically includes the Linux kernel, a set of system utilities and libraries, a graphical user interface (GUI), a package manager, and various applications and services. A Linux distribution may also include additional software or features that are specific to the distribution’s goals, target audience, or philosophy. For example, some Linux distributions are designed for desktop users, while others are optimized for servers, embedded systems, or security. Some Linux distributions are based on other Linux distributions, while others are developed independently. Some Linux distributions are free and open source, while others are proprietary or commercial. Some Linux distributions are popular and widely used, while others are niche or experimental. Some examples of Linux distributions are Ubuntu, Fedora, Debian, Mint, Arch, and Red Hat. 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:
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:
What is true about a recursive directory listing?
It includes the content of sub-directories.
It includes the permissions of the directory listed.
It includes details of file system internals, such as inodes.
It includes ownership information for the files.
It includes a preview of content for each file in the directory.
A recursive directory listing is a way of displaying the files and folders in a directory and all its sub-directories. The recursive option can be used with various commands, such as ls, find, or dir, to list the files recursively. For example, the command ls -R will list all the files and folders inthe current directory and any sub-directories, showing the hierarchy of the file system123 A recursive directory listing does not include the permissions, ownership, or file system details ofthe files, unless specified by other options. For example, the command ls -lR will list the files recursively and also show the permissions, ownership, size, and modification date of each file1 A recursive directory listing also does not include a preview of the content of each file, unless specified by other options. For example, the command ls -R --file-type will list the files recursively and also show the file type indicator, such as / for directories, * for executable files, @ for symbolic links, etc1 References: 1: ls (Unix) - Wikipedia 2: Recursively List all directories and files - Stack Overflow 3: Why is ls -R called “recursive” listing? - Ask Ubuntu
Which of the following commands creates an archive filework.tarfrom the contents of the directory./
work/?
tar --new work.tar ./work/
tar –cf work.tar ./work/
tar –create work.tgz –content ./work/
tar work.tar < ./work/
tar work > work.tar
The correct command to create an archive file work.tar from the contents of the directory ./work/ is tar –cf work.tar ./work/. This command uses the -c option to create a new archive, the -f option to specify the file name, and the ./work/ argument to indicate the source directory. The other commands are incorrect for various reasons:
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:
What is true about the owner of a file?
Each file is owned by exactly one user and one group.
The owner of a file always has full permissions when accessing the file.
The user owning a file must be a member of the file’s group.
When a user is deleted, all files owned by the user disappear.
The owner of a file cannot be changed once it is assigned to an owner.
In Linux, every file and directory is associated with an owner and a group. The owner is the user who created the file or directory, and the group is the group to which the owner belongs. Therefore, each file is owned by exactly one user and one group. This is true for option A. The other options are false for the following reasons:
TESTED 22 Dec 2024
Copyright © 2014-2024 DumpsBuddy. All Rights Reserved