2.13.3 TestOut Linux Pro, 2.12.9 testout linux pro, 2.11.3 testout linux pro, linux testout pro 2.10.6, 2.9.11 Files, 2.8.9 Practice Questions, Adv system arch unit 2
Which of the following commands merges two files based on identical fields of text?
"join"
Which of the following commands displays each line in a text file in alphabetic order?
"sort"
Which text stream processing command filters identical adjacent lines from a single file?
"uniq"
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.
-a displays all directory contents, including hidden content. -l displays extended information, including the owner, modified date, size, and permissions. -R displays the contents of a directory and all of its subdirectories. -d displays directories but not files. -r reverses the sort order.
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
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?
/
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 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
Which of the following is a characteristic of a symbolic link?
Distinct (non-duplicate) inode.
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 describes the effects of the split -50 -d -a 3 AllNames FiftyNames- command if there are 103 lines and 240 bytes in the file?
The AllNames file is split into three files containing 50 lines or less. The output is FiftyNames-001, FiftyNames-002, and FiftyNames-003.
Which of the following statements BEST describe the purpose of the Filesystem Hierarchy Standard (FHS)? (Select two.)
The FHS allows software installation routines to predict where to place configuration files. The FHS allows users to predict where to find system 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.
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.
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.
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.
Which of the following commands stores the output of the ls -a command in a shell variable named allfiles?
allfiles=$(ls -a)
Which awk/sort command combination displays a sorted list of usernames in the /etc/passwd file?
awk -F: '{ print $1 }' /etc/passwd | sort
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.
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 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 Correct Answer: 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 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.
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 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
A directory intended to be used only by administrators keeps filling with files. Which of the following commands could you use to see only the names of the users saving files in the directory?
ls -l | cut -d " " -f5
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)
You want to display the contents of ~/franksdep in hexadecimal format. You change to your home directory. How should you enter the command at the command prompt?
od -x franksdep
Which of the following commands merges two files on a line-by-line basis and separates each line with a tab?
paste
You need to change the formatting of the /home/varstown file as it prints. Specifically, you need to add double-spacing to each line in the file. How should you enter the command at the command prompt?
pr -d /home/varstown
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: [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 a
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
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
At the command prompt, how would you enter a command that prints the line count, word count, and byte count respectively in the /home/gshant/servepath file?
wc -lwc /home/gshant/servepath
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