Linux Testout Practice Questions

¡Supera tus tareas y exámenes ahora con Quizwiz!

A friend sends you a shell script file that is 117 lines long. He says that he wants you to check the code on lines 82 through 87. What command would you enter while in vi command mode to go directly to line 82?

#82

You want to move a directory (and its files) to a destination directory that stores some of the same files using the mv command. You want to include the mv command in a script without monitoring the copy process. In addition, you do not want to overwrite the files in the destination directory. Which of the following mv command options would you use to prevent overwriting files?

-n

You have a critical file called yearend.xls. You have set the file permissions so that only the owner of the file can modify it, and only group owners can read it. Which of the following file listings show that you have set the permissions correctly?

-rw-r----- 1 george acctg 26256 June 1 04:16 yearend.xls

The diff command displays the differences between two files, line by line, and includes several options. You want to use the diff command to compare the differences between the q1results.txt and the q2results.txt files, with the output displayed in two columns. Which of the following diff options would you use to display the two column output?

-y

Which of the following paths represents the root directory?

/

What command would you enter while in vi Command Mode to find the word Sam?

/Sam

Under the Filesystem Hierarchy Standard (FHS), what is the full path to the directory that contains the device files for a Linux system?

/dev

You need to make a few changes to how the locatedb index file is created. What is the full path and filename of the file you should edit?

/etc/updatedb.conf

You want to make an alias persistent across all reboots of your Linux server. In which of the following files do you need to place the alias command to make the alias persistent?

/home/user/.bashrc, /etc/profile

You have just added a new kernel module to your Linux system. Where did Linux store the new kernel module?

/lib

You have just plugged a USB hard drive into your Linux server. Where does Linux mount this temporary storage device?

/media

According to the Filesystem Hierarchy Standard (FHS), which of the following directories contains information about the system state and processes?

/proc

Which of the following directories only exists in RAM and provides information about the system state and processes?

/proc

Which of the following directories is the home directory for the root user account?

/root

What is the full path to the directory that holds the man files on a Linux system?

/usr/share/man

What is the full path to the directory that contains data files that change constantly, including email, print jobs, and proxy cache files?

/var

What is the typical default umask value?

022

When creating a custom alias, how many commands can you add to the alias?

1 or more

Which of the following sets of octal permissions would allow everyone to execute the following file as if they were the root user? -rwxr-xr-x 1 root root 8045 July 24 2018 myscript

4755

For Linux files, the default permission is 666, and the default umask is 022. When a new file is created, it will be assigned 644 (rw-r--r--) permissions. If the umask is set to 027, what permissions will be assigned for newly created files?

640 (rw-r-----)

You are called into the office of a newly hired manager. The manager has copied a file from his old place of work onto his new workstation but is now receiving an error message that access is denied each time they try to access the file. The manager is not the owner of the file or a member of the group the file is associated with. Which of the following represents the LEAST set of file permissions needed for the manager to be able to read and write to the file?

666

You have just entered the umask u=rwx,g=rx,o=x command. What is the binary result of entering this command?

751

As an IT administrator, you are tasked with configuring an Apache web server by modifying the /etc/apache2/apache2.conf file. You open the file in vi. As you're looking at the file, you knock your spill-proof drink container onto the keyboard. It rolls over several keys as you try to pick it up. Now there are extra characters everywhere in the text buffer. Which of the following commands can you use to exit vi without saving any changes that were made to the text buffer?

:q!

Which of the following vi key combinations should you press while in Insert Mode to save the file you are working on and exit the editor?

<Esc>:wq

Which of the following actions defines a persistent alias?

Adding the command defining the alias to the appropriate shell configuration file.

Which of the following Linux features lets you store a shortcut in memory or as part of the shell configuration file that runs a specific command?

Alias

The setfacl command lets you set the access control list (ACL) for files and directories and includes several options. Drag the setfacl option on the left to the correct description on the right.

Apply operations to all files and directories recursively.: R Print the version of setfacl, and exit.: v All operations are applied to the Default ACL.: d Remove ACL entries.: x Modifies the ACL of a file or directory.: m Removes the Default ACL.: k Removes all extended ACL entries.: b

Match the nano shortcut on the left to the correct shortcut definition on the right.

Cuts the current line (or selected text) and stores it in the cutbuffer. - ^K (Ctrl+K) Uncuts (pastes) the text from the cutbuffer into the current line. - ^U (Ctrl+U) Displays the help text, which includes a list of all keyboard shortcuts. - ^G (Ctrl+G) Closes the current buffer or exits from nano. - ^X (Ctrl+X) Moves forward one word in the current line. - ^Space (Ctrl+Space)

