Linux 1

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

Which of the following characters can be entered at the beginning of a line in a shell script to ensure that line is recognized as a comment rather than try to execute it?

# Entering a pound sign—#—at the beginning of a line will ensure that line is recognized as a comment and will prevent the system from trying to execute it.

What metacharacter indicates background command execution?

& The & metacharacter is used for background command execution.

Select the regular expression metacharacter that matches 0 or more occurrences of the previous character.

* While using regular expressions, the * permits you to match 0 or more occurrences of the previous character.

Which of the following options will change the ownership of files and directories recursively within a directory? (Choose all that apply.)

--recursive -R The --recursive option will recursively change ownership on files and subdirectories within a directory. The -R option will recursively change ownership on files and subdirectories within a directory.

Which of the following is a valid method of running a script named myscript.sh? (Choose two)

./myscript.sh source myscript.sh A ./ in front of a script filename will run the file as a script The source command will run a file provided as a parameter as a script in the current shell.

Sandra needs to obtain the latest image of Fedora so that she can install it as a virtual machine on her Windows workstation. Which of the following file formats is Sandra likely to find available for download from Fedora's website in order to allow her to use the file as the source for booting and installing Linux as a VM?

.iso This is a disk image that is commonly available to download from Linux distribution sites and is meant to be burned to an optical disc or used as installation media for virtual machines.

Lynn runs the locate command and the results include many files from a directory that she doesn't want to include in her search. Which of the following files could Lynn modify so that the locate command no longer includes those results?

/etc/updatedb.conf The locate command uses the configuration file located at /etc/updated.conf.

What is the complete path and filename for the database that is used by the locate and mlocate commands?

/var/lib/mlocate/mlocate.db The mlocate.db database used by the locate and mlocate commands is located in the /var/lib/mlocate directory.

Which of the following umask settings will result in new files receiving the default permissions -rw-------?

0177 If the x (1) for user, rwx (7) for group, and rwx (7) for others is masked off, the default permissions should be -rw-------.

Jan needs to set permissions on a file so that the owner has read, write, and execute permissions. The group should have read permissions only, and everyone else should have no access. Which of the following parameters, when used with the chmod command, would set the permissions described?

740 The permissions are set from left to right for owner, group, and everyone else. Read = 4, Write = 2, and Execute = 1. A 7 in the owner placeholder is equal to 4 + 2 + 1, or Read + Write + Execute. A 4 in the group placeholder means only the read bit is turned on. A 0 in the others placeholder means that none of the permissions are set.

At the vi command mode prompt, what key combination will force a quit from the vi editor without saving changes?

:q! The :q! quits vi regardless of whether the last changes have been saved for the current vi execution.

When issuing the ls -F command, what special character indicates a linked file?

@ The @ symbol indicates that the file is a linked file.

When using the vi text editor, which of the following keys, when in command mode, will change to insert mode and place the cursor at the end of the current line?

A A capital A will change to insert mode and move to the end of the current line to append new text.

Which of the following are true of the echo command? a. Including a semicolon at the end of the line will not affect the text being displayed. b. All of the other options are true. c. When used to display text, quotation marks are optional. d. It can be used to display shell variables by including a $ sign in front of the variable name.

All of the other options are true. All of the options are true. The echo command can be used to display text whether the text is surrounded by quotation marks or not. It will display shell variables by using the $ sign in front of the variable name. It will also execute the command with a semicolon at the end and not affect the text. This is because you can run multiple commands at the command line by separating them with semicolons, but if there is only one command, it just stops after that command.

Which of the following commands can be used to create a BASH variable named CREATOR with the value of Torvalds?

CREATOR="Torvalds" The name of the variable should be followed by an equal sign.

Which of the following key combinations, commonly used in the vi editor command mode, displays current line statistics?

Crl+g Current line statistics include the filename, current line number, total lines in a file, and the percentage (%) of file location.

What piece of software tells the operating system how to use a specific hardware device?

Device driver The device driver is responsible for communicating with the operating system on how to establish communication with specific devices.

The iptables software on Linux is an example of what kind of software?

Firewall The iptables, also known as netfilters, are included as part of all Linux distributions and are used to configure a set of rules necessary to make a system firewall.

Which of the following is the greatest expense for companies using Linux?

