Chapter 3 The Utilities

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

How can you find the phone number for Ace Electronics in a file named phone that contains a list of names and phone numbers? Which command can you use to display the entire file in alphabetical order? How can you display a file without any adjacent duplicate lines? How can you display the file without any duplicate lines?

$ grep "Ace Electronics" phone $ sort phone $ uniq phone

Which command can you use to look at the first few lines of a file named status.report? Which command can you use to look at the end of the file?

$ head status.report $ tail status.report

Recreate the colors.1 and colors.2 files used in Figure 3-8 on page 59. Test your files by running diff -u on them. Does diff display the same results as in the figure.

+ and - differentiate what is in each different file, and if a color is in both files then it has neither a + or a -

What happens when you give the following commands if the file named done already exists? $ cp to_do done $mv to_do done

Either command overwrites done with the contents of to_do

How can you find out which utilities are available on your system for editing files? Which utilities are available for editing on your system?

Give the command apropos editor. Typical editors are vim, ex, ed, and gedit.

Experiment by calling the file utility with the name of files in /usr/bin. How many different types of files are there.

I called a different file and it was ASCII text. You can see what's going on inside the file.

What is the result of giving the which utility the name of a command that resides in a directory that is not in your search path?

Since the which utility is all about the search path then it wouldn't work.

Create a .plan file in your home directory. Does finger display the contents of your .plan file?

The answer is system dependent.

How can you keep other users from using write to communicate with you? Why would you want to?

To write to someone command write username and if they're blocked, mesg y. If you want to block them mesg n. Idk why people do what they do? Let them live their lives BASH lol

What happens when you use diff to compare two binary files that are not identical? (You can use gzip to create the binary files.) Explain why the diff output for binary files is different from the diff output for ASCII files.

When you compare binary files with diff, the utility displays a message saying the files differ when the files differ or no message when the files are the same. The diff utility compares ASCII files on a line-by-line basis; it is not designed to compare binary files on a byte-by-byte basis. Use cmp to compare binary files in that manner.

Find or create files that a. gzip compresses by more than 80 percent. b. gzip compresses by less than 10 percent. c. Get larger when compressed with gzip. d. Use ls -l to determine the sizes of the files in question. Can you characterize the files in a, b, and c?

a. gzip compresses by more than 80 percent. The gzip utility compresses most text files by more than 80 percent. b. gzip compresses by less than 10 percent. The gzip utility compresses most files that are already compressed, such as jpeg files, by less than 10 percent. c. Get larger when compressed with gzip. The gzip utility expands a file that has already been compressed with gzip. (To compress a gzipped file a second time, you must remove the .gz filename extension.) d. Use ls -l to determine the sizes of the files in question. Can you characterize the files in a, b, and c? Files with repeated information or inefficiently stored information can be compressed the most. Files that have been compressed already store information efficiently and can be compressed only a small amount, not at all, or negatively (expanded).

Try giving these two commands: $ echo cat, $ cat echo Explain the difference between the output of each command.

echo places cat on the terminal screen as an output, cat is meant to read a file called echo in this case, and their is no file called echo.

Which commands can you use to determine who is logged in on a specific terminal?

who lists users on the system, finger for local and sometimes remote, whoami I to figure out who you are on the system.


Set pelajaran terkait

English 101 final exam (2022, Dr. Holt)

View Set

Essentials of Networking Modules 1, 2, 3

View Set

Business Law Final Exam, BLAW FINAL FOR TEST 111

View Set

FA 3 - Employee Engagement and Retention

View Set

Social Psychology Chapters 1 - 14

View Set

Salesforce Admin 1 Answer Format

View Set