Unit 01- Using Linux

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

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 an y, and be the last string on the line. Which regular expression should you use with grep?

"g...y$"

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 would you enter while in vi command mode to go directly to line 82? (typed)

#82

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 /root/ni

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 path represents the root directory?

/

What command would you enter while in vi command mode to find the term Sami (typed)

/Sam

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

/dev

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? (typed)

/ect/updatedb.conf

All 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

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

What is the full path to the directory that holds the man files on the system? (typed)

/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? (typed)

/var

Match the vim mode on the left to the correct definition on the right. 1) The initial vim mode used when vim is started. It has commands that cut and replace text, and it is the mode vi uses to enter the other modes 2) The mode that works with the file system. Use it to save files after editing them. 3) The mode that vim uses to write and edit text in the file.

1) Command mode 2) Command line mode 3) Edit mode

Drag the permission string on the left to the category on the right. (Tip: Some permission strings will not be used.) 1) Soft link 2) Hard link

1) Irwxrwxrwx 2) -rwxr-xr-x

Match the command on the left with the description on the right to navigate while in vi command mode. 1) Move the cursor up a line. 2) Move the cursor one space to the left, 3) Move the cursor one space to the right. 4) Move the cursor down a line.

1) k 2) h 3) l (lower L) 4) j

After opening a file in vi, you want to switch from command mode to command line mode. What key should you enter? (typed)

:

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 In -b /v/filel /data/filel?

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

You must do which of the following to define a persistent alias?

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

The user mbrown 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 • Is -al She wants a persistent alias named logcheckto be created to run these two commands. What command would you enter into her shell configuration file to create this persistent alias? (typed)

Alias logcheck="cd /home/mbrown/logs;ls -al" (NO SPACE between ";")

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?

Bourneagain shell (bash)

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

Cat turbo

Following is a list of the first 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?

Distinct inode

Which two statements best describe the purpose of the Filesystem Hierarchy Standard (FHS)?

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

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? (typed)

HISTSIZE

You want to view the contents of a directory, but the output of the Is -I 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?

Is -I | less

You are trying to debug a shell script that has the command Is -s in it. You suspect an error is occurring here and want to send the results of the operation (successful or error) to a file named Friday in order to examine it later. Which of the following commands should you use?

Is -s> Friday 2>&1

Which command prints the attributes of a /boot/grub/grub.conf file?

Isattr /boot/grub/grub.conf

Which of the following statements best describes the PATH environment variable?

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

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? (typed)

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

You made a few changes to the /boot/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. Each answer is a required part of the solution.)

Press Esc Type :wq

Which of the following presents the greatest security risk?

The PATH statement includes . (period).

What will be the effect of the following command? Is -I /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 previously created symbolic links in your home directory to a set of files in the /data directory using the In -s command. The system administrator 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. Each answer is an independent solution.)

Type :wq Type ZZ

Which statement describes file globbing?

Using wildcards to match specific files.

Which of the following is not a characteristic of symbolic links?

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? (typed)

alias

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

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

Which of the following commands could you use to search man pages for a specific keyword? (Select three.)

apropos whatis man -k

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

bash

Which of the following commands combines three files into a single text stream?

cat

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

cat txtfile 1>&2

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

cat/usr/wordlistl /usr/wordlist2 | sort

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

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

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. Each answer represents an independent solution.)

cp -r /temp /home/gshant 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.

cp /mnt/scdO/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? (typed)

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?

env

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

env

You have the rnyapp 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 rnyapp file and replace the shell with myapp process? (typed)

exec ./myapp

Which of the following files will be displayed when using the egrep exhibit[0-9]+ ~/samps command? (Select two.)

exhibit125 exhibit1

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

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?

fgrep

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

file

You need to find all files in the /home/gshant directory that are larger than 300K. You change directories to /home/gshant. What would you enter at the command prompt to find these files? (typed)

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?

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

Which of the following commands finds files with the .txt extension in the /home/gshant directory?

find /home/gshant -name

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?

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?

grep -v Karen blue_and_gold -v = not matching

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

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

home

Which of the following files would not be found by the locate -i LibraryFines.csv command?

libraryfines.csv1 -i = disables case sensitivity.

What commonly predefined alias is configured to run the Is -I command? (typed)

ll

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? (typed)

ls -a /home/jerrys

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

ls -al /etc

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? (typed)

man uname

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

Which command would you use to move a file from one location to another?

mv

Which command would you use to rename the /home/pmallory/reports file to reports.bak?

mv /home/pmallory/reports /home/pmallory/i'eports.bak

After using the Is command in the current working directory, you notice the following files: Irwxrwxrwx 1 root root 4 2010-11-05 myfile -> shantsgems -rwxr-xr-x 1 root root 382 2010-10-05 shantsgems What is true about the files?

myfile is a symbolic link to shantsgems.

You are trying to debug a shell script called myscript and to aid you in this task you would like to have the output of the script be recorded in a text file. Which of the following commands would satisfy your requirements?

myscript >>testfile.txt

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 use?

p

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

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? (typed)

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? (typed)

rmdir smp

Which command will display all the environment variables on the system? (typed)

set I think it is = env?

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

tee

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

touch /home/gshants/smile

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

updatedb

You need to create a new text file with the name network, txtin 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?

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? (typed)

which photorec

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

xargs

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

yy

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

|

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

~/.bashrc ~/.profile


Set pelajaran terkait

MONEY LAUNDERING _ BSA & AML: ESSENTIALS, BSA/AML Complying with BSA, GLOSSARY BSA_AML_Money Laundering RED FLAGS, BSA/AML Complying with BSA

View Set

Chapter 26: Male Genitalia and rectum PrepU

View Set

Principles of Fluid and Electrolytes

View Set

Chapter 14: Feeding and Eating Disorders

View Set

Chapter 14: The Civil War, 1861-1865

View Set