Viewing Text and Redirecting Output Flashcards

1
Q

What is a file perusal filter for crt viewingq and provides a filter for paging through text one screenful at a time?

A

More
-use more followed by the file name it will allow you to view and move around the file

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

What is a text viewing utility similar to more but with more features like backward movement?

A

less

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

What command outputs the first part of files?

A

head
-the -n option specific the number of lines to print rather then the default of 10
-type head follower by text file for example head /var/log/messages and it will show a default of 10 first lines. To change do head -n /var/log/messages

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

What command outputs the last part of files?

A

tail
-the -n option specifies the number of lines and -f is used to append data as the file grows (log file)
Example. tail -f /var/log/messages this will show the new messages as they are happening. Good if you are following an active incident or issue to show the logs in a server

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

What command prints lines matching a pattern?

A

grep
- -i option ignores case
- -R option reads files under each directory recursively
Example use grep then a line of text and then wehre you want to search for that text. So grep hello /var/log/messages it will output every line that has the word hello in /var/log/messages
If you do grep -R cloud_user /var/log/ it will search every directory and file within the log directory

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

What command sorts lines of text files and what order?

A

sort…ascending alphabetical order
- can be reversed with -r option
- -n used to sort numerically
-can sort multiple files

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

What are the file descriptors?

A

0: input stdin
1: output stdout
2: stderr

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

Output redirection

A

> > >

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

Input redirection

A

< «

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

Error Redirection

A

2>

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

Redirect stdout and stderror (Merge)

A

2>&1 and &>

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

What is pipeline redirection

A

A pipe | allows the output of one command to serve as the input of another command

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