IT-135 Linux Chapter 2

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Q. 3 A friend sent you a shell script file that is 117 lines long. He says that he wants to examine code on lines 82 and 87. What command would enter while vi Command Mode to go directly to line 82?

#82

Which of the following paths represents the root directory?

/

/proc

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

Which of the following actions can be used to define a persistent alias?

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

~/.bash_profile

After a user starts a bash session and the script in / etc/profile is applied, if all of the following files exist, which will be run next? ~ /.bash_login ~/.bash_logout ~/.bash_profile ~/.profile

updatedb

After using the locat 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?

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

Alias

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:

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

Q .3 Which of the following man page sections shows a list of options available for a Linux command and explains what the options do? 1.DESCRIPTION 2.TITLE 3.SYNOPSIS 4.NAME

DESCRIPTION

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

Distinct (non-duplicate) inode.

Q. 4 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

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

II

Which of the following statemnets BEST describes the PATH environment variable?

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

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

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

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

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

Ted, a Linux user, creates symbolic links in his home directory to 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 Ted created?

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

/dev

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

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

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

nl adds the number, a colon, and a space to the front of each line in the file.

Which of the following statements BEST describes the nl -s ":" myfile command?

which photorec

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 of the following commands creates a shortcut that can be used to run the fail -f /var/log/messages?

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

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

bash

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

cat

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

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

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

cat /usr/wordlist1 /usr/wordlist2 | sort

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

cat turbo

Two users should have identical settings, yet one is having problems with the display oh his screen , and you suspect there is a difference in their environment variables?

env

Q.5 As a Linux user, you have access to an executable file named myapp. It's 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 need to set the COMP variable to the value 1745. Which of the following commands sets the variable so it is inherited by subsequent child shells?

export COMP=1745

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

file

Which of the following commands will display the attributes of a /boot/gub/grub.conf file?

lasttr /boot/grub/grub.conf

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

man uname

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

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

Which command displays all environment variables defined in the shell?

printenv

Q. 7 What would you enter at the command prompt to display the current working directory?

pwd

Which of the following commands will display each line in a text file in alphabetic order?

sort

A user, ljenkins, contacts the help desk about and 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:

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 will change the /home/gshants/smilefile's modification and last accessed times to the current time?

touch /home/gshants/smile

At the command prompt, how would you enter a command that will print the line count, word count, and byte count respectively in the /home/gshant/serverpath file?

wc -lwc /home/gshant/servepath

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

xargs

Which command operator pies the output of one command as the input of another command?

|

A user has requested that each time she presents credentials to log in, a particular entry be written to a log file. This action will only apply to her, and she is using the bash shell. Which of the following configuration files is the BEST to modify to enable this action? .bashrc .sh /etc/profile .profile

.profile

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

/Sam

The /etc/shells file contains a list of shells that are available on the current systems. Type cat /etc/shells at the prompt to answer the following question: Which of the shells listed below is not available on the system?

/bin/ksh

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 of the following shell configuration files should you place this variable in? .bash_profile .bashrc .bash_login /etc/profile

/etc/profile

Q.3 A Linux user has an executable file named ni that can save a snapshot of network information with the date and time in a log file. The executable ni file is in the /root directory, and /root is the current working directory. Which of the following commands would run the executable file? (Select TWO).

/root/ni ./ni

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

/var

Q. 5 Using the vi editor in Insert Mode, you made a few changes to the /boot/grub/grub.conf

1. Press the Esc key 2. TypeP ":wq"

Q. 4 After opening a file in vi, you want to switch from Command Mode to Command Line Mode. What key invokes Command Line Mode?

:

Q.2 As an 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!

Q.1 Which of the following vi key combinations should you press while in Insert Mode to save the file you are working on and quit?

<Esc>:wq

Q. 6 Which of the following is displayed when the uname -a command is run? 1. The current working directory 2. The names of files and directories in the current directory 3. All system information 4. The current username

All system information

Which of the following is the standard shell for MOST Linux computers? 1. tcsh 2. C-shell 3. Bourne-again shell (bash) 4. Bourne shell 5. Korn

Bourne-again shell(bash)

Q .6 The vi mode that works with the file system. Use it to save files after editing them.

Command Line Mode

Q .6 Match the vi mode on the left to the correct definition of the right.

Command Mode

Q. 6 The vi mode that vim to write and edit text in the file.

Edit Mode

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

HISTFILESIZE=300

Which environment variable specifies the number of past commands stored in memory in the current shell sessions?

HISTSIZE

View the contents of the /root/.bash_profile. Type cat /root/.bash_profile at the prompt to answer the question. What is the last word in the file?

