Section3 Text Editor Flashcards

(24 cards)

1
Q

What is the primary objective of Practice lab 3

A

To master essential commands for displaying, navigating, and modifying file content in linux.

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

Which command ensures you are in your home directory before starting the lab exercises?

A

cd -

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

What command creates a new file named lab_notess.txt and writes “Line 1: important config” into it, overwriting any existing content?

A

echo “Line 1: Important config” > lab_notes.txt

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

What operator is used with echo to add new lines of text to an existing file without deleting its current content?

A

The append operator»_space;
example: echo “New Log Entry”»_space; lab_notes.txt

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

Which command is described as best for small files because it dumps the entire content to the screen at once?

A

The cat command
example cat lab_notes.txt

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

What is the expected result of running cat lab_notes.txt after it has been fully populated in the lab preparation?

A

It shows all 6 lines of the file immediately.

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

Which command is recommended for viewing large system files because it allows for scrolling and searching?

A

The less command.
example

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

When viewing a file with less what key is used to scroll through the content?

A

The spacebar

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

What key do you press to exit the less file viewer?

A

The q key

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

The __ command is used to view the first few lines of a file which are useful for checking headers.

A

head command, useful for viewing only the first few lines of a file.

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

What is the function of the -n [number] flag when used with the head or tail commands

A

It specifies the number of the lines to display. example: tail -n 2 lab_notes.txt

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

What specific command would you use to show only the first 3 lines of the /etc/fstab file?

A

head -n 3 /etc/fstab

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

The __ command is used to view only the last few lines of a file, making it extremely useful for checking recent log entries.

A

tail
example: tail -n 2 lab_notes.txt

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

What command displays only the last 2 lines of the file lab_notes.txt.

A

tail -n 2 lab_notes.txt

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

Which user-friendly, terminal based text editor is introduced in Practice Lab3?

A

The nano editor

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

What command opens lab_notes.txt for editing using the Nano editor?

A

nano lab_notes.txt

17
Q

In the nano editor. What is the keyboard shortcut to Write Out or save the file?

18
Q

After pressing Ctrl + o in nano to save. What must you typically do next to confirm the filename?

19
Q

What is the keyboard shortcut to exit the nano editor?

20
Q

After editing a file in nano. What command can be used to quickly verify the changes by displaying the entire file

A

cat lab_notes.txt

21
Q

The command
echo “new log entry”»_space; lab_notes.txt is an example of what operation?

A

Appending data to the end of a file

22
Q

Why is the append operator»_space; considered critical for logging scripts?

A

It allows adding new data to the end of a log file without opening an editor or overwriting existing entries

23
Q

What command can be used to verify the new log entry was successfully added as the very last line of the lab_notes.txt

A

tail -n 1 lab_notes.txt

24
Q

What is the final cleanup step in Practie Lab 3?

A

Removing the practice file using the rm lab_notes.txt command