csis345 quiz2

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

Which switch below can be added to the ls command to show a list of files and their type?

-F

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

-R --recursive

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

-l

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 Filesystem Hierarchy Standard specifies what directory as the root user's home directory?

/root Correct. A /root is the root user's home directory.

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

/var/lib/mlocate/mlocate.db Correct. 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 Correct. If the x (1) for user, rwx (7) for group, and rwx (7) for others is masked off, the default permissions should be -rw-------.

When using the ls -F command, what special character indicates a linked file? A. @ B. * C. & D. -

A. @

What command is most effective at identifying different types of files? A. stat B. ls -l C. ll D. file

A. stat

What metacharacter can be used to refer to the current user's home directory? A. ~ B. @ C. & D. #

A. ~

At the vi command mode prompt, what key combination below will force a quit from the vi editor without saving changes? A. :q B. :q! C. :exit D. :!

B. :q!

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

Ctrl +g

In the GNU Emacs editor, what key combination can be used to delete all characters between the cursor and the end of the line?​ a. ​Ctrl+k b. ​dd c. ​Ctrl+a d. ​Ctrl+d

Ctrl+k

To display the contents of a text file called data, what command should be used? A. disp data B. ls data C. ls -l data D. cat data

D. cat data

In what mode does the vi editor open by default? A. append mode B. insert mode C. overview mode D. command mode

D. command mode

Select the command below that can be used to provide a long listing for each file in a directory: A. ls -T B. ls -L C. ls -F D. ls -l

D. ls -l

What command can be used to display the last five lines of a text file? A. end -5 B. head -5 C. stop -5 D. tail -5

D. tail -5

Which character(s) below represent extended regular expression metacharacter(s)? A. . B. [...] C. ^ D. {}

D. {}

An alternative to the vi editor that offers an equal set of functionality is the GNU _________________________.

Emacs (Editor MACroS) editor

If enough unique letters of a directory name have been typed, what key can be pressed to activate the BASH shell's completion feature? A. Alt B. Tab C. Ctrl D. Esc

B. Tab

Using wildcard metacharacters, how can one indicate a number is either, 1,2,3, or 4? A. 1-4 B. [1-4] C. [1234] D. [1,2,3,4]

B. [1-4]

In order to move from the /home/joe/test/data to the /home/joe directory, what command below should be issued? A. cd .. B. cd ../.. C. /home/joe D. cd ./..

B. cd ../..

In vi, using command mode, what series of key presses below will cause the line on which the cursor is on to be deleted? A. X B. dd C. yw D. D

B. dd

What command can be issued to confirm what directory you are in at a command line prompt? A. dir B. pwd C. whereami D. ld

B. pwd

To display text in reverse order, what command should be used? A. cat B. tac C. tee D. set

B. tac

Which switch below can be added to the ls command to show a list of files and their type? A. -T B. -L C. -F D. -l

C. -F

Which of the following key combinations, commonly used in the vi editor command mode, displays current line statistics? A. $ B. x C. Ctrl+g D. P

C. Ctrl+g

In the GNU Emacs editor, what key combination can be used to delete all characters between the cursor and the end of the line? A. dd B. Ctrl+d C. Ctrl+k D. Ctrl+a

C. Ctrl+k

The LISP artificial intelligence programming language can be used with which text editor below? A. Kedit editor B. Joe editor C. Emacs D. Nedit

C. Emacs

The LISP artificial intelligence programming language can be used with which text editor below? a. Kedit editor b. Nedit editor c. Joe editor d. Emacs editor

Emacs editor

It is acceptable to use shell metacharacters when naming files. True or False?

False

Pressing the Esc key at the prompt while using the more command displays a help screen. True or False?

False

The command strings /bin/echo displays the raw binary characters inside the /bin/echo binary executable program. True or False?

False

What command is most effective at identifying different types of files?​

File

Text wildcards used to ease the searching of specific text information are called _________________________.

Regular expressions (regexp)

If enough unique letters of a directory name have been typed, what key can be pressed to activate the BASH shell's completion feature? a. Tab b. Ctrl c. Alt d. Esc

Tab

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 Correct. 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

chgrp

What command is used to change the group ownership of a file or directory?

rmdir

What command is used to delete an empty directory on a Linux system?

/var

What directory on a Linux system is commonly used to store log files and spools?

255

What is the maximum number of characters in a Linux filename?

Read for the owner, none for the group, and write for others

What permissions would be removed from new files given the command umask 402?

64G

What vi command mode command allows you to move the cursor to line 64 of a file?

:wq

What vi command would be used to save changes to a file and quit from the vi editor?

strings

Which command can be used to search for text characters in a binary file and output them to the screen?

la -a

Which command can be used to view hidden files in Linux?

pwd

Which command will display the current working directory onscreen?

mv file1 file2

Which of the following commands can be used to move a file to the same directory but with a different filename?

cat -n project4

