Linux Essentials Flashcards

1
Q

What is the file descriptor number for STDIN?

A

the file descriptor number for STDIN is zero (0)

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

How is the file descriptor number for STDIN used in redirection?

A

< (same as 0<)
Redirects STDIN.

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

What is the file descriptor number for STOUT?

A

the file descriptor number for STOUT is one (1)

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

How is the file descriptor number for STOUT used in redirection?

A

> (same as 1>)
Redirects STDOUT. If redirection is to a file, the current contents of that file are overwritten.

> (same as 1»)
Redirects STDOUT in append mode. If output is written to a file, the output is appended to that file.

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

What is the file descriptor number for STERR?

A

the file descriptor number for STERR is two (2)

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

How is the file descriptor number for STERR used in redirection?

A

2>
Redirects STDERR.

2>&1
Redirects STDERR to the same destination as STDOUT.

Notice that this has to be used in combination with normal output redirection, as in ‘‘ls whuhiu > errout 2>&1.’’

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

In the Linux Filesystem Hierarchy Standard (FHS) what does / contain?

A

The / specifies the root directory. This is where the file system tree starts.

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

In the Linux Filesystem Hierarchy Standard (FHS) what does /boot contain?

A

/boot contains all files and directories that are needed to boot the Linux kernel.

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

In the Linux Filesystem Hierarchy Standard (FHS) what does /boot/EFI contain?

A

/boot/EFI contains all files and directories that are needed to boot the Linux kernel.

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

In the Linux Filesystem Hierarchy Standard (FHS) what does /dev contain?

A

/dev contains device files that are used for accessing physical devices. This directory is essential during boot.

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

In the Linux Filesystem Hierarchy Standard (FHS) what does /etc contain?

A

/etc contains configuration files that are used by programs and services on your server. This directory is essential during boot.

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

In the Linux Filesystem Hierarchy Standard (FHS) what does /home contain?

A

/home contains local user home directories.

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

In the Linux Filesystem Hierarchy Standard (FHS) what do /media and /mnt contain?

A

/media and /mnt contain directories that are used for mounting devices in the file system tree.

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

In the Linux Filesystem Hierarchy Standard (FHS) what does /opt contain?

A

/opt contains optional packages that may be installed on your server.

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

In the Linux Filesystem Hierarchy Standard (FHS) what does /proc contain?

A

/proc is used by the proc file system. This is a file system structure that gives access to kernel information.

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

In the Linux Filesystem Hierarchy Standard (FHS) what does /root contain?

A

/root is the home directory of the root user.

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

In the Linux Filesystem Hierarchy Standard (FHS) what does /run contain?

A

/run contains process and user-specific information that has been created since the last boot.

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

In the Linux Filesystem Hierarchy Standard (FHS) what does /srv contain?

A

/srv may be used for data by services like NFS, FTP, and HTTP.

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

In the Linux Filesystem Hierarchy Standard (FHS) what is /sys used for?

A

/sys is used as an interface to different hardware devices that are managed by the Linux kernel and associated processes.

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

In the Linux Filesystem Hierarchy Standard (FHS) what does / represent?

A

The / specifies the root directory. This is where the file system tree starts.

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

In the Linux Filesystem Hierarchy Standard (FHS) what does /usr contain?

A

/usr contains subdirectories with program files, libraries for these program files, and documentation about them.

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

In the Linux Filesystem Hierarchy Standard (FHS) what does /var contain?

A

/var contains files that may change in size dynamically, such as log files, mail boxes, and spool files.

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

Regular Expressions

What does the regex ^text do?

A

The regex ^text matches line that starts with specified text.

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

Regular Expressions

What does the regex text$ do?

A

