Chapter 1 Using Linux

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

"Which of the following statements best describe the purpose of the Filesystem Hierarchy Standard (FHS)? (select two) 1) during installation, software can determine the permissions of specific directories. 2) During installation, software can predict where to place configuration files. 3) Individual users can predict where to find system configuration files. 4) As users create files, they are forced to place the files in specific directories."

"During installation, software can predict where to place configuration files. Individual users can predict where to find system configuration files."

"Which of the following files will be displayed when using the egrep exhibit[0-9]+ ~/samps command? (select two) 1) exhibit1 2) exhibita45 3) exhibit1a12 4) exhibit125"

"exhibit1 exhibit125"

"You are looking for a specific five-character string in the ~/customquote file with the grep command. The string should begin with the letter g, end with a y, and be the last string on the line. Which regular expression should you use with grep? 1) ""&g...y"" 2) ""g..y.$"" 3) ""g..$.y"" 4) ""g...y$"""

"g...y$"

A user is requesting that each time she logs in, a particular entry be written to a log file. This will only apply to her and she is using the Bash shell. In which configuration file would you make an entry for this action to take place?

.profile

Which of the following represent the root directory?

/

What command would you enter while in vi command mode to find the term Sam?

/Sam

Under the Filesystem Hierarchy Standard (FHS), which directory contains the device files for a Linux system?

/dev

ll users at your site are using the Bash shell. You want to set a variable that will apply to every user and always have the same value. Which file would you place this variable in?

/etc/profile

You need to configure 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 an executable file named ni that allows you to save a snapshot of your network information with the date and time into a log file. The file is in the /root directory, and /root is the current working directory. How would you run the executable file? (Select two.) ./ni source ni ni /root/ni"

/ni /root/ni

Under the Filesystem Hierarchy Standard (FHS), which directory contains information about the system state and processes?

/proc

Which directory is the home directory for the root user account?

/root

Which directory holds the man files on the system? (enter the full path of the directory)

/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

A friend sent you a shell script file that is 117 lines long. He says that he wants you to examine code on lines 82 through 87. What command in command line mode takes you directly to line 82? (enter the command as if in the command mode)

82

You have opened the /root/myscript file in vi. While looking at the file, your soda spilled, and you hit several keys on the keyboard trying to pick it back up. There are extra characters everywhere in the file, and you know you can't fix it. How do you exit vi without saving the changes?

:q!

Which key combination should you press in vi to save the file you are working on and quit?

:wq

"Which of the following would be the result of the command ln -b ~/file1 /data/file1? 1) A copy of the file ~/file1 would be placed in /data; 2) The ln command would test to see if the source file was a binary file or text file before creating the link; 3)A link called /data/file1 would be created and would always be treated by the operating system as a binary file despite the type of file it points to; 4) The -b option would only work if the file being linked to is a binary file not a text file. "

A copy of the file ~/file1 would be placed in /data

Which of the following would be the result of the command ln -b ~/file1 /data/file1?

A copy of the file ~/file1 would be replaced in /data.

"The user mbrown has a directory named logs in her home directory that is regularly updated with new log files when certain systems 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 be created to run these two commands. What command would you enter into her shell configuration file to create this persistent Alias?"

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

Which of the following commands will create a shortcut to the tail -f /var/log/messages command?

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

What is the result of the uname -a command?

All system information is displayed on the screen

"Which of the following options is the standard shell for most Linux computers? Bourne shell Bourne-again shell (bash) Korn Tcsh C-shell"

Bourne-again shell (bash)

Following is a lost of the four sections typically found in a man page. Which of these shows a list of options available for a Linux command and explain what the options do?

DESCRIPTION

"Which of the following is not a characteristic of hard links? 1) Dash (-) as the first character in the permission string. 2) Distinct inode 3) Valid inode for the file data even if the original file is deleted. 4) Indistinguishable from the original files."

Distinct inode

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

Edit mode: The mode that vim uses to write and edit text in the file. Command mode: The initial vim mode used when vim is started. It has commands that cut and replace text, and it is the mode vi

You need to set the COMP variable to the value 1745. Which command will set the variable so it is available to other shell programs?

Export COMP=1745

Which of the following commands will configure the shell to retain 300 recently used commands in the ~/.bash_history file for multiple shell sessions?

HISTFILESIZE=300

Which environment variable affects the number of past commands used in the current shell session?

HISTSIZE

What are the permission string for a Hard Link?

Hard Link: -rwxr-xr-x

If you are viewing the contents of a man page, which key can you press to get back to the beginning of the page?

Home

Describes the PATH environment variable?

It contains the directory prefixes used to search for programs and files.

While in vi command mode, what does "j" do?

Move the cursor down a line

While in vi command mode, what does "h" do?

Move the cursor one space to the left

While in vi command mode, what does "l" do?

Move the cursor one space to the right

You are editing a text file with vi and need to open a new line above the one you are currently working on. What key should you press to accomplish this?

O

What line must you add to /etc/profile to make sure /sbin/custom is always part of the PATH environment variable for all users, without overwriting the current entries in the PATH statement?

PATH=$PATH:/sbin/custom; export PATH

