Linux Module 1-3

Ace your homework & exams now with Quizwiz!

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 .sh .bashrc /etc/profile

.profile

While in command mode, you need to find the term Sam. Which command should you use?

/Sam

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 .bash_login .bashrc .bash_profile

/etc/profile

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

/root/ni ./ni

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?

82

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

:

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! :wq :x :q

:q!

Which key combination should you press in vi to save the file you are working and quit? :wq s S :q

:wq

What is the result of the uname -a command? Shows names of files and directories in the current directory. All system information is displayed on the screen. Displays the current working directory. Displays the current username.

All system information is displayed on the screen.

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

Bourne-again shell (bash)

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

Command line mode

You are providing telephone support for a user who is swapping out an old CRT SVGA monitor with a new LCD SVGA monitor. He's not sure which connector on the back of the PC is used for the monitor. How would you like to describe the connector that he should look for? D-shaped with 36 pins D-shaped with 15 pins Round with 6 pins Round with 9 pins

D-shaped with 15 pins

You are helping a customer over the phone who needs to connect a monitor that uses a digital interface. Which port should you instruct her to look for on the back of her PC? DVI Firewire 6-pin Serial DB-15 SVGA DB-15 3-row

DVI

Which Windows component can be used to display information such as weather forecasts, time, and news headlines on the desktop? Gadgets Notification Area User Account Control (UAC) Computer Management

Gadgets

Which of the following commands will configure the shell to retain 300 recently-used commands in the ~/.bash_history file for multiple shell sessions? HISTFILE=300 BASH=300 HISTSIZE=300 HISTFILESIZE=300

HISTFILESIZE=300

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

HISTSIZE

Which of the following statements best describes the PATH environment variable? It specifies the characters the shell uses to indicate normal user ($), root user (#) and similar items. It specifies the filename where past commands are stored. It contains the path of the current working directory. It contains the directory prefixes used to search for programs and files.

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

What line must you add to /etc/profile to make sure /sbin/custom is always part of the PATH, but also keep all 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 PATH=PATH&/sbin/special PATH=$PATH:$/sbin/special PATH=/sbin/special

PATH=$PATH:/sbin/special

A D-shaped, 25 pin female port on the back of a computer is a: Game port Parallel port Monitor port Serial port

Parallel port

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) Type :w! Type :q! Press Esc Type :wq

Press Esc Type :wq

You are looking at a female TRS connector on the computer. What device uses this connector? Joystick Speaker External modem Thumb drive

Speaker

Which of the following presents the greatest security risk? There are several disabled user accounts. The second field for every user in the /etc/passwd file is x. The system has a large file named core. The PATH statement includes .(period)

The PATH statement includes .(period)

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. The contents of the /usr/bin directory will be appended to the file called /tmp/list.txt and then the contents of /tmp/list.txt will be output to the screen. The contents of the /usr/bin directory will be redirected into a file called /tmp/file.txt, overwriting the previous contents of the file. The contents of the /usr/bin directory will be redirected into a file called /tmp/list.txt, inserted before the previous contents of the file.

The contents of the /usr/bin directory will be redirected into a file called /tmp/list.txt, inserted after previous contents of the file.

What are two methods to exit vi from command mode? (select two) Type yy Type :e! Type ZZ Type :wq

Type ZZ Type :wq

You are used to using a computer running Windows XP Professional. You want to upgrade to the latest operating system, but want to use the classic style for the Start Menu. You want to upgrade to the latest version possible. What should you do? -Upgrade to Windows Vista; choose the Windows Classic theme. -Upgrade to Windows 7; customize the Start menu settings. -Upgrade to Windows Vista; customize the Start Menu settings. -Upgrade to Windows 7; choose the Windows Classic theme.

Upgrade to Windows Vista; customize the Start Menu settings.

Which component of Windows 7 prompts the user for credentials or permission to minimize the dangers of unintended software installations? User Account Control (UAC) Firewall with Advanced Security Firewall Defender

User Account Control (UAC)

You are looking at a high-density (three-row) female DB-15 connector on the computer as shown in the figure. What device uses this connector? USB storage devices External modems that use a serial port IEEE 1284 printers VGA/SVGA monitors

VGA/SVGA monitors

