LPI Linux Essentials Questions to Study

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Which of the following is a piece of software that listens for network requests and responds to them?

Apache Apache HTTPD is an HTTP server daemon produced by the Apache Foundation. It is software that listens for network requests (expressed using the Hypertext Transfer Protocol) and responds to them.

What column tells the "w" program which session is running? STATUS PROGRAM WHAT WHICH

WHAT The WHAT column tells the "w" program which session is currently running.

Which of the following provides the correct syntax to search for lines beginning with the given pattern using the grep command? ^pattern pattern^ $pattern pattern$

^pattern To search for lines beginning with the given pattern using grep, ^pattern should be used. If the pattern is enclosed in single quotes, it suppresses the meaning of all of the meta-characters with special meanings.

Which command can be used to display and clear the command line history for a given user? cls history clear currentuser

history OBJ-2.1: The command "history" can be used to display and clear the command line history for a given user. Each user has their own unique history file, which is created in the user's home directory.

What is the correct statement to be used for comparison in a Linux shell script? if [ $x -gt $y ] if $x -gt $y if ( $x -gt $y) if { $x -gt $y }

if [ $x -gt $y ] OBJ-3.3: The standard syntax for an if statement is "if [ condition ]." In this case, the comparison is testing if the variable X is greater than the variable Y.

