2.9.11 Files

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

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

cat The cat command displays the contents of a file. If multiple files are added to the command, the contents of each file will be displayed in a single text stream. The cut command removes sections from each line of a file. The pr command formats a text file for printing. The nl command places a line number in front of each line in a text file and sends the result to standard output.

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 The cp /media/usb/letter.doc /root command copies the letter.doc file from the USB disk drive (/media/usb) to the root user's home directory (/root). The cp /media/usb/letter.doc home: command creates a file named home: in the working directory. The cp /dev/usb/letter.doc /root command will most likely return an error because that path does not represent the mount point for the USB drive. The cp /mnt/usb:letter.doc /root command will most likely return an error because the usb:letter.doc file does not exist.

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

file

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

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

lsattr /boot/grub/grub.conf

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

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: [ljenkins@fileserver]$ ls -al total 4drwxr-xr-x. 2 ljenkins ljenkins 24 Feb 25 12:04 .drwx 15 ljenkins ljenkins 4096 Feb 25 11:04 ..-rw-rw-r--. 1 ljenkins ljenkins 346 Feb 25 11:32 report.txt When prompted to remove the write-protected file, ljenkins entered yes and received an "Operation not permitted" error message. As the help desk technician, you attempt to remove the file with root privileges and receive the same error message. You decide to view the file attributes and receive the following output: [helpdesk@fileserver]$ lsattr ----I----------- ./report.txt 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 of the following commands changes the /home/gshants/smile file's modification and last accessed times to the current time?

touch /home/gshants/smile


Conjuntos de estudio relacionados

GENETICS EXAM 1-4 (COMBINED) UH LIN/DAANE

View Set

Lesson 14: Andrew Jackson and the Growth of American Democracy

View Set

SWE - chapter 2 :Software processes

View Set

Chapter 54: Management of Patients With Kidney Disorders

View Set

Who, what, when, where, why, how

View Set

accounting chapter 11: pre test/objective test

View Set

26.3- Spermatogenesis occurs in the testes and produces mature sperm

View Set

Systems Analysis and Design | Chapter 1

View Set