The regex text$ matches line that ends with specified text.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
# Regular Expressions What does the regex **.** do?
The regex **.** matches any single character (wildcard).
26
# Regular Expressions What does the regex **[abc]** do?
The regex **[abc]** matches a, b, or c.
27
# Regular Expressions What does the regex **?** do?
The regex **?** is an extended regular expression that matches zero or one of the preceding character.
28
# Regular Expressions What does the regex **+** do?
The regex **+** is an extended regular expression that matches one or more of the preceding character.
29
# Regular Expressions What does the regex **`*`** do?
The regex **`*`** matches zero to an infinite number of the previous character..
30
# Regular Expressions What does the regex **`\{2\}`** do?
The regex **`\{2\}`** matches exactly two of the previous character.
31
# Regular Expressions What does the regex **`\{1,3\}`** do?
The regex **`\{1,3\}`** matches a minimum of one and a maximum of three of the previous character.
32
# Regular Expressions What does the regex **`colou?r`** do?
The regex **`colou?r`** matches zero or one of the previous character. This makes the previous character optional, which in this example would match both color and colour.
33
# Regular Expressions What does the regex **`(…)`** do?
The regex **`(…)`** is used to group multiple characters so that the regular expression can be applied to the group.
34
What command can be used to force a reset of a Linux machine?
To force a machine to reset, from a root shell you can type **echo b > /proc/sysrq-trigger**. This command immediately resets the machine without saving anything. Notice that this command should be used only if there are no other options!
35
You want to set a local variable that will be available for every user in every shell. Which of the following files should you use?
**/etc/bashrc** is processed when a subshell is started, and it is included while starting a login shell as well.
36
What file is used to display a message to a user during (before) logon?
**/etc/issue**
37
What file is used to display a message to a user upon (after) logon?
**/etc/motd**
38
You are using man -k user, but you get the message “nothing appropriate.” Which of the following solutions is most likely to fix this for you?
**sudo mandb**
39
What is the name of the file where Bash stores its history?
**~/.bash_history**
40
What command can be used to show to first 10 lines of a text file?
**head**
41
What command can be used to show to last 10 lines of a text file?
**tail**
42
What is **less** command used for?
**less** opens the text file in a pager, which allows for easy reading
43
What is the **grep** option **-i** used for?
-i matches upper- and lowercase letters (i.e., not case sensitive).
44
What is the **grep** option **-v** used for?
-v shows only lines that do not contain the regular expression.
45
What is the **grep** option **-r** used for?
-r searches files in the current directory and all subdirectories.
46
What is the **grep** option **-e** used for?
-e searches for lines matching more than one regular expression. Use -e before each regular expression you want to use.
47
What is the **grep** option **-E** used for?
-E interprets the search pattern as an extended regular expression.
48
What is the **grep** option **-A ``** used for?
**-A ``** shows `` of lines after the matching regular expression.
49
What is the **grep** option **-B ``** used for?
**-A ``** shows `` of lines before the matching regular expression.
50
What is the **rync** option **-r** used for?
**-r** synchronizes the entire directory tree
51
What is the **rync** option **-l** used for?
**-l** copies symbolic links as symbolic links
52
What is the **rync** option **-p** used for?
**-p** preserves permissions
53
What is the **rync** option **-n** used for?
**-n** performs only a dry run, not actually synchronizing anything
54
What is the **rync** option **-a** used for?
**-a** uses archive mode, thus ensuring that entire subdirectory trees and all file properties will be synchronized
55
What is the **rync** option **-A** used for?
**-A** uses archive mode, and in addition synchronizes ACLs
56
What is the **rync** option **-X** used for?
**-X** synchronizes SELinux context as well
57
What is **su**?
The **su** command opens a subshell as a different user, with the advantage that commands are executed as root only in the subshell
58
What is **sudo**?
The sudo command allows authorized users to work with administrator privileges.
59
What is PolicyKit (**Polkit**) used for?
PolicyKit (Polkit) enables you to set up graphical utilities to run with administrative privileges
60
What can a **user** with **read permissions** do at a **file** and **directory** level?
**Files:** View file content **Directory:** List contents of directory
61
What can a **user** with **write permissions** do at a **file** and **directory** level?
**Files:** Change contents of a file **Directory:** Create and delete files
62
What can a **user** with **execute permissions** do at a **file** and **directory** level?
**Files:** Run a program file **Directory:** Change to the directory
63
What is the **numeric representation** of the **read permission**?
4
64
What is the **numeric representation** of the **write permission**?
2
65
What is the **numeric representation** of the **execute permission**?
1
66