You want the directory /sbin/special to always be a part of the PATH. You also want to keep all the current entries in your PATH statement. Which of the following commands would you use?

PATH=$PATH:/sbin/special

After opening a file in vi, you want to switch from command mode to command line mode. What key should you enter? You made a few changes to the /grub/grub/grub.conf file and now you need to exit out of insert mode, save the changes, and quit. What should you do? (Select two)

Press Esc and Type :wq

What are the permission string for a Symbolic Link?

Symbolic Link: lrwxrwxrwx

Which of the following presents the greatest security risk?

The PATH statement includes . (period)

You previously created symbolic links in your home directory to a set of files in the /data directory using the ln -s command. The system admin has just deleted those files. What happens to the links that you created?

The symbolic links would still exist in your home directory but they would now be broken.

What are two methods to exit vi from command mode? (select two)

Type ZZ and Type :wq

"Which of the statements describe file globbing? 1) Indexing files for the locate command. 2) Displaying which commands use specific files. 3) Using wildcards to match specific files. 4) Determining the category of the file or command."

Using wildcards to match specific files.

"Which of the following is not a characteristic of symbolic links? 1) Distinct inode 2) Valid inode for the file data even if the original file is deleted; Work across volumes and the files systems 3) Lower-case L (l) as the first character in the permission string"

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

Which command will display a list of the currently defined aliases on the system?

alias

Which of the following commands could you use to search man pages for a specific keyword?

apropos, whatis, man -k

What would you enter at the command prompt to start a new Bourne-again shell (bash) session?

bash

"Which of the following commands combines three files into a single text stream? 1) pr 2) cut 3) cat 4) nl"

cat

Which of the following commands sorts the contents of wordlist1 and wordlist2 and sends the result to standard output?

cat /usr/wordlist1 /usr/wordlist2 | sort

Which of the following commands displays the contents of wordlist1 and wordlist2 then sorts the combined contents, then sends the results to the monitor and a file named sortedwordlist?

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

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

cat turbo

Which of the following commands redirects standard output to standard error?

cat txtfile 1>&2

Which of the following command copies 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 and cp -r /temp /home/gshant

"You are logged in as root. You have the file, letter.doc, on a CD in the first compact disk drive. Which command will copy the file from the CD to your home directory? 1) cp /mnt/scd0/letter.doc /root 2) cp /mnt/scd1/letter.doc /root 3) cp /mnt scd0/letter.doc home: 4) cp /mnt/cd1:letter.doc /root"

cp /mnt/scd0/letter.doc /root

Which of the following commands will cut an entire line from a file while in vi command mode?

dd

You want to view the number of commands your HISTSIZE environment variable is set to save. You don't want to have to scroll through all the environment variables. Which command shows you the value for the HISTSIZE variable?

echo $HISTSIZE

Which command shows the value of the LANG environmental variable currently set for the language the operating system uses?

echo $LANG

What command can be used on most Linux distributions to find the directories where the man pages are kept?

echo $MANPATH

Two users should have identical settings, yet one is having problems with the display on his screen and you suspect there is a difference in their environment variables. Which command will display all the environment variables? 1) print 2) echo 3) display 4) env

env

Which command will display only the environment variables applied to child sessions?

env

You have the myapp executable file. It is found in the current directory, but not in the command path. What would you enter at the command prompt to start the myapp file and replace the shell with myapp process?

exec ./myapp

You recently used the HOST=FS4 command. What command should you use to make the environment variable to apply to all child sessions?

export HOST

"Which of the following commands is the fastest method to search a file for fixed strings, rather than regular expressions? 1) egrep f 2) grep -w 3) grep -f 4) fgrep"

fgrep

Which command will display a files type?

file

You need to find all files in the /home/gshant directory that are larger than 300k. You change directories to /home/gshant. What command should you use? (enter the command as if at the command prompt)

find -size +300k

"Which of the following commands would you use to find all of the files on the system that have either blue or gold in their names? 1) find . -name 'b' -o 'gold' 2) find / -print0 'blue' -o 'gold' 3) find .. -name 'blue' -o 'gold' 4) find .. -print0 'blue' -o 'gold'"

find / -name 'blue'gold'

"Which of the following commands finds files with the .txt extension in the /home/gshant directory 1) find /home/gshant -name 'txt' 2) find /home/gshant -name '*.txt' 3) find /home/gshant -type d -name 'text' 4) find /home/gshant -type f -name 'text'"

find /home/gshant -name '*.txt'

"You want to perform an audit and make sure that group membership for user dblair is correct. Which command would you use to view the groups that dblair is a member of? 1) grep -e dblair /etc/passwd 2) grep -e dblair /etc/group 3) members dblair 4) group dblair"

grep -e dblair /etc/group

"You need to quickly see all of the lines in the blue_and_gold text file that do not reference Karen. Which command would you use to accomplish this? 1) grep -n Karen blue_and_gold 2) grep -v Karen blue_and_gold 3) grep -n blue_and_gold Karen 4) grep -v blue_and_gold Karen"

grep -v Karen blue_and_gold