The ls command displays the contents of a directory and includes several options. From the list on the left, drag an option to its correct description on the right. Displays directories but not files.

Displays directories but not files. -d Displays extended information including the owner, modified date, size and permissions. -l Reverses the sort order of the list. -r Displays all directory contents, including hidden content. -a Displays the contents of a directory and all of its subdirectories. -R

Which of the following is a characteristic of a symbolic link?

Distinct (non-duplicate) inode.

What is the impact to the customer_list file by entering the setfacl -m u:gsmith:r customer_list at the command prompt?

It grants the user gsmith read access to the customer_list file.

Which of the following nano text editor features makes it easier for beginners to learn than the vi text editor?

Keyboard shortcuts are displayed at the bottom of the editor.

What commonly predefined alias is configured to run the ls -l command?

LL

The getfacl command lets you display the filename, owner, group, and access control list (ACL) for a file and includes several options. Drag the getfacl option on the left to the correct description on the right.

Lists the ACLs of all files and directories recursively.: R Skips files that only have the base ACL entries (owner, group, others).: s Prints all effective rights comments.: e Lists numeric user and group IDs.: n Displays the default access control list.: d Displays the file access control list.: a Prints the version of getfacl and exit.: v

Match the vi command on the left with the correct description of the cursor movement the on the right.

Move the cursor up a line. - k Move the cursor one space to the left. - h Move the cursor one space to the right. - l Move the cursor down a line. - j

Drag the permission string on the left to the category on the right. Some permission strings will not be used.

Symbolic link : "lrwxrwxrwx" Hard link : "-rwxr-xr-x"

Which of the following statements BEST describe the purpose of the Filesystem Hierarchy Standard (FHS)? (Select two.)

The FHS allows users to predict where to find system configuration files., The FHS allows software installation routines to predict where to place configuration files.

Which of the following describes the effects of the ls -l /usr/bin >> /tmp/list.txt command?

The contents of the /usr/bin directory are written to a file named /tmp/list.txt. Previous file contents are kept, and the new information is added at the end of the file.

Match the vi mode on the left to the correct definition on the right.

The initial mode used when vi is started. It has commands that cut and replace text, and it is the mode vi uses to enter the other modes. - Command Mode The vi mode that works with the file system. Use it to save files after editing them. - Command Line Mode The vi mode used to write and edit text in the file. - Edit mode

When you enter the ls command for the current working directory, you see the following: lrwxrwxrwx 1 root root 4 2010-11-05 mydata -> shantsgems-rwxr-xr-x 1 root root 382 2010-10-05 shantsgems Which of the following is true of the files listed?

The mydata file is a symbolic link to the shantsgems file.

Leroy tries to copy some files to an ext3 volume and receives the following error: "No space left on device." Leroy executes the df command and determines that there is sufficient space to copy the files. He also verifies that he has permission to copy the files. Which of the following BEST describes Leroy's problem?

The number of inodes has been exhausted.

You create symbolic links in your home directory to a set of files in their /data directory using the ln -s command. Later, a system administrator deletes the files in the /data directory. What happens to the symbolic links that you created?

The symbolic links still exist in your home directory, but they are useless because the link has been broken.

While reading about file system permissions in Linux, you discover that the default permissions assigned to new files when they are created are rw-rw-rw- (666 octal), and new directories are rwxrwxrwx (777 octal). However, when you create a new file in a directory called /data, the permissions assigned are rw-r--r--. Which of the following BEST explains the results you are seeing?

The umask must be set to 0022 and, therefore, block the write permission for the group owner and everyone else.

You have deleted an annual_report_finances.png file from your Linux file system. However, when you enter the ls -a command on the directory where the file is located, you still see the file listed with the following permissions: -rwxr-xr-x Why is the file still listed?

There is still a hard link associated with the file data.

What is the purpose of the find command?

To search for files in the file system based on name, file size, time created, and other options.

ou need to create a large number of files, and you would like to ensure that you, the user owner, are the only person that has read and write permissions to the files. The files will be located in a number of different directories that already contain other files you don't want modified. How could you BEST create these files with the correct permissions using the LEAST amount of effort?

Type umask 0066 to change your umask.

Which of the following describe file globbing in Linux?

Using wildcards (e.g., * , *.* , *.txt) to match specific files.

Which of the following is a characteristic of a hard link?

Valid inode for the file data even if the original filename is deleted.

You have entered the umask 0033 command to change the default umask setting for files and directories.

