BCCS199_Session_10 Flashcards

1
Q

In Linux (like Unix before it), nearly all configuration information is stored in…?

A

text files.
Contrast this with Windows, which stores configuration information in a huge, monolithic database called The Registry.
Text files are generally easier to set up and work with.
Linux includes a rich set of tools for viewing and editing text files. The following chapters describe some of these.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

cut command…?

A

selects columns of text in a text file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Commands like head, tail, and grep can be considered to make…?

A

“horizontal” cuts in a file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

cut can be considered to make…?

A

“vertical” cuts in a file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Switches for the cut command…?

A
  • Select character columns with the –c switch.
  • Select fields with the –f switch.
  • Select bytes with the –b switch (essentially the same as –c in most circumstances).
  • Specify the field delimiter character with the –d switch (tab is default).

Example on slide 5 to 6

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Paste command…?

A

Appends files horizontally, line by line

See example on slide 7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The diff command…?

A

Compares two files, and reports the differences between them.

See example on slide 8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

diff command line switches:

A
  • c : Generate the context sensitive format
  • C, –context[=N] Generate the context sensitive format, using N lines of context, if specified.
  • u Generate the unified format.
  • U, –unified[=N] Generate the unified format, using N lines of context, if specified.
  • N Another format for specifying N lines of context. Only used with -c or -u.
  • y, –side-by-side Generate the side by side format.
  • W, –width=N Use N columns when generating side by side format.

–left-column Print only the left column when using the side by side format.

-q, –brief Only report if files differ, not the details on the difference.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

diff can be quite picky, and report all sorts of changes which are…?

A

trivial and ultimately meaningless. Here are some switches to ease the pain:

  • b, -w, –ignore-all-space Ignore white space when comparing lines.
  • B, –ignore-blank-lines Ignore white space when comparing lines.
  • i, –ignore-case Ignore changes in case (i.e., consider upper and lower case characters equivalent.)
  • I, –ignore-matching-lines=regex Ignore changes that insert or delete lines which match the mandatory argument regex.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

cut command…?

A

selects columns of text in a text file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Commands like head, tail, and grep can be considered to make…?

A

“horizontal” cuts in a file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

cut can be considered to make…?

A

“vertical” cuts in a file.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Switches for the cut command…?

A
  • Select character columns with the –c switch.
  • Select fields with the –f switch.
  • Select bytes with the –b switch (essentially the same as –c in most circumstances).
  • Specify the field delimiter character with the –d switch (tab is default).

Example on slide 5 to 6

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Paste command…?

A

Appends files horizontally, line by line

See example on slide 7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The diff command…?

A

Compares two files, and reports the differences between them.

See example on slide 8

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

diff command line switches:

A
  • c : Generate the context sensitive format
  • C, –context[=N] Generate the context sensitive format, using N lines of context, if specified.
  • u Generate the unified format.
  • U, –unified[=N] Generate the unified format, using N lines of context, if specified.
  • N Another format for specifying N lines of context. Only used with -c or -u.
  • y, –side-by-side Generate the side by side format.
  • W, –width=N Use N columns when generating side by side format.

–left-column Print only the left column when using the side by side format.

-q, –brief Only report if files differ, not the details on the difference.

17
Q

diff can be quite picky, and report all sorts of changes which are…?

A

trivial and ultimately meaningless. Here are some switches to ease the pain:

  • b, -w, –ignore-all-space Ignore white space when comparing lines.
  • B, –ignore-blank-lines Ignore white space when comparing lines.
  • i, –ignore-case Ignore changes in case (i.e., consider upper and lower case characters equivalent.)

-

18
Q

The tr command…?

A

Performs character translations (substitutions, deletions, squeezing) on the input stream and passes the modified string to the output stream.

See example on slide 11

19
Q

See slide 12 for deleting characters examples

A

See slide 13 for squeezing characters

20
Q

aspell command is used for…?

A

spell checking text files.

Example on slide 14

21
Q

aspell can be used on the …?

A

stdin and stdout streams.

22
Q

aspell can also be used to start…?

A

an interactive spell check session (aspell - c filename)

This will highlight any word it can’t find in the dictionary in turn, and offer you a range of alternative for correction.

As usual, if there are no misspelled words, it says nothing at all.

23
Q

aspell two dictionaries are used by default…?

A
  • The system-wide master dictionary in /usr/share/dict
  • A user-specific dictionary stored in.aspell.en.pws
  • A list of corrections made is kept in .aspell.en.prepl.
    Note: the .en. refers to English; other languages can be used as well.
24
Q

fmt command is generally used to…?

A

break long lines up into shorter ones by inserting newline characters.

25
Q

split comamnd is used to…?

A

split large files into a set of smaller files with a common prefix.

26
Q

Linux includes many commands for viewing, formatting, and manipulating text files.
This is useful, because…?

A

nearly all configuration information is stored in text files.
This rich set of text editing tools helps system administrators maintain their Linux system.