Which Windows version(s) include the following features: Flip 3D, Gadgets, Snap, and Peek? -Windows XP, Windows Vista, and Windows 7 -Windows Vista -Windows 7 -Windows Vista and Windows 7

Windows 7

The Sidebar is a feature of which Windows version(s)? -Windows Vista -Windows Vista and Windows 7 -Windows XP, Windows Vista, and Windows 7 -Windows XP

Windows Vista

Which of the following commands will create a shortcut to the tail -f /var/log/messages command? alias sysmesg="tail -f /var/log/messages" export alias sysmesg="tail -f /var/log/messages" export alias= "tail -f /var/log/messages" env alias="tail -f /var/log/messages"

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

You are working at the command line and need to start a new Bourne-again shell (bash) session. What should you type?

bash

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 cat /usr/wordlist1 >> /usr/wordlist2 | tee cat /usr/wordlist1 | /usr/wordlist2 | sort cat /usr/wordlist1 /usr/wordlist2 | sort

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 names sortedwordlist? cat /usr/wordlist1 /usr/wordlist2 | sort sortedwordlist cat /usr/wordlist1 /usr/wordlist2 | tee sortedwordlist cat /usr/wordlist1 >> /usr/wordlist2 | sort sortedwordlist cat /usr/wordlist1 /usr/wordlist2 | sort | tee sortedwordlist

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

Which of the following commands will give the same results as cat < turbo? cat t> turbo cat turbo cat 2> turbo cat 1&2> turbo

cat turbo

Which of the following commands redirects standard output to standard error? cat txtfile 1>&2 cat txtfile | 2 cat txtfile 2>&1 cat txtfile | tee 2

cat txt 1>&2

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.

command mode

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

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? cat $HISTSIZE cat /etc/profile | grep "HISTSIZE" echo $HISTSIZE HISTSIZE =

echo $HISTSIZE

Which command shows the value of the environmental variable currently set for the terminal? echo %TERM echo TERM echo $TERM echo %TERM%

echo $TERM

The mode that vim uses to write and edit text in the file.

edit mode

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? display echo print 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 should you type 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 command will set the variable so it is available to other shell programs? COMP=1745 set COMP to 1745 export COMP=1745 set COMP=1745

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? unset HOST env HOST set HOST export HOST

export HOST

Command to move the cursor one space to the left.

h

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

history

Command to move the cursor down a line.

j

Command to move the cursor up a line.

k

Command to move the cursor one space to the right.

l

You are trying to debug a shell script that has the command ls -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? ls -s >> Friday ls -s Friday ls -s > Friday ls -s> Friday 2>&1

ls -s> Friday 2>&1

Which of the following commands could you use to search man pages for a specific keyword (select three) man -k whatis find slocate apropos

man -k whatis apropos

You are working on a Linux system and need more information about the uname command. What command should you use to learn about the uname command syntax and options.

man uname

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 you satisfy your requirements? echo myscript >> testfile.txt myscript | testfile.txt myscript >> testfile.txt myscript | echo | testfile.txt

myscript >> testfile.txt

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? i p a o

o

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? cc p dw u

p

Which command will display the present working directory?

pwd

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

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 :w network.txt vi -new network.txt vi -n network.txt vi network.txt

vi network.txt

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

xargs

While in vi command mode, you need to copy an entire line of text. What command should you use?

yy

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

|

Your default runlevel on your Linux system is set to textual, multi-user mode; however, you want the X Windows System to launch when you log into the system. Which file should you edit? ~/.bash_logout ~/.bash_log ~/.profile ~/.bash_login

~/.bash_login

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

~/.bash_profile

Which of the following files would you use to create aliases that are applied when a specific user starts a BASH session? ~/.profile ~/.bash_logout /etc/profile ~/.bashrc

~/.profile ~/.bashrc


Related study sets

Module 2 - Microsoft Cloud Adoption Framework for Azure

View Set

analogous structures male/femail

View Set

Amino Acids - Structure to full name

View Set

Chapter 12: Postpartum Physiological Assessments and Nursing Care

View Set

Anatomy and physiology chapter 16

View Set

ROMAN FORM FUNCTION CONTEXT AND CONTENT

View Set

Introduction to Programming - TXC1, Introduction to Programming - TXC1 Practice

View Set