Which of the following is an example of globbing? ls /etc/ 2> files.txt ls /etc/ > files.txt ls /etc/*.txt ls /etc/ | more

ls /etc/*.txt OBJ-3.3: Globbing is a feature provided by the UNIX/Linux shell to represent multiple filenames by using special characters called wildcards with a single file name. A wildcard is essentially a symbol which may be used to substitute for one or more characters. The only answer choice with a wildcard is ls /etc/*.txt since the * is a wildcard character. Therefore, this is the only answer choice that is using globbing.

Which command line can be used to search help files that mention the word 'copy'? help copy man copy man -k copy info copy

man -k copy The -k option of the man command is equivalent to the apropos command. It searches the short manual page descriptions for keywords and displays any matches.

You have just created a text file with a secret password in it called password.txt. You want to ensure that the password is not seen when the ls command is run within the current directory. What command should you use to ensure the text file is hidden from the filesystem? rn password.txt .password.txt mv password.txt password.hidden mv password.txt .password.txt rn password.txt password.hidden

mv password.txt .password.txt To hide a file in the Linux filesystem, simply rename it with a prefixed dot (.) to its filename. Therefore, mv password.txt .password.txt will cause the file password.txt to be renamed as a "dot" file and become hidden from the ls command.

Which command is used to change the password of a user's account? useradd pwd passwd chuser

passwd The passwd command is used to change the password of a user's account. This command runs as the root user using SUID.

Which of the following provides the correct syntax to search for lines ending with the given pattern using the grep command?

pattern$ To search for lines ending with the given pattern using grep, pattern$ should be used. If the pattern is enclosed in single quotes, it suppresses the meaning of all of the meta-characters with special meanings.

Which of the following outputs might be displayed when executing the command last? Last login: Fri Mar 23 10:56:39 2019 from server.diontraining.com EXT4-fs (dm-7): mounted filesystem with ordered data mode. Opts: (null) root tty2 Wed Sep 29 21:11 - 21:11 (00:00) system uptime 2.6.32-131.0.15. Mon Oct 31 17:45 - 17:48 (00:03)

root tty2 Wed Sep 29 21:11 - 21:11 (00:00)

A Linux computer currently has no access to the internet. Which command is used to display and manipulate the information about the network gateway for the system? gateway route ifconfig netstat

route Route command is used to show/manipulate the IP routing table. It is primarily used to set up static routes to specific hosts or networks via an interface.

Which of the following commands can search for executable programs or scripts located in the PATH variable? what why which how

which using the command which, as in "which Is", the PATH variable is searched and starting at the first directory found in the PATH, will look for the command ls. If it is not found, the next directory is searched, and so on.

Which of the following statements would be used for sending both standard output and standard error to the same location?

2>&1 The statement "2>&1" is used to redirect the standard output and standard error to the same file.

Which redirection operator accepts text on the following lines as standard input? <> >> << ><

<< The << redirection operator is used to accept text on the following lines as standard input.

Which of the following is the file descriptor number used to represent the Standard Error (STDERR)?

2 The standard error (STDERR) is represented by the file descriptor number 2.

Which of the following options is used with tar to create a new .tar archive file? -c -v -f -n

-c The -c option is used to create a new tar file archive

Which option of the command history can be used to clear the user's history? -clr /c -c $clear

-c using history -c will clear the current users' history.

Which option can be used with useradd to specify the home directory for a user? -d -c -b -h

-d The -d option is used with useradd (useradd -d /path/to/directory username) to specify the user's home directory location instead of using the default directory.

Which of the following options is used with tar to specify the filename of the tar archive?

-f The -f option is used to specify the file name type of the archive file.

What option can be used with tail or head to specify the number of lines to display to the screen?

-n The -n option is used to specify the number of lines to display to the screen with tail and head. By default, these commands display only 10 lines to the screen.

Which of the following directories contain all of the installed kernels on your system and their needed drivers? /boot /proc /sys /dev

/boot /boot directory contains the kernel, its associated files, and its needed drivers to boot up the operating system during the startup process.

Which of the following would properly identify the device associated with the second partition on the first hard disk on the first IDE controller of a system? /dev/hda2 /dev/hd1b2 /dev/hdc1d2p2 dev/hdc1a2

/dev/hda2 Partitions on these disks can range from 1 (for the first partition) to 16 (for the sixteenth partition). If you have a few ide/pata devices installed in a system, they will be hda (the first device), hdb (the second device), hdc (the third device), and so on. Each partition on that device will append a number to it, so the second partition on the first device would be /dev/hda2.

Which file contains a list of the user's secondary groups? /etc/passwd /etc/shadow /etc/user /etc/group

/etc/group The /etc/group file contains a list of every user on the system and their secondary groups.

Which file is used to define all of the users on a Linux system?

/etc/passwd The /etc/passwd file is used to define all of the users on a Linux system.

Which file on a Linux system contains the passwords for each user on the system? /etc/password /etc/shadow /etc/passwd /etc/users

/etc/shadow The /etc/shadow file stores the actual password in an encrypted format (more like the hash of the password) for the user's account with additional properties related to the user password. Basically, it stores secure user account information. All fields are separated by a colon (:) symbol. It contains one entry per line for each user listed in /etc/passwd file.

Which file on a Linux system is modified to set the maximum number of days before a password must be changed?

/etc/shadow The /etc/shadow file stores the actual password in an encrypted format (more like the hash of the password) for the user's account with additional properties related to the user password. Basically, it stores secure user account information. All fields are separated by a colon (:) symbol. It contains one entry per line for each user listed in /etc/passwd file. The last 6 fields provide password aging and account lockout features.

Which directory contains the files and directories automatically copied over to a new user's home directory when the account is first created?

/etc/skel The /etc/skel directory contains files and directories automatically copied over to a new user's home directory when such a user is created by the useradd program.

Where should temporary files be stored on a Linux system that can be safely deleted during a reboot? /var/tmp /etc/tmp /tmp /bin/tmp

/tmp /tmp is designed to be used as fast (and small) temporary storage with a short lifetime. Many Linux systems will delete the/tmp directory contents on each reboot, and many distributions will mount the directory in the RAM-disk. /var/tmp is instead normally located on a physical disk, is larger in size, and can hold temporary files for a longer time. /var/tmp is not usually automatically deleted when the system is rebooted since it is stored on the physical hard disk.

Which option can be used to redirect the errors of a command to a specified file? 1> 2> E> X>

2> OBJ-3.2: Using 2> will redirect the errors from a command to the specified file.

Which of the following is NOT one of the core technologies of the World Wide Web? Browser HTML CSS Javascript

Browser

What is the practice of offering people the right to freely distribute copies and modified versions of a work with the stipulation that the same rights be preserved in derivative works created later called? Copyleft Copyright Openwrite OpenCopy

Copyleft Copyleft, distinguished from copyright, is the practice of offering people the right to freely distribute copies and modified versions of a work with the stipulation that the same rights be preserved in derivative works create later. They are considered protective or reciprocal, as contrasted with permissive free-software licenses.

Which Linux distribution is used as a basis for the creation of Scientific Linux? Linux Mint Ubuntu Red Hat Debain

Red Hat

What is a special permission bit set on a file or a directory that lets only the owner of the file/directory or the root user delete or rename the file? SGID Sticky bit SUID Special bit

Sticky bit A sticky bit is a special permission bit set on a file or a directory that lets only the owner of the file/directory or the root user delete or rename the file. No other user is given privileges to delete the file created by some other user.

What does LAMP mean?

The combination of Linux, Apache, MySQL and PHP or other programming languages LAMP (Linux, Apache, MySQL, PHP) is an archetypal model of web service stacks, named as an acronym of the names of its original four open-source components: the Linux operating system, the Apache HTTP Server, the MySQL relational database management system (RDBMS), and the PHP programming language.

What is defined by a Free Software license? The programming languages which may be used to extend the licensed program A complete list of libraries required to compile the licensed software Limits on the purposes for which the licensed software may be used The conditions for modifying and distributing the licensed software

The conditions for modifying and distributing the licensed software A free software license is a notice that grants the recipient of a piece of software extensive rights to modify and redistribute that software.

Which of the following is NOT contained in the /etc/passwd file? User Identification Number (UID) Home directory for the user The password of the user's account Default login shell

The password of the user's account The password field is the second field in the /etc/passwd file. Due to the /etc/passwd file's low security, the password is now stored in the /etc/shadow file instead, which can only be accessed by the root user. The /etc/passwd file now contains a single * in the password field to represent to the system that the real password is stored in /etc/shadow instead.

Which command adds the new user tux and creates the user's home directory with default configuration files? usercreate tux useradd -o default tux useradd -m tux passwd -a tux

The useradd command with the -m option creates the user's home directory with default configuration files.

How can the normal output from a command be written to a file while discarding the error output? command > discard-error > file command > /dev/null 2&>1 output command < output > /dev/null command >file 2>/dev/null

command >file 2>/dev/null OBJ-3.2: Specifying 2>/dev/null will filter out the errors instead of displaying them to your console. In more detail: 2 represents the error descriptor, which is where errors are written to. By default, they are printed out on the console. /dev/null is the standard Linux device where you can send output that you want to be ignored.

The output of the program date should be saved in the variable datenow. What is the correct statement to enter into the shell to set this variable?

datenow=$(date) To store the output of a command in a variable, you can use either of the following commands in the shell: (1) variable_name=$(command) or (2) variable_name='command'.

Your system is having an issue that you think is being caused by a faulty device driver. Which of the following commands should you use to print the message buffer of the kernel? printdriver dmesg ps syslog

dmesg The dmesg (display message or driver message) command is a command on most Unix-like operating systems that prints the message buffer of the kernel. The output of this command typically contains the messages produced by the device drivers.

What is the command that will show system boot time messages? echo lspci dmesg display system boot

dmesg dmesg, short for display message or driver message, is a command that prints the message buffer of the kernel. This command's output typically contains the messages produced by the device drivers that occur during the system startup and boot.

To determine if the last command run on a system was successful, which command should be executed? echo $? echo $# exit $ echo $0

echo $? OBJ-3.3: The command "echo $?" will display the exit code of the last command executed from the shell. If the result is 0, then the last command was successfully run without any errors.

Which of the following commands would be used to display the value of the HOME variable to the terminal's display? echo HOME echo $HOME echo &HOME echo "HOME"

echo $HOME To display the contents of a variable to the terminal's display, the command syntax is echo $VARIABLE, where VARIABLE is the variable's name.

How can the current directory and its subdirectories be searched for in the file named MyFile.xml? find . -name MyFile.xml grep MyFile.xml | find grep -r MyFile.xml find -P MyFile.xml | grep

find . -name MyFile.xml OBJ-2.3: find is a command that searches one or more directory trees of a file system, locates files based on some user-specified criteria, and applies a user-specified action on each matched file.


Ensembles d'études connexes

Software Engineer Interview Questions

View Set

Chapter 29: Management of Patients With Complications from Heart Disease

View Set

URINARY SYSTEM -CHAPTER 19 ANATOMY & PHYSIOLOGY

View Set

Section 2: Nationalism and Sectionalism Assessment

View Set

Drivers Ed Quiz 7 (respect and responsibility)

View Set

Chapter 22: Management of Patients with Arrhythmias and Conduction Problems

View Set