View and Navigate Flashcards

(21 cards)

1
Q

What does the head command do?

A

Displays the beginning of a file.

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

Why is head useful?

A

Quick checks on header or initial configurations.

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

Default behavior of head?

A

Shows the first 10 lines.

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

Syntax of head?

A

head [options] file

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

Example: View first 50 lines?

A

head -n 50 /etc/apache2/httpd.conf

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

What does tail do?

A

Shows the end of a file.

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

Why is tail useful?

A

Real-time monitoring of log files.

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

Default behavior of tail?

A

Displays last 10 lines.

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

Syntax of tail?

A

tail [options] file

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

Example: monitor logs in real time?

A

tail -n 20 -f /var/log/syslog

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

What does -n mean in tail?

A

Specifies number of lines.

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

What does -f mean in tail?

A

Follows file as it grows.

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

What does more do?

A

Views long files one page at a time.

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

What type of tool is more?

A

A pager.

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

Syntax of more?

A

more [options] file

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

Example using more with pipe?

A

cat /var/log/syslog | more

17
Q

How to scroll in more?

A

Spacebar for pages, Enter for lines.

18
Q

What does less do?

A

Enhanced pager with backward scrolling and searching.

19
Q

Why is less better than more?

A

Supports backward navigation and search.

20
Q

Syntax of less?

A

less [options] file

21
Q

Example of interactive viewing?

A

cat /etc/passwd | less