Hiring people to maintain the Linux system Hiring staff to maintain the Linux system, along with the costs such as purchasing the computer hardware necessary for the computers to host Linux, is the greatest expense for companies using Linux.

What two Linux distributions utilize the Debian package manager by default?

Linux Mint Ubuntu Linux Linux Mint is a Debian-based distribution, focused on providing desktop and mobile user capabilities. Ubuntu is a Debian-based distribution that is widely used in all environments.

When viewing the version number for a Linux kernel, what number indicates the stability of the kernel?

Minor number Minor number indicates the stability based on the introduction of new features added to the Linux Kernel.

Which of the following can be used to synchronize the time between a number of Linux servers and workstations on a network with a time clock source on the Internet?

NTP NTP is the Network Time Protocol, which can be used to synchronize a system's time from a remote time clock source.

What Linux distribution is the most commonly used distribution within organizations today?

Red Hat Red Hat is one of the earliest Linux distributions and is commonly used within organizations. Support platforms include: x86/x64, PPC/POWER, Mainframe, and ARM.

Which of the following types of cloud platforms would a webmail service offered to the general public be considered?

SaaS Webmail services are a form of Software as a Service, or SaaS.

If a Linux installation ends abnormally and the screen displays a fatal signal 11 error, what type of error has occurred?

Segmentation fault The segmentation fault indicates an error when a program accesses an unassigned area in the RAM.

If a hard link is created to a file and then the original file is deleted, which of the following is true?

The original file will be removed while the hard link remains usable to access the contents of the file. When the original file is deleted, since the hard link points to the same inode, the contents of the inode are still accessible via the hard link.

What would be the result of running the command chown :root file1.txt

This would set the group ownership of file1 to root. The correct syntax is chown user:group filename. The user and group are both individually optional. You can specify one, the other, or both.

In Linux, the core component of the GUI is known as:

X Windows The original implementation of X Windows on Linux was called XFree86. This core component affects the look and feel of the Linux GUI.

What is the term for a ZFS managed filesystem that is created from ZFS pools?

ZFS volume The ZFS volumes are Zettabyte File Systems (ZFS)—managed filesystems that are created from ZFS pools.

Which command can be used to create a new command that will monitor the contents of auth.log as they get added to the file?

alias showauth='tail -f /var/log/auth.log' The alias command will create a new command for the command line as shown to show the last lines of the auth.log file and leave the stream open so that any new entries also are displayed.

A calendar for the current month can be shown on the command line by issuing which command?

cal The cal command displays the calendar for the current month. The cal command accepts different options that allow you to display the calendar according to the options you choose.

Which of the following results would be created by the command sequence: echo 'apple banana carrot dog elephant' | while read a b c; do echo result: $c $b $a; done

carrot dog elephant banana apple The read command will read apple into a, banana into b, and then the rest will be read into c. When it gets displayed using the reverse order, c is displayed first, then b, then a.

Which of the following commands will send the output of the cat command to the grep command to be filtered?

cat /etc/passwd | grep jsmith The | (pipe) symbol will send the output of one command to another.

In order to move from the /home/joe/test/data to the /home/joe directory, what command should be issued?

cd ../.. The cd ../.. command allows you to move back two previous directories from the current directory. This command will move you to the /home/joe directory.

In order to set all of the special permissions on a certain file or directory, which command should be used on a file named filename?

chmod 7777 filename In the chmod 7777 command, the first three bits represent the SUID(4), SGID(2), and sticky(1) flags.

Which of these commands will set the following permissions on file1.txt? User = Read, Write, Execute Group = Read, Execute Others = Read

chmod u=rwx, g=rx, o=r file1.txt chmod 754 file1.txt The chmod command can be used to set permissions by specifying the exact permissions (r, w, and/or x) for users (u), group (g), and others (o) followed by the filename they are to be set for. The chmod command can be used to set permissions by specifying them in octal format. Read has a value of 4, write has a value of 2, and execute has a value of 1. They are in the order of user, group, and then other. You just have to add up the values of each of the permissions for each of the places. Read (4) + Write (2) + Execute (1) for the user gives us 7 as the first character. Read (4) + Execute (1) gives us 5 for the group. Read (4) only is set for all other users. The full result is 754. The syntax is important so after the chmod comes the permissions to be set followed by the filename(s).

