Intro 3 Flashcards

1
Q

When a path starts with /, it’s a ______.

A

full or absolute path

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

A path not beginning with / is a ______.

A

relative path

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

The shell can match simple patterns to file and directory names, a process known as _______.

A

globbing

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

Which shell glob character instructs the shell to match exactly one arbitrary character?

A

?

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

How can you escape globs?

A

surround the glob with single quotes

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

It is important to remember that the shell performs expansions _______ running commands.

A

before

Therefore if a * makes it to a command without expanding, the shell will do nothing more with it and it’s up to the command to decide what it wants to do.

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

What are two of the most important grep options?

A

case insensitive search (-i) and inverted search (-v) which prints all the lines that don’t match

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

How do you use the less command?

A

less filename

spacebar - pagedown
b - pageup
q - quit

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

The less command is an enhanced version of an older program named ____.

A

more

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

How can you search for text inside less?

A

To search forward for a word, type /word and to search backward, type ?word. Press n to go to the next match.

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

How can you keep grep search limits to one page at a time?

A

Pipe them to the less command

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

How can you see the difference between two text files?

A

diff textfile1 textfile2

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

What command can you use to see what kind of format a particular file is in?

A

file

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

Why do you need to escape glob characters when using find?

A

Because the shell will expand the wildcards itself before passing them to the find command otherwise.

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

What is the syntax of the find command?

A

find dir -name file -print

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

What’s the difference between the find and locate commands?

A

Locate only searches an index that the system builds periodically, so it is much faster than find, but won’t be able to see more recent files.

17
Q

How would you print the lines of a file starting at line 7?

A

tail +7 filename

18
Q

How do you change your unix password?

A

passwd