What are the default file permissions assigned to a new file? rw-r--r-- (644) What are the default permissions assigned to a new directory? rwxr--r-- (744)

Which of the following nano editor keyboard shortcuts displays help text, including a list of all keyboard shortcuts?

^G (Ctrl+G)

A umask can be represented and changed using a symbolic (letter) representation of the mask. Which of the following letters is equivalent to all the mask symbols?

a

What command displays a list of the currently defined aliases on the system?

alias

You want to create a grepcolor alias that provides a lime green (36) background color to the search terms when using the grep command. You want this command to be persistent when rebooting your Linux server. What command would you enter into the shell configuration file to create this persistent alias?

alias grepcolor="grep --color=36"

Mary Brown is a Linux user with the username mbrown. Mary has a directory named logs in her home directory that is regularly updated with new log files when certain system events occur. She runs the following commands several times a week to check this directory: cd /home/mbrown/logs ls -al She wants a persistent alias named logcheck to run these two commands. What command would Mary enter into the shell configuration file to create this persistent alias?

alias logcheck="cd /home/mbrown/logs;ls -al"

Which of the following commands creates a shortcut that can be used to run the tail -f /var/log/messages command?

alias sysmesg="tail -f /var/log/messages"

Which of the following commands stores the output of the ls -a command in a shell variable named allfiles?

allfiles=$(ls -a)

Which of the following commands can you use to combine the content of three files into a single text stream?

cat

Which of the following commands sorts the combined contents of the wordlist1 and wordlist2 files and sends the results to both the screen and a file named sortedwordlist?

cat /usr/wordlist1 /usr/wordlist2 | sort | tee sortedwordlist

Which of the following commands gives the same results as cat < turbo?

cat turbo

You need to change ownership of a script called myscript so that only the user owner has read/write access to it and only the user owner and group owner have execute permissions. Which of the following commands will accomplish this task?

chmod 750 myscript

The following are the permissions currently assigned to the customer_list file: -rwxr-xr-x 1 mfoote finance 8045 July 24 2022 customer_listYou want to add the write permission for the finance group and remove all permissions for others. Which of the following commands would accomplish this task?

chmod g+w,o-r,o-x customer_list

You want to create an exact copy of /home/mary/june_report in /home/jeremy/ creating a hard link called project_june. What command would you enter at the command prompt to create this link?

cp -l /home/mary/june_report /home/jeremy/project_june

Which of the following commands will (by itself) copy the entire /temp directory with all of its files, sub-directories, and files in the sub-directories to the /home/gshant directory? (Select two.)

cp -r /temp /home/gshant, cp -R /temp /home/gshant

A Linux administrator is logged in as root and needs to copy a file named letter.doc from the USB flash drive mounted under /media/usb. Which of the following commands will copy the file from the USB flash drive to the root user's home directory?

cp /media/usb/letter.doc /root

A shell script developer knows that the date +%A command gives the current local weekday name (Sunday, Monday, Tuesday, ...). Which of the following commands will copy the authentication log file, /var/log/auth.log, to a new file with a filename that includes the current local weekday name?

cp /var/log/auth.log ~/auth$(date +%A).log

You are searching the standard input for any line containing "JAMESTOWN" at the end of a line. Which egrep constructor should you enter at the command prompt?

egrep JAMESTOWN$

Which of the following commands is the FASTEST method of searching a file for fixed strings rather than regular expressions?

fgrep

What would you enter at the command prompt to display a file's type?

file

Which of the following commands finds all of the files on the system that have either blue or gold in their names?

find / -name '*blue*' -o -name '*gold*'

Which of the following commands displays the filename, owner, group, and access control list for the mynotes file?

getfacl mynotes

Which of the following commands displays the user groups that dblair is a member of?

grep -e dblair /etc/group

You need to view the contents of the /home/jerrys directory. What would you enter at the command prompt to show all the contents, including hidden files and directories?

ls -a /home/jerrys

Which of the following commands displays an expanded listing that includes the owner and size of all the files in the /etc directory?

ls -al /etc

Which of the following commands lists the node numbers for the files in your Linux file system?

ls -i

You attempt to view the contents of a directory, but the output of the ls -l command scrolls beyond the limit of one console window. Which of the following commands would allow you to see the full listing of the directory?

ls -l | less

As a Linux script developer you are trying to debug a shell script that has the command ls -s in it. You suspect that an error is occurring, and want to send the results of the operation and any errors to a file named ~/Friday in order to examine it later. Which of the following commands should you use?