Select the command that can be used to change the root filesystem to a different directory, such as when you are in a rescue environment.

chroot The chroot command allows you to change the root of the live OS to the /mnt directory, which is actually the / (root) filesystem on the local disk.

Which command should you run after installing a new kernel module to update the module dependency database?

depmod The depmod command can be used to update the module dependency database.

Which of the following are valid permissions for a directory where the command chmod 1777 has been used to set the permissions on it?

drwxrwxrwt The chmod 1777 command will set the sticky bit permission on this directory, which will allow all users to add files to the directory. However, users can only delete the files they own in that directory because the sticky bit is set. This results in a lowercase t being shown instead of an x in the others permissions.

You have just created a variable named CREATOR. Which of the following commands will display the contents of the variable to standard output?

echo $CREATOR Though you do not use the dollar sign to create the variable, you do use a dollar sign to display the variable contents using the echo command.

After a shell is no longer needed, what command can be given to exit the shell?

exit The exit command allows you to exit out of your current shell.

Which of the following commands can be used to recursively search through the directory tree in search of a file that meets a set of given criteria instead of using an indexed database

find The find command can be used to find recursively search the directory tree instead of using an indexed database of files. This means that it is a slower alternative when looking for files.

Which of the following commands will display all files and directories within the /var/log directory or its subdirectories which are owned by the root user?

find /var/log -user root After the find command, you should specify the base directory or subdirectory where you want to limit the search to (including any subdirectories contained within), and then the user option can narrow the list of files returned to only those owned by a particular username.

What argument can be used with the chmod command to add read permission and remove write permission for a group on a file?

g+r-w A "g" argument stands for a "Group." Operation "+" adds a read permission and operation "-" removes a write permission.

Jo has received a text file which contains multiple instances of his name spelled correctly as well as multiple instances spelled as Joe. Which of the following commands would search a text file for any occurrences of either spelling and display them out to the terminal? (Choose three.)

grep "Joe*" document1.txt grep -E "Joe*" document1.txt grep -E "Joe?" document1.txt The grep command can use an asterisk to match zero or more instances of the previous character. As the asterisk is used for common regular expressions, the -E is not necessary, although it will also work with a -E. Although the -E is not necessary, the asterisk will return all instances where the string contains Jo as well as zero or more of the letter e. The grep command must have the -E specified in order to use a question mark, which is considered part of an extended regular expression.

Garrett wants to search through a csv file to find all rows that have either the name John or Bob in them and display them out to the terminal. Which of the following commands could Garrett use to perform this search?

grep -E "(John|Bob)" salesemployees.csv The grep command has a -E option that specifies that it should use extended regular expressions. When used inside parentheses and the pipe symbol, you can search for lines that contain either John or Bob. The pipe symbol is commonly used as an OR operator.

Which of the following will look at the /etc/passwd file for any lines containing the word root and display them out to the screen while simultaneously writing the results to a file?

grep root /etc/passwd | tee ~/root.txt The output of the grep command is sent to the tee command, which displays the output to the screen while simultaneously writing it to a file.

Which of the following is a type of software that allows a piece of hardware to host multiple operating systems?

hypervisor A hypervisor is a type of software that allows multiple operating systems to run as guest operating systems on a single piece of hardware. They come in type 1 and type 2 versions.

In order to create and manage KVM or Qemu virtual machines, a Linux system must have which of the following installed?

libvert The libvert virtualization libraries must be installed in order to create and manage KVM or Qemu virtual machines.

Wayne is using the command line and is in his home directory. Which of the following will display a list of all files and their sizes from his home directory? (Choose two.)

ls -al ~ ls -al /home/wayne The -a will list all files and the -l will list extra information about them, including file sizes. The tilde is a shortcut way of referencing a user's home directory.

Nicholas wants to verify whether a file is a hard link to a file within the same directory. Which of the following commands could he use to see information that would be helpful to make this determination?

ls -i The ls command has a -i option to show the inodes for each of the files in a directory. A hard link will have the same inode number as the original file.

Jamie has created a hard link to another file within the same directory. Which of the following commands can he use to verify that the hard link was created correctly? (Choose all that apply.)

ls -i ls -il The -i option will display the inode of the file. A hard link and the original file will have the same inode number. The -i option will display the inode of the file while the -l will show extra details about the file. A hard link and the original file will have the same inode number.