Which of the following commands can be used to view an entire text file called project4 along with line numbers for each line of text?

chattr -i doc1

Which of the following commands will remove the immutable attribute from the doc1 file?

.ps

Which of the following does NOT represent compressed file types?

grep -v

Which of the following grep commands would be issued to view the contents of a file except the lines that include the word "hello"?

symbolic link

Which of the following is a pointer to another file on the same or another filesystem?

*

Which wildcard metacharacter stands for all the files in the current directory?

Due to the fact that the * character can be used to match all ​characters in a filename, or all files in a directory, it is referred to as a ____________ metacharacter.

Wildcard

Using wildcard metacharacters, how can one indicate a number is either 1, 2, 3, or 4?

[1-4]

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?

a grep -E "(John|Bob)" salesemployees.csv

To display the contents of a text file called data, what command should be used?

cat data

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

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

pwd

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

rm -rf olddir Correct. 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.

To display a text file in reverse order, what command should be used?​ a. tee b. ​tac c. ​cat d. ​sed

tac

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

tail -5

Which of the following commands can be used to update the last modified timestamp on a file, or if the file specified does not exist will create the file?

touch file.txt Correct. The touch command will update the last modified date on a file when used on a file that exists. When used on a file that does not exist, it will create a blank file

Which of the following commands will return one result of where the grep binary executable is located? (Choose two.)

type grep which grep

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 Correct. 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.

Which character(s) below represent extended regular expression metacharacter(s)?

{}

What metacharacter can be used to refer to the current user's home directory?

~

In order to move from the /home/joe/test/data to the /home/joe directory, what command below should be issued? a. cd .. b. /home/joe c. cd ./.. d. cd ../..

cd ../..

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 Correct. 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, u=r file1.txt chmod 754 file1.txt Correct. 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).

In what mode does the vi editor open by default?​ a. ​command mode b. ​overview mode c. ​insert mode d. append mode

command mode

In vi, using command mode, what ​series of key presses below will cause the line on which the cursor is on to be deleted? a. ​yw b. ​dd c. ​d d. ​X

dd

Kate wants to compare two text files to identify what might have been changed from one version to another. Which of the following commands can she use to do this?

diff document1.txt document2.txt

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

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 Correct. 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 can be used to recursively search a directory tree for files that meet a certain criterion without using a database or premade index of files?

find Correct. The find command does not use a database or premade index of files. It recursively searches through a directory for files that meet a certain criterion.

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? (Choose two.)

find /var/log -user root Correct. 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 Correct. A "g" argument stands for a "Group." Operation "+" adds a read permission and operation "-" removes a write permission.

Chase is trying to extract records for employees 423 through 428 out of a comma separated values file and store them in another one. Which of the following commands would accomplish this? (Choose all that apply.)

grep "42[3-8]" employees.csv > employees-newhires.csv cat employees.csv | grep "42[3-8]" > employees-newhires.csv grep "42[3-8]" < employees.csv > employees-newhires.csv

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

Which of the following commands will not interpret regular expressions, which translates into faster results being returned? (Choose all that apply.)

grep -F fgrep

Which of the following commands will create a symbolic link named foo.txt to an original file named bar.txt

ln bar.txt foo.txt Correct. The ln command does not require any options to be used in order to create a hard link. The ln command should be followed by the name of the original file and then the name of the link to create.

Which of the following permissions would show for a symbolic link when displayed with the ls -l command?

lrwxrwxrwx

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 Correct. 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 -il ls -i

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 Correct. The -p option will create parent directories when they do not already exist.

Select the regular expression metacharacter that matches 0 or more occurrences of the previous character. a. + b. ^ c. ? d. *

*

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 Correct. 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 below will force a quit from the vi editor without saving changes? a. ​:q! b. ​:! c. :exit d. :q

:q!

When issuing the ls -F command, what special character indicates 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

Select the regular expression metacharacter that matches 0 or more occurences of the previous character. A. * B. ? C. + D. ^

A. *

When using the vi text editor, which of the following keys, when in command mode, will move to the last line in the document?

G

Filenames that start with a period, such as .file, are referred to as

Hidden Files

updatedb

In order to update the database used for the locate command, which of the following commands can be issued?

Read, write, and execute

In the mode rwxr-xr-x, what permissions are associated with the file owner?

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.

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

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

-f

To override the interactive option, which is known as interactive mode, use the _____ option to override the choice.

Linux uses a logical directory tree to organize files into different folders. True or False?

True

The more command should not be used on binary files. True or False?

True


Kaugnay na mga set ng pag-aaral

Unit 8: E-Commerce and Social Media - Unit Test

View Set

Insurance Regulation: Questions & Answers

View Set

Business & Professional Communication

View Set

Intro to Business Unit 2 Milestone 2

View Set

Chapter Six Review + Quiz Questions

View Set

Psychology of Risky Behaviour in Adolescence

View Set