Linux chapter 1-5 Midterm

Ace your homework & exams now with Quizwiz!

When you use the paste command, columns of information are separated by a tab. However, your boss wants the columns separated by a colon. What option enables you to specify the colon as the separator?

-d:

You are using the grep command, but it is only searching through files in your immediate home directory. What option enables you to search through subdirectories below your home directory?

-r

You have created a script file called sum_report in your home directory and have made it executable. What command do you use to run the script?

./sum_report

You have purchased a special monitor for your computer and the instructions tell you to make a minor modification to the inittab file. Where would you locate this file on a typical Linux system?

/etc

You are curious about the error and system logs kept by your operating system. In what main directory under the root (/) would you most likely find these logs?

/var

When you enter the command grep Linux /info/Linux_features | head, what is the maximum number of lines that will be displayed?

10 lines

You are starting a new year and need to create ten empty files for your accounting system. Which of the following commands or operators enable you to quickly create these files? (Choose all that apply.)

>

What addition to the command you used in Exercise 1 can you use to slow the output to one screen at a time?

Add a pipe and use more or less, as in grep host /etc/* | more or grep host /etc/* | less.

List four examples of selection commands.

Any four of the following (from this and previous chapters and from Table 5-1): comm, cut, diff, grep, head, tail, uniq, and wc.

How can you use the touch command to create four new files called sum, datanew, results, and calcs (using one command line)?

At the command line type touch sum, datanew, results, and calcs and press Enter. Alternatively you could also enter touch sum ; touch datanew ; touch results ; touch calcs.

Which shell is used by Linux as the default command interpreter?

Bash shell

What is the process called compiling?

Compiling is a process of translating a program file into machine-readable language.

Using the practice file, practice copying and pasting the text to rearrange the order of the lines.

Copy lines of text and paste in random locations.

While you are typing a command, you misspell the name of a file you want to specify with the command. Which of the following command line key combinations enables you to go back and fix your error?

Ctrl+b

Use the who command to determine the idle time for users currently logged in, but output that information to a file called users_info. Next view the file you created.

Employ the command who -u > users_info and then type, for example, cat users_info.

Make certain you are in your home directory. Change your command prompt so that it shows your current working directory with an exclamation point, such as mydirectory! Change to the spreadsheets and then to the documents directory and notice how the prompt changes

Enter cd to go to the home directory. Enter PS1="\w"! to change the command prompt. Use the cd documents and then cd spreadsheets commands to go to the documents directory and then the spreadsheets directory and notice that the command prompt changes to show that directory. Use cd .. to go to the documents directory and verify the prompt.

Delete the datainfo files in both your home directory and in the spreadsheets directory. Also, delete the myinfo and datadata files in the spreadsheets directory.

Enter rm ~/documents/spreadsheets/datainfo and enter rm datainfo from the home directory, for example, to delete both instances of the file. Enter rm ~/documents/spreadsheets/myinfo and then enter rm ~/documents/spreadsheets/datadata.

You are trying to use the command sort -t: +5 datastore, but you get an error message each time you try it. How can you save the error message in a file called error, so you can e-mail the file to your computer support person?

Enter sort -t: +5 datastore 2> error.

Make certain you are in your home directory. Use a relative path to make your new documents directory the current working directory. Next, use a relative path to make the spreadsheets directory your current working directory. Now, use a command with dots in it to make the documents directory your current working directory.

First, enter cd documents and then enter cd spreadsheets. Next, enter cd .. to move back to the documents directory.

Use the command-line history function to determine the most recent two commands you entered.

If students have typed only the sequence of commands for these exercises, then by using the up arrow the last two commands should be who -b and who -uH ; w.

As you look over the shoulder of an employee who is using the vi editor, you see her use the command :l,$s/capitol/capital. What does this command do?

It changes all instances of capitol to capital.

Which of the following is true of the pipe operator? (Choose all that apply.)

It redirects the output of one command to the input of another command.

After you create a script file, what are the next steps to run it?

Make the file executable by using the chmod command. Next, run the file by typing ./ plus the name of the file.

Paste the line with your first and last name in the middle of the text.

Move the cursor to the middle line in the file and type p to paste the line.

When you use the pr command how can you limit the output to only a screen full of text to view. (Choose all that apply.)

Pipe the output into more. and c. Use the -l 23 option..

Remove the eighth line, and place it at the end of the file.

Press Esc to return to Command mode and type 8G to move to the beginning of line eight. Type D to delete from the cursor to the end of the line. Type L to move to the last line. If necessary, type $ to move to the end of the current line. Type p to restore the deleted line to the end of the file.

Use the ls -l command to view the contents of the root file system directory (/).

Students should type ls -l / to view the contents of the root directory.

Use the ls command to list the contents of the root file system directory (/) on your system.

Students should type ls / to view the contents of the root directory.

With your home directory as your current directory, use the command to remove read, write, and execute permissions from group and others for the spreadsheets directory. Next, verify that your change has taken place.

The command students can use is: chmod go-rwx ~/documents/spreadsheets. To verify their work, students should enter ls -l ~/documents.

Create a command that sorts on the second field in the file addresses, and then writes the sorted results to the new file sorted_addresses.

The command that can accomplish this is sort -k 2 addresses > sorted_addresses.

Determine the inode value for the /etc directory.

The command to determine the inode value is ls -i / .

Create a command that enables you to copy all of the files in the spreadsheets directory to the accounts directory (when both directories are first-level directories under your home directory and you are currently in your home directory).

The command to use is cp spreadsheets/* accounts .

The file info.txt is in the help directory, which is a subdirectory of the /dev directory. What is the absolute path to info.txt?.

The full path is: /dev/help/info.txt.

How would you describe the purpose of the more command?

The more command enables you to view a file's contents by scrolling down.

What is the name of a standardized bit pattern for characters and numbers that is used by most computer operating systems?

The name is American Standard Code for Information Interchange (ASCII).

Short answer: When you see the permissions rwx--x--x associated with a file, what permissions are granted?

The permissions that are granted are: owner has read, write, and execute; group has execute; and others have execute.

Run the who -H, cal 2009,, and clear commands using one command-line sequence. What do you end up with on the screen?

The screen ends up cleared.

Briefly explain what you can accomplish with the sed command.

The sed command can be used to edit the contents of one or more files. It enables you to delete lines, substitute text, append text, and show line numbers, for example. You can use one of two forms of sed, One form uses an editing command and the other uses a script file..

Which of the following conditions must be met for you to combine two files using the join command? (Choose all that apply.)

The two files must have a common field, such as last name.

Search for your last name.

Type /yourlastname and press Enter.

Move to the line of text that contains your first and last name, cut it, and place the text in the buffer.

Type 5G to move to line five (where you typed your first and last name), type dd to delete the current line and place it on the clipboard.

Go to the fifth line and insert your first and last name.

Type 5G to move to line five. Type i to switch to Insert mode. Type your first and last name.

Delete lines 9 and 10.

Type 9G to move to line nine. Type dd to delete the current line. Repeat the process for line 10.

Enter the command that causes line numbers to appear.

Type :set number and press Enter.

Save the file but do not exit vi.

Type :w and press Enter.

How can you create a file called history by using a redirection operator?

Type > history and press Enter.

Without exiting vi, temporarily execute the ls command to confirm that the file is saved.

Type Ctrl+z to access the command prompt. Type ls and press Enter. Type fg and press Enter to return to vi.

Use the command to go to the first line of the file.

Type H.

Assume you have a subdirectory named datafiles directly under your current working directory. What command can you use to copy the data1 and data2 files from your current working directory to the datafiles directory?

Type cp data1 data2 datafiles and press Enter.

Back up the history file to the file history.bak.

Type cp history history.bak and press Enter.

How can you find all files in your home directory that were modified in the last seven days?

Type find /home/username -mtime -7 -print and press Enter.

Assume you have 10 subdirectories and you want to locate all files that end with the extension ".c". What command can you use to search all 10 of your subdirectories for this file?

Type find /home/username -name *.c and press Enter.

What command enables you to find all empty files in your source directory?

Type find /home/username/source -size 0 and press Enter.

Use the grep command to find all the lines that contain the word "celtic" in the CD_list_new file

Type grep "celtic" CD_list_new and press Enter

Use a command to find out which lines in the my_list file contain the word "Foot".

Type grep Foot my_list and press Enter.

Use a command to find the instances in which the word "host" is used in the /etc directory.

Type grep host /etc/* and press Enter.

Sort the corp_phones1 file by the last four digits of the phone number.

Type sort -t: -k 3 corp_phones1 or sort -t: -k 3 -g corp_phones1and press Enter.

Wait one minute or more and then change the timestamp on the history file you just created.

Type touch history and press Enter.

Create a file with 12 lines of text. Delete the second word in the text.

Type vi 12linefile and press Enter. Type i to switch to Insert mode. Enter twelve lines of text. Press Esc to switch to Command mode. Type 1G to move to the beginning of the first line (be sure to use "G" and not "g"). Type w to move forward one word. Type dw to delete the current word.

Using the vi editor:Create a document called first.file, and enter a few lines of text in it. Save it.Create a second document called second.file, and enter a few lines of text in it. Save it.Create a third document called third.file by merging the text from the first two files.Save the third file, and exit the editor.Type vi third.file and press Enter to be certain third.file contains the text from both files.

Type vi first.file and press Enter. Type i to enter Insert mode. Enter a few lines of text then press Esc, type :x and press Enter to save and exit. Type vi second.file and press Enter. Type i to enter Insert mode. Enter a few lines of text then press Esc. Type :x and press Enter to save and exit. Type vi third.file and press Enter. In command mode type :r first.file and press Enter. Type :r second.file and press Enter. Type :x to save and exit.

Delete all text from third.file that you created using vi and then restore it.

Type vi third.file and press Enter. In command mode, type :d and press Enter. Repeat for each line of text. Type u to restore each individual line of text. Type :x and press Enter to save and exit.

Using the vi editor:Create a document with four lines each containing the word "today."Copy the first four lines using only one command.Save the file and exit vi.Reopen the document and change "today" to "yesterday" only on the first four lines.

Type vi todayfile and press Enter. Type i to enter Insert mode. Type line one today and press Enter. Type line two today and press Enter. Type line three today and press Enter. Type line four today and press Enter. Press Esc to return to "command" mode. Type . (period) to copy the four lines you entered. Type :x and press Enter to save the file and exit the editor. Type vi todayfile and press Enter to re-open the file. Make sure you are in "command" mode and type :1,4s/today/yesterday/g and press Enter. Type :x and press Enter to save and exit the editor.

Determine the number of bytes in both the trees and more_trees files using a one-line command.

Type wc -c trees more_trees and press Enter.

How can you determine the number of lines and words in the /etc/termcap file?

Type wc -lw /etc/termcap and press Enter.

You share a Linux computer with a coworker. What is the best way to exit your UNIX or Linux session when you are done?

Use a GUI menu option to log out or enter an appropriate command for the shell you are using, such as exit or logout (if there is no GUI desktop in use).

View the contents of the month file you created in Exercise 8.

Use any of the view commands, such as cat, more, or less.

View the documentation for who and then view the documentation for w. How are these commands similar?.

Use man who and then man w to view the documentation. As the documentation notes, who displays who is logged on and w displays not only who is logged on but what they are doing.

Create the subdirectory mytest. Copy a file into your new subdirectory. Delete the mytest subdirectory and its contents using one command..

Use mkdir mytest to create the subdirectory. Use the cp command to copy a file into the new subdirectory. From the directory above the new subdirectory type rm -r mytest and press Enter.

You are worried about copying over an existing or newer file in another directory when you use the move command. What are your options in this situation?

Use the -i or -u options with the move command.

Add text to the file, and practice using the cursor movement commands.

Use the cursor movement commands and insert new words throughout the file.

When you use the Awk printf capability, what does the dollar sign ($) represent?

a data field

On which of the following types of computers might you find a UNIX or Linux operating system? (Choose all that apply.)

a mainframe computer, b. a desktop PC, c. a server, and d. a workstation for scientific research

Which of the following are file systems supported by UNIX and Linux operating systems? (Choose all that apply.)

a. NTFS, b. vfat, d. ufs, and e. ext

You want to combine two files, data07 and data08, into a file called data_all. Which of the following commands do you use?

cat data07 data08 > data_all

Which of the following commands enable(s) you to set permissions on a directory after you create it? (Choose all that apply.)

chmod

You have been entering lots of commands and now your terminal window is cluttered will all kinds of activity. What command can you use to clear your window of the clutter?

clear

Which of the following commands would you use to make a backup copy of the file AR2008?

cp AR2008 AR2008.bak

You are in your home directory and need to copy the file MemoRequest to a folder under your home directory called Memos. Which of the following commands do you use?

cp MemoRequest Memos

You are examining your addresses file, which contains the first and last names of people you know as well as their street address, city, state, zip code, and telephone number. You want to print a list of last names, which is field 1, and telephone numbers, which is field 7. Which of the following commands enables you to print this list?

cut -f1,7 addresses

Your international company is scheduling a meeting among managers in Canada, the United States, Spain, Sweden, and Hong Kong on the basis of Greenwich Mean Time (GMT). What command enables you to display the current time in GMT?

date -u

You have a lot of subdirectories under your home directory and know that you saved the file supplemental in one of them, but you are not sure which one. After you use cd to change to your home directory, which of the following commands enables you to search all of your subdirectories for the file?)

find -name supplemental

What is the general format for using the pipe operator?

first_command | second command or first_command | second command | third_command (more commands can be piped)

Which of the following are ways in which you can structure a record containing data? (Choose all that apply.)

fixed-length and variable-length

You have just finished a 25-page paper that you have written using Emacs. The file containing the paper is called /assignments/data_sources. After your instructor has briefly looked at the paper, she recommends that you change all instances of the reference "data is" to "data are" before you submit it. Which of the following commands can you use to locate these references in the file for a quick assessment of how much you have to change?

grep "data is" /assignments/data_sources

SSH can be used to ___________________.

log in remotely to another computer on a network

Each time you list the files in your home directory, the output scrolls by so fast you can't read it. Which of the following enables you to view the output one screen at a time?

ls -l | more

Which of the following can be accomplished with the mv command? (Choose all that apply.)

move a file and rename a file

Your boss is planning to do some house cleaning by deleting several old files. However, she mentions that she doesn't want to delete an important file inadvertently. What command can she use so that she is prompted to make sure she wants to delete a particular file?

rm -i

You need to delete 30 files that all start with the letters "customer," such as customer_accounts, customer_number, and so on. Which of the following commands enables you to quickly delete these files?

rm customer*

You are doing some "house cleaning" and want to delete several empty directories. Which of the following commands can you use? (Choose all that apply.)

rmdir

While in the Bash shell, you have written a simple script file and now want to execute the script. Which of the following commands enables you to run the script?

sh

You keep a yearly record of the birds you've seen in your town. The name of the file is birds. The file contains the following fields name (field 1), markings (field 2), year(s) viewed (field 3), and location (field 4). You want to review the contents of the file, sorted by location. Which of the following commands do you use?

sort -k 4 birds

What command enables you to sort the contents of a file in reverse order?

sort -r

Which of the following commands can you use to sort the file vendor_name and display the results on the screen?

sort vendor_name

Standard output is referred to as which of the following?

stdout

Your project team uses a group of the same files and tracks whether they are still in use by looking at the last modified date. You need to show that a series of files are still in use by changing the last modified date to today. What command do you use?

touch

You are creating a file to send over the Internet via a satellite connection that only allows you to send files under 250 KB. Which of the following commands enables you to determine the number of bytes in the file before you try to send it?

wc -c

You are interested in determining the number of words in your /assignments/data_sources file mentioned in Question 1. Which of the following commands should you use?

wc -w /assignments/data_sources

Create a file called trees, containing the following individual lines:Oak tree.Pine tree.Spruce tree.Cottonwood.Maple tree.Use the vi editor to create a file called more_trees and copy in the contents of the trees file (if the first line is blank, delete it). Next, add the following trees at the end of the list. Redwood.Willow tree.Use a command to compare the trees and more_trees files and that outputs the differences in columns.

Use the vi editor to create the trees file. Use the vi editor with the :r option to import the trees file into the more_trees file and then add the new lines. Type comm trees more_trees and press Enter.

While you are working on a report in vi, you decide to insert information from another text file in your home directory called summary_data. Which of the following commands (from command mode) enables you to add the contents of summary_data?

:r summary_data

When you started the vi editor, you forgot to specify the name for the new file you are creating. To save steps next time, how can you specify the name of a new file when you first start vi?

Enter vi and the filename, such as vi myfile.

View the files month and users_info in sequence by using:The less command.The more command.

First use the command line, less month ; less users_info and then type more month ; more users_info.

Make a directory under your home directory called documents. Next make a directory under the documents directory called spreadsheets. What is the absolute path for the spreadsheets directory?

First, students should use cd or pwd to make sure they are in their home directory (use cd to change to the home directory). Next, they should enter mkdir documents. Next, they can use cd documents and type mkdir spreadsheets. The absolute path is /home/username/documents/spreadsheets.

Create a file called who_info that contains the documentation for the who command. Next, use the less command to view the who_info file contents and scroll forward and backward through the information. Then use the tail command to view the final 12 lines of the who_info file. Finally, use the head command to view the first 12 lines of the who_info file.

First, use the command man who > who_info. Next, use the command less who_info and use the scroll keys, such as the Pg Dn and Pg Up keys. Then use the command tail -n12 who_info. Finally, use the command head -n12 who_info.

Use the history function to retrieve the command line you used in Exercise 19. Use the edit function to remove the word "clear" and replace it with "date." Next, go to the beginning of "cal" and delete the text on the line from "cal" to the end. Now, change the -H to -u. Finally, add "; date -u" so that your final command-line entry is: who -u ; date -u. Execute the command-line entries.

First, use the up arrow to retrieve the who -H ; cal 2008 ; clear command. Press Ctrl+b or the left arrow key to go to the beginning of clear and press Ctrl+k. Type the word date. Next, press Ctrl+b multiple times or use the left arrow key to go to the beginning of cal. Press Ctrl+k. Use the left arrow key or press Ctrl+b to move to the H. Press Del and type u. Use the right arrow key to go just beyond the semicolon and type date -u. Press Enter.

View the files, month and users_info, in sequence using only one command-line sequence of commands

For this exercise students might use the cat command, such as cat month ; cat users_info.

How can you get help for using the vi editor? (Choose all that apply.)

From command mode enter :help. and d. From the regular command line outside of vi enter man vi.

You are using the vi editor to create a list of tasks on each line and you would like an easy way to number each line (task) listed in the file. Which of the following is an easy solution?

From command mode enter :set number.

You have been working on a long vi text file and now you've got to rush off to a meeting. How can you quickly save your work and exit the vi editor? (Choose all that apply.)

From command mode enter :wq.,b. From the command mode enter :ZZ.,, and d. From the command mode enter :x.

You are in the vi editor and it's now noon. Everyday at noon you run a program called update, which updates a database. How can you run the program without closing your vi session?

From command mode type :!update and press Enter..

While editing a file in vi you realize that you have been spelling the word receive as recieve. How can you find all occurrences of your misspelled receive? (Choose all that apply.))

From command mode, type /recieve and press Enter.

You're editing a document using vi and you are near the end of a page. You want to quickly go back to the top of the page to check something you said. Which of the following command-line commands enables you to quickly go to the top of the page?

H

A friend of yours is trying to make more space on his hard disk drive and is considering deleting the /lib directory because he has heard it mostly contains games that he doesn't use. What is your recommendation?

Keep the /lib directory because it holds security information, shared library images, kernel modules and other important files.

Your company is discussing plans to migrate desktop and laptop users to Linux. One concern raised by the users is whether Linux supports the use of CDs and DVDs for both work files and for listening to music. Which of the following is an appropriate answer?

Linux supports both the UDF and iso9660 file systems for CD and DVD use.

Append the current month's calendar to the datainfo file that is in your home directory. Next copy your changed datainfo file over the older datainfo file in the spreadsheets directory, but use the copy option that prompts you before you overwrite the file in the spreadsheets directory. Check the contents of the datainfo file in the spreadsheets directory to make certain your copy was successful.

Make sure you are in your home directory. Enter cal >> datainfo. To copy the new file over the old one, with a verification prompt, enter cp -i datainfo ~/documents/spreadsheets. Last, to verify the contents of the file enter, (such as from the home directory) cat ~/documents/spreadsheets/datainfo (or students might use the more or less commands instead of cat).

Make the spreadsheets directory your working directory. Make copies of the datainfo file in the spreadsheets directory, so that one copy is named myinfo and one is named datadata. Next, use a wildcard character to list all files that start with "data." Use a wildcard character to list all files that end with "info." Use a wildcard character combination to list all files that have "ata" as the second, third, and fourth characters.

One way to change directories is to type cd documents and then cd spreadsheets. Enter cp datainfo myinfo and then cp datainfo datadata. Enter ls data* to list the files starting with data. Enter ls *info to list the files ending with info. Enter ls ?ata* to list the files with "ata" as the second, third, and fourth characters.

How can you find out information about the status of an editing session while in the vi editor? (Choose all that apply.)

Press Ctrl+g while in command mode.

Which of the following enables you to move the cursor to the left while you are in command mode in the vi editor? (Choose all that apply.)

Press the left arrow key. and c. Press h.

You're in a hurry and have just executed a command to print the contents of a file; and you decide you want another copy of the printout. What key sequence can you use to repeat the last command, which was used to print the file?

Press the up arrow key one time

Determine the default permissions on the datainfo file your created. Next, set the permissions on the datainfo file so that the owner, group, and others can read and execute the file (otherwise leave the default settings as is).

Students can use the ls -l command, such as ls -l ~/documents/spreadsheets to determine the default permissions (-rw-rw-r--). To set the permissions enter chmod ugo+rx ~/documents/spreadsheets.

Change to the /dev directory. Next, access your home directory using a tilde (~) in the command that you employ.

Students should first enter cd /dev to go to the /dev directory. Next, they should enter cd ~ to return to their home directory.

Make the root file system directory your current working directory. What command can you use to verify that you are in the root file system directory? Return to your home directory.

Students should first type cd / to go to the root directory and then type pwd to verify that is their current working directory. Last, they use cd to go back to their home directory.

Change to your home directory. Use the rmdir command to delete the spreadsheets directory. What happens?

Students should see an error message that the directory is not empty.

Use the cal command to determine on what day of the week you were born.

Students should type cal plus the month they were born and the year, such as cal 9 1985.

Make /etc your current working directory and then go back to your home directory

Students should type cd /etc and then type cd to return to their home directories.

Use the man program to determine what other commands you should also see in relation to the clear command

Students should type man clear. The other commands of interest are: tput and terminfo.

Use the man program to find out what the -R option does when used with the date command.

Students should type man date and determine that the -R option is used to show a date string in the rfc-822 format.

Use the whatis command to determine the purpose of the ls command.

Students should type whatis ls and see that this command is used to list directory contents.

Which of the following is the UNIX distribution originally developed through AT&T Bell Labs?

System V

What is the purpose of Telnet?

Telnet can be used to connect a UNIX , Linux, or Windows PC to a remote computer.

Short answer: Your boss wants to use the command to view hidden files and also wants to know how to find them among other files. What do you tell her?

The command to view hidden files is ls -a. In the resulting list of files, the hidden files are the files that start with a dot (.) in front of the file name.

Short answer: You have many files that begin with the word "account" and that end with two digits to designate a year, such as account00, account 01, and so on. What is the command that enables you to view all of these files that start with account?

The ls account?? command will display all of the files that start with account.

You are helping a friend who is new to Linux. You want to determine which entries under her home directory are directories instead of files. When you perform a long listing of the home directory's contents, what do you use to distinguish a directory from a file?

The very first character in the line for an entry will be "d" for directory or "-" for an ordinary file

Use the cat command to create a two-line file in your home directory called datainfo. On the first line enter 144 and on the second line enter 288. After the file is created, copy it from your home directory to the spreadsheets directory you created.

To create the datainfo file, students can first use the cd command to make sure they are in their home directory. Next, they should type cat > datainfo, enter the two lines and type Ctrl+d. Finally, to copy the file they enter cp datainfo ~/documents/spreadsheets.

How can you print a file while you are in the vi editor?

To print a file while in the vi editor type :lpr filename and press Enter.

Explain how you can run more than one command on a single command line.

To run more than one command on a single line, use the ; (semicolon) character to separate each command.

Change to your home directory. Delete the spreadsheets directory and then delete the documents directory.

Type cd. Enter rmdir ~/documents/spreadsheets and then enter rmdir documents.

Create a directory called secure under your home directory. Next, using the octal permission format, set security on the secure directory so that you have all permissions and no one else has any permissions.

Type mkdir secure and press Enter. Next type chmod 700 secure and press Enter.

Run the who -uH and w commands using one command-line sequence to compare the results.

Type who -uH ; w. The w command shows additional information, such as JCPU, PCFU, and WHAT columns to view what users are doing.

You enter Cal on the command line to view a calendar but only see an error message. Explain why you got the error message.

UNIX and Linux are case sensitive, so to display a calendar you must use the cal command and not Cal.

Create a file called favorite_foods, and list your favorite foods, entering five or six or more. Press Enter after each favorite food so it appears on its own line (make certain you also press Enter after the final food item). After the file is created, add two more foods you like that are not on the list (press Enter after the final food item). View the list of foods to make certain the two items you added appear at the end of the list.

Use cat > favorite_foods, type the favorite foods, and press Ctrl+d to finish and save the information. Next, type cat >> favorite_foods enter the two new foods and press Ctrl+d.

Clear the screen, and view the online manual to determine how to display today's date in UTC.

Use the clear command and then use the man date command for this exercise. .

Create a file called month containing the current month

Use the command cal > month.

Determine whether there are any hidden files in the /home directory.

Use the command ls -a /home. Typically, students will find there are no hidden files in /home.

Determine when the computer you are working on was last booted.

Use the command who -b.

Use the cal command to determine which year between 2005 and 2010 is a leap year.

Use the command, cal -j 2008, because 2008 is a leap year; also use cal -j 2012, because 2012 is also a leap year. Note that a leap year has 366 days in the Julian calendar.

Display the current UTC.

Use the command, date -u.

Short answer: Where is virtual memory located?

Virtual memory is located on disk, such as in swap space.

Your colleague has written a line of text in vi and now wants to delete the line, but save its contents in a buffer in case he decides to bring back the line he deletes. What do you recommend?

While in command mode, move the cursor to the first character in the line and press dd.

You work at a law firm with eight other people. All of the eight computers on the firm's network use wireless connections to communicate with one another without a server. This is an example of which of the following?

a peer-to-peer network

You are using vi to edit a file and have just entered 12 new lines. You need to replicate the same 12 lines right after you enter them. What command-mode command can you type to replicate the lines? (Choose all that apply.)

a period (.)

You are preparing to give a training session on the vi editor. How would you describe it? (Choose all that apply.)

a, It is modal., b. It is a text editor, c. Most UNIX/Linux distributions come with vi., and d. It is a screen editor.

Which of the following are examples of Linux distributions? (Choose all that apply.)

a. SUSE Linux Enterprise, b. Mandriva, c. Fedora, and d. Red Hat Enterprise Linux

Which of the following commands enable you to view the contents of a file? (Choose all that apply.)

a. less and b. cat

Which of the following are permissions that can be granted to a file? (Choose all that apply.)

b. write, c. execute, and e. read

Before you make the note in Question 1, you decide to determine Friday's date, so that you can include it in your note. What Linux command can you use to quickly determine the Friday's date?

cal

Your boss drops by your office in a hurry to ask you to attend a meeting at 10:30 on Friday morning and you can't find a pen to make a note as a reminder. What Linux command can you use to make a quick note to store in a file called Meeting?

cat > Meeting

You need to type in a line of text to the end of a file called Annual_Report. Which of the following commands enables you to add the text?

cat >> Annual_Report

You're frantically trying to get ready for a meeting and want to access a file in your home directory, but you are currently working in a public directory open to all users. What command can you enter to instantly go to your home directory?

cd

It's late and you have been working all day to finish a report. Before you go home you want to copy several files including your report file. What copy command should you use to ensure that you don't inadvertently copy an older report file over the newer report file you've been working on for the last four hours?

cp -u

You have created many notes to yourself that end in .txt. Which of the following commands enables you to list all of the .txt files in your home directory while you are in the Bash shell?

ls *.txt

A member of your department has given you permissions to view the contents of the accounting directory under his home directory. The name of his home directory is bramirez. Which of the following commands should you use to display the contents of the accounting directory?

ls /home/bramirez/accounting

You have forgotten the purpose of the -n option in the cat command. Which of the following can you enter at the Linux command line to find out what the -n option does when used with cat?

man cat

You haven't changed your user account password for several months and now decide to create a new password. Which of the following commands should you use?

passwd

You have been working in several directories for the past hour and right now you don't remember which directory you're in currently. What command can you use to show your current working directory?

pwd

You are working with a new colleague who has entered the man command, but who does not know how to end the man session to return to the regular command prompt. What keystrokes do you show your colleague to end the man session? (Choose all that apply.)

q

In your document files, you often put the date you created the file and the date you last modified it in the last two lines of the file. What command can you use to look at only the last two lines of the file called, project?

tail -n 2 project

This is your first day on the job as a Linux server administrator and your boss gives you the password for root. What is root?

the administrative account that has complete access to a UNIX/Linux system

When you enter the who command, what information do you see? (Choose all that apply.)

the users on the local system


Related study sets

ECO2013 - Homework Chapters 1 & 2

View Set

Office Applications I Unit 4 Test

View Set

Life and Health: Life Insurance Basics

View Set

Intro to computer tech Chapter 2

View Set

MGMT 470: Ch. 9, 10, & Other Key Terms

View Set