Select the command that can be used to provide a long listing for each file in a directory:

ls -l The ls -l is used to provide a long listing for each file in a certain directory.

Which of the following commands can be used to display general hardware information for the entire system?

lshw The lshw command displays general hardware information for the entire system.

The apropos list command produces the same results as which command below?

man -k list The command man -k is equivalent to apropos. Both commands will give the exact same output on the terminal screen.

Dustin runs a command at the command line trying to find out what kernel version the system is running. However, it doesn't give him the information he needs. He knows there is an option that can be used to display the kernel version. How can he find out which option to use?

man uname The man command will display the manual pages for a command. The uname command will display system information. To display just the kernel version, he would be able to run the command and option combination of uname -v.

Which of the following commands can be used to create and manage a software RAID configuration after installation?

mdadm The mdadm command can be used to create and manage a software RAID configuration after installation.

Mindy wants to create a new subdirectory at ~/2019projects/projectx/projectplans to start storing the initial project plans for projectx. However, this is the first project she has worked on in 2019 and the 2019projects directory does not exist yet. Which of the following commands will create the higher level directories if they do not already exist?

mkdir -p ~/2019projects/project/projectplans The -p option will create parent directories when they do not already exist.

Jim wants to rename a directory for a project that he has been working on. Which of the following commands can he use to perform that action?

mv projectx projecty The mv command can be used to move files from one directory to another, or move a file from one filename to another, thus renaming the file

Which of the following types of servers can be used to cache requested Internet resources so that they can be more quickly delivered to users requesting the same resource while at the same time reducing the burden on the external network connection to the Internet for an organization?

proxy server A proxy server requests Internet resources on a user's behalf and can be configured to cache results so that multiple users requesting the same content don't require contacting the resource individually.

What command can be issued to confirm which directory you are in at a command line prompt?

pwd The pwd (print working directory) command prints the current directory where the user is located at a command line prompt.

Mike has changed directory into one subdirectory after the next and has lost track of where he's at in the directory tree. Which of the following commands can he use to tell him the full path to the current subdirectory he is in?

pwd The pwd command stands for present working directory.

Which of the following commands will delete a directory and all of the files contained within it? (Choose all that apply.)

rm -rf olddir The -r option for the rm command will recursively delete directories as well as any subdirectories contained within them, as well as files contained in any of those directories or subdirectories. The -f option is to force delete them without asking for confirmation on each file or subdirectory.

Which of the following commands will display the contents of the /etc/passwd file in alphanumerical order?

sort /etc/passwd The sort command will display the contents of a file in alphanumerical order.

What command can be used to display the last five lines of a text file?

tail -5 The tail command by default retrieves the last 10 lines on a file. However, by specifying a number after the dash (-), the user has the capability to customize the number of lines to retrieve. In this example, -5 is used to display the last five lines on the file.

How many times will the following loop execute as part of a script: #!/bin/bash COUNTER=0 while [ $COUNTER -lt 7 ] do echo "hello world"

until ctrl-c is used to terminate it The script is missing a line to increment the counter after echoing hello world, which means the counter will remain at 0 in an infinite loop until it is terminated.

Jean installs a distribution of Linux on a workstation and attempts to run the locate command to find a certain file. Instead of returning the results she expected, an error message is displayed that it cannot find the mlocate.db file in its default location. Which of the following commands should Jean run in an attempt to resolve this problem?

updatedb The updatedb command is usually run daily by cron to update the default database. However, until it is run for the first time, the locate command will be unable to search an index of the files on the system. This means that it may be necessary to run the updatedb command manually before the locate command can be used for the first time.

On a system using the KVM hypervisor, which of the following modules would you expect to see as part of the output of the lsmod command on a guest Linux virtual machine?

virtio On a system using the KVM hypervisor, the modules that are loaded on a guest Linux operating system start with virtio.

Which of the following server roles does Apache perform?

web server Apache is one of the most popular web server platforms on the Internet.

Which Linux command can be utilized to display your current login name?

whoami The shell is the interface that interacts with the computer user. The shell is responsible for accepting the user's commands and passing them to the kernel for processing.


Kaugnay na mga set ng pag-aaral

BUS321 CH1- Environment and Theoretical Structure of Financial Accounting

View Set