Wildcards Flashcards

1
Q

What is a wildcard?

A

a character or string used for pattern matching

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

What is globbing?

A

The expansion of wildcards patterns into a list of files or directories

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

*-

A

A wildcard for trying to match one or more characters

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

?

A

a wildcard for matching exactly one charater

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

[]

A

Matches exactly one character in the brackets []

eg:

ca[nt]
-cat (yes)
-can (yes)
-candy (yes)
-catch (yes)
-cap (no)

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

[!]

A

Match any one thing in the bracket that is NOT in a file

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

[a-g]*

A

Match all the characters that are in the range

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

[[:alpha:]]

A

Matches alphabetical characters (lower and upper)

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

[[:alnum:]]

A

letters and decimal digits

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

[[:digit:]]

A

0-9

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

[[:lower:]]

A

lowercase letters

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

[[:space:]]

A

Whitespace (tabs, newline, space)

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

[[:upper:]]

A

uppercase letters

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

How do you match wildcard characters?

A

Use an \

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

ls *.txt

A

Lists everything with .txt

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

ls ??

A

lists all files that are 2 characters long

17
Q

ls a?.txt vs ls a*.txt

A

One will just ab.txt, the other will list a.txt and ab.txt

18
Q

ls c[aeiou]t

A

cat and cot

19
Q

ls [a-d]*

A

lists anything that has at least 1 or more instances of that pattern a-d

20
Q

stdout

A

Standard output or 1

21
Q

stderr

A

Standard error or 2

22
Q

stdin

A

Standard input or 0

23
Q

>

A

redirects output to a file and overwrites w/e was there

24
Q

> >

A

redirects output to a file and appends to what was there

25
Q

<

A

redirects input to a command

26
Q

&

A

redirects to a file descriptor instead of name

27
Q

2>&1

A

combines stderr and stdout

28
Q

2>file

A

redirect a standard error to a file

29
Q

ls -l&raquo_space; files.txt

A

appends the listed output to files.txt