PATH

You want the directory /sbin/special to be include in the PATH environment variable. You also want to keep all current directory entries currently in the PATH variable.

PATH=$PATH:/sbin/special

The ls command in the current working directory gives the following listing: lrwxrwxrwx 1 root root 4 2010-11-05 mydata -> shantsgems -rwxr -xr -x 1 root root 382 2010-0-05 shantsgems

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

Leroy tries to copy some files to an ext3 volune and received 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 the permission to copy the files. Which of the following BEST describes Leroy's problem?

The number of inodes has been exhausted.

usr/share/man

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

find

Whcih of the following commands is used to find a specific file on a Linux system?

awk -F: '{ print $1 }' /etc/passwd | sort

Which awl/sort command combination displays a sorted list of username in the /etc/password file?

cut -f2 ~smarts

Which of the following commands displays information found in the second column of the tab delimited ~/smarts file?

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

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

locate

Which of the following commands is used to find a specific file on a Linux system?

tr

Which of the following commands transposes characters in a text steam?

/root

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

~/.bashrc ~/.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. Each answer is an independent solution.) /etc/profile /etc/bashrc ~/.bashrc ~/.profile ~/.bash_logut

Using wildcards to match specific files.

Which of the following statement describes file globbing?

The AllNamesfiles is split into three fields containing 50 lines or less. The output is FiftyNames-001,FiftyNames-003

Which of the following statements BEST describes the effects of the split -50 -d -a 3 AllNamesFiftyNames- command if there are 103 lines and 240 byes in the file?

The FHS allows software installation routines to predict where to place configuration files.

Which of the following statements Best describes the purpose of the Filesystem Hierarchy Standard (FHS)?

The FHS allows users to predict where to find system configuration files.

Which of the following statements Best describes the purpose of the Filesystem Hierarchy Standard (FHS)?

locate

Which of the following utilities would you use to search a path for files that match a given name?

s

Which sed flag or option allows you to exchange one string of characters for another string of characters in a file?

Which of the following command copies the entire /temp directory ith all of its files, sub- directories, and files in the sub-directories to the /home/gshant directory . (Select TWO. Each answer represents and independent solution.)

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

A Linux administrator is logged in as root and needs to copy a file name letter.doc from the USB flash drive mounted under /media/usb.

cp /media/usb/letter.doc /root

Tom, 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 that with a filename that includes the current local weekday name?

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

You want to view the number of commands your bash shell is set to save by examining the current HIST SIZE environment variables.

echo $HISTSIZE

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

echo $LANG

You recently used the HOST=FS4 command. Which of the following commands should you use to change the HOST variable to a global variable that will be inherited by subsequent child sells and processes?

export HOST

You need to find all files in the /home/gshant directory that are larger than 300k. You can change your directory to /home/gshant.

find -size +300k

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

find /home/gshant -name '*txt'

Q.4 Which of the following commands should a Linux user enter to see a list of all the commands the user recently ran at the command prompt? 1. clear 2. history 3. chsh 4. uname

history

You need to view the contents of the /home/jerrys directory. What would you enter at the command prompt to show all the contents, 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

A user attempts 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 the users to see the full listing of the directory?

ls -l | less

Ann, a Linux script developer, is trying to debug a shell script that has the command ls -s in it. She suspects that an error is occurring, and she wants to send the results of the operation and any errors to a file name ~/Friday in order to examine it later.

ls-s &> ~/Friday

Which of the following commands searches man pages for a specific keyword (Select Three.) 1. whatis 2. man -k 3. apropos 4. find 5. help 6. slocate 7. export

man -k apropos whatis

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

mv

Which of the following commands will change the /home/pmallory/reportsfile's name to reports.bak?

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

Joe, a bash script developer, is trying to debug a shell script named my script. Which of the following commands would record the output of the script in a text file?

myscript >> testfile.txt

Q .8 While in the 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 pastes the copied text?

p

Which of the following commands merges two files on a line-by-line bases and separate each line with a tab?

paste

Within the /var directory is a sub-directory named backup. Ken, a Linux administrator, needs to delete the directory and any files that it contains. He changes directory focus to /var. Which of the following commands deletes 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


Ensembles d'études connexes

ATI RN Learning System 3.0: Maternal Newborn 1

View Set

Mastering Quiz: Chapter 8 Recombinant DNA Technology

View Set

SMO 311- Management of Human Resources - Midterm #1

View Set

Kings of ISRAEL and JUDAH and their characteristics

View Set

Chapter 38: Caring for Clients With Cerebrovascular Disorders

View Set