Which command would you use in a script to parse out entries that contain the word those from a file named config in a folder named diet beneath the /etc directory?

grep those /etc/diet/config

What command should you enter to see a list of all the commands you recently used at the command prompt?

history

"Which of the following files would not be found by the locate -i LibraryFines.csv command? 1) 1 libraryFines.csv 2) LibraryFines.csv 3) Libraryfines.csv 4) libraryfines.csv 5) libraryfines.csv1"

libraryfines.csv1

You need to make an expanded listing of all the files in /etc. Which command will produce the listing?

ls -al /etc

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 -al /home/jerrys

"You want 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? 1) ls -l >> less 2) ls -p 3) ls -paged 4) ls -l | less"

ls -l | less

What will be the effect of the following command? ls -l /usr/bin >> /tmp/list.txt The contents of the /usr/bin directory will be redirected into a file called /tmp/list.txt, inserted after previous contents of the file. You are trying to debug a shell script that has the command ls -s in it. You suspect an error is occuring here and want to send the results of the operation (success or error) to a file named Friday in order to examine it later. Which of the following commands should you use?

ls -s> Friday 2>&1

"Which command prints the attributes of a /boot/grub/grub.conf file? 1) vi /boot/grub/grub.conf 2) lsattr /boot/grub/grub.conf 3) cat /boot/grub/grub.conf 4) ls /boot/grub/grub.conf"

lsattr /boot/grub/grub.conf

You need to create the directory /var/oracle/database/9i. Only the directory /var currently exists. From the root of the filesystem, which command will create the directory path?

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

While in vi command mode, what does "k" do?

move the cursor up a line

"Which command would you use to move a file from one location to another? 1) mv 2) copy -r 3) cp -d 4) move"

mv

"Which command would you use to rename the /home/pmallory/reports file to reports.bak? 1) diff -n /home/pmallory/reports /home/pmallory/reports.bak 2) touch -n /home/pmallory/reports /home/pmallory/reports.bak 3) ren /home/pmallory/reports /home/pmallory/reports.bak 4) mv /home/pmallory/reports /home/pmallory/reports.bak"

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

"After using the ls command in the current working directory, you notice the following files; lrwxrwxrwx 1 root root 4 2010-11-05 myfile -> shantsgems -rwxr-xr-x 1 root root 382 2010-10-05 shantsgems What is true about about the files? 1) myfile is a piped link to shantsgems. 2) myfile is a hard link to shantsgems. 3) myfile is a symbolic link to shantsgems. 4) myfile is a backup file to shantsgems."

myfile is a symbolic link to shantsgems.

While in command mode, you copied a whole line of text to memory. You navigated to a different location in the file, and now you need to place the line of text. What command should you press?

p

What would you enter at the command prompt to display the present working directory?

pwd

The /home/gshant/smp directory contains several files. The directory and files need to be removed. You change directories to /home/gshant. What would you enter at the command prompt to remove the smp directory and the files it contains?

rm -r smp

In the /var directory is a subdirectory called backup. You need to delete the directory backup and any files. You change directory focus to /var. Which command will delete the directory backup and its files?

rm -rf backup

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

rmdir smp

Which command will display all the environment variables on the system?

set

Which command reads from standard input and writes to standard output and files?

tee

"Which of the following commands will change the /home/gshants/smile file's modification and last accessed times to the current time? 1) rm /home/gshants/smile 2) cat /home/gshants/smile 3) ls /home/gshants/smile 4) touch /home/gshants/smile"

touch /home/gshants/smile

You are working on a Linux system and need more information about the uname command. What would you enter at the command prompt to learn about the uname command syntax and options?

uname --help

After using the locate command, you discover some of your files are not being listed in the search results. Which command should you use to update the /var/log/locatedb file? (enter the command as if at the command prompt)

updatedb

You need to create a new text file with the name network.txt in the current directory. Which command starts vi and creates the file?

vi network.txt

"Which single command should you use to find the path and manual pages for the mycustomapp program? 1) whereis -b mycustomapp 2) whereis -m mycustomapp 3) whereis -s mycustomapp 4) whereis mycustomspp"

whereis mycustomapp

You use a program on your Linux system named 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

What command would enter while in vi command mode to copy an entire line of text?

yy

Which symbol uses the output of one command as the input of another command?

|

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

||

Your default target on your Linux system is set to multi-user mode; however, you want the X Windows System to launch when you log into the system. Which file should you edit?

~/.bash_login

After a user starts a BASH session and the scripts in /etc/profile are applied, what is the next file that could affect the shell session?

~/.bash_profile

Which of the following files would you use to create aliases that are applied when a specific user starts a BASH session? (select two)

~/.profile and ~/.bashrc


Set pelajaran terkait

D.ADM - 1 Noções de organização administrativa

View Set

Comparative Politics Early Quiz (UK Case Study)

View Set

Sea-floor Spreading Science Bookworm

View Set

PSC 101 Unit 3, Part 4 (Interest Groups)

View Set

Biology Mitosis and Meiosis Review

View Set

ACCESS Chapter 1: End of Chapter Quiz, Access Chapter 1, Access Chapter 2, BCIS Review 9

View Set