ls -s &> ~/Friday

Which of the following commands displays the attributes of the /boot/grub/grub.conf file?

lsattr /boot/grub/grub.conf

As a Linux administrator, you need to create the directory /var/oracle/database/9i. Only the directory /var currently exists. The current working directory is the root of the filesystem. Which of the following commands will create the directory path?

mkdir -p /var/oracle/database/9i

Which of the following commands moves a file from one location to another?

mv

Which of the following commands will change the /home/pmallory/reports filename to reports.bak?

mv /home/pmallory/reports /home/pmallory/reports.bak

You want to rename the quarterlyreports.txt file in the /sales/reports directory to qreports.txt. You are currently in the root directory at the command prompt. What command can you enter to rename the file?

mv /sales/reports/quarterlyreports.txt /sales/reports/qreports.txt

A bash script developer is trying to debug a shell script named myscript. Which of the following commands would record the output of the script in a testfile.txt text file?

myscript >> testfile.txt

Which of the following commands utilize command substitution? (Select two.)

myvar=`sort -r names.txt`, myvar=$(sort -r names.txt)

While in vi Command Mode, you copy a whole line of text to the general buffer. You then navigate to a different location in the file. Which of the following commands will let you paste the copied text?

p

Which of the following sets of permissions represent the minimal permissions required to allow a user to list the contents of a directory?

r-x

Within the /var directory is a subdirectory named backup. You need to delete the directory backup and any files that it contains. You change the directory focus to /var. Which of the following commands will delete the directory named backup and any file it contains?

rm -r backup

The /home/gshant/smp directory contains several files. The directory and files need to be removed. The current working directory is /home/gshant. What would you enter at the command prompt to remove the SMP directory and all the files it contains?

rm -r smp

The /home/gshant/smp directory is empty and needs to be removed. The current working directory is /home/gshant. What would you enter at the command prompt to remove the smp directory?

rmdir smp

An employee has mistakenly copied a secure, private file from a network directory to their local hard drive. You want to completely overwrite the file data on the hard drive, as well as delete the file inode (file metadata). Which of the following commands would you use to perform this task?

shred -u

A user, ljenkins, contacts the help desk about an error received while removing a file from their home directory. The user received the following error when trying to use the rm command to remove the file: [ljenkins@fileserver]$ rm report.txtrm: remove write-protected regular empty file 'myfile2.txt'? yrm: cannot remove 'myfile2.txt': Operation not permitted While troubleshooting the issue, you list files in the directory to see if you can discover the issue: Which of the following commands would resolve the problem and allow the file to be deleted?

sudo chattr -i report.txt && rm report.txt

Which command reads from standard input (stdin) and writes to both standard output (stdout) and a file?

tee

Which of the following commands changes the /home/gshants/smile file's modification and last accessed times to the current time?

touch /home/gshants/smile

Which of the following utilities displays the category of a command?

type

Which of the following commands restricts all-new file permissions by applying a filter to prevent specific permissions from being assigned to the file?

umask

You want to display the current umask setting with a symbolic representation of the mask (such as u=rwx,g=rx,o=rx). Enter the command you would use to display the symbolic representation.

umask -S

An employee calls the help desk. Each time the employee creates a new text file, permissions of 640 are applied to the file, and the employee must use chmod to set them to 644. What command should you enter in the employee's profile to set the default permission for newly created files to 644?

umask 0022

You have created a listgroups alias that you now want to remove. Which of the following commands will remove the alias?

unalias listgroups

You have created a project_ln soft link and now want to remove the link from your Linux file system. Which of the following commands will remove the soft link?

unlink project_ln

You use a program on your Linux system called photorec. What would you enter at the command prompt to display the path to the photorec binary file?

which photorec

Which command overcomes the 128 KB shell command size restriction by breaking up long lists of arguments?

xargs


Conjuntos de estudio relacionados

Chapter 7: Thinking and Intelligence Study Guide Psychology Part 1

View Set

Chapter 0, Linux Ch. 7&8, Linux Chapter 2, Linux Chapter 1, Linux Test chapters 4-9

View Set

Ch. 6: Differentiation, Cost Leadership, Blue Oceans

View Set

Chapter 9: Communication and the Clinical Interview Evolve Questions

View Set

Managerial Accounting Long Problems Review

View Set

Developmental Psychology (Life Span) Part 1

View Set

PrepU Chapter 36: Management of Patients with Musculoskeletal Disorders

View Set

Principles & Practices: Module 7 (Chapter 12, Overview Real Estate Finance)

View Set