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
Q

Regular Expressions

What does the regex . do?

A

The regex . matches any single character (wildcard).

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

Regular Expressions

What does the regex [abc] do?

A

The regex [abc] matches a, b, or c.

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

Regular Expressions

What does the regex ? do?

A

The regex ? is an extended regular expression that matches zero or one of the preceding character.

28
Q

Regular Expressions

What does the regex + do?

A

The regex + is an extended regular expression that matches one or more of the preceding character.

29
Q

Regular Expressions

What does the regex * do?

A

The regex * matches zero to an infinite number of the previous character..

30
Q

Regular Expressions

What does the regex \{2\} do?

A

The regex \{2\} matches exactly two of the previous character.

31
Q

Regular Expressions

What does the regex \{1,3\} do?

A

The regex \{1,3\} matches a minimum of one and a maximum of three of the previous character.

32
Q

Regular Expressions

What does the regex colou?r do?

A

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
Q

Regular Expressions

What does the regex (…) do?

A

The regex (…) is used to group multiple characters so that the regular expression can be applied to the group.

34
Q

What command can be used to force a reset of a Linux machine?

A

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
Q

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?

A

/etc/bashrc is processed when a subshell is started, and it is included while starting a login shell as well.

36
Q

What file is used to display a message to a user during (before) logon?

A

/etc/issue

37
Q

What file is used to display a message to a user upon (after) logon?

A

/etc/motd

38
Q

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?

A

sudo mandb

39
Q

What is the name of the file where Bash stores its history?

A

~/.bash_history

40
Q

What command can be used to show to first 10 lines of a text file?

A

head

41
Q

What command can be used to show to last 10 lines of a text file?

A

tail

42
Q

What is less command used for?

A

less opens the text file in a pager, which allows for easy reading

43
Q

What is the grep option -i used for?

A

-i matches upper- and lowercase letters (i.e., not case sensitive).

44
Q

What is the grep option -v used for?

A

-v shows only lines that do not contain the regular expression.

45
Q

What is the grep option -r used for?

A

-r searches files in the current directory and all subdirectories.

46
Q

What is the grep option -e used for?

A

-e searches for lines matching more than one regular expression. Use -e before each regular expression you want to use.

47
Q

What is the grep option -E used for?

A

-E interprets the search pattern as an extended regular expression.

48
Q

What is the grep option -A <number> used for?

A

-A <number> shows <number> of lines after the matching regular expression.

49
Q

What is the grep option -B <number> used for?

A

-A <number> shows <number> of lines before the matching regular expression.

50
Q

What is the rync option -r used for?

A

-r synchronizes the entire directory tree

51
Q

What is the rync option -l used for?

A

-l copies symbolic links as symbolic links

52
Q

What is the rync option -p used for?

A

-p preserves permissions

53
Q

What is the rync option -n used for?

A

-n performs only a dry run, not actually synchronizing anything

54
Q

What is the rync option -a used for?

A

-a uses archive mode, thus ensuring that entire subdirectory trees and all file properties will be synchronized

55
Q

What is the rync option -A used for?

A

-A uses archive mode, and in addition synchronizes ACLs

56
Q

What is the rync option -X used for?

A

-X synchronizes SELinux context as well

57
Q

What is su?

A

The su command opens a subshell as a different user, with the advantage that commands are executed as root only in the subshell

58
Q

What is sudo?

A

The sudo command allows authorized users to work with administrator privileges.

59
Q

What is PolicyKit (Polkit) used for?

A

PolicyKit (Polkit) enables you to set up graphical utilities to run with administrative privileges

60
Q

What can a user with read permissions do at a file and directory level?

A

Files: View file content
Directory: List contents of directory

61
Q

What can a user with write permissions do at a file and directory level?

A

Files: Change contents of a file
Directory: Create and delete files

62
Q

What can a user with execute permissions do at a file and directory level?

A

Files: Run a program file
Directory: Change to the directory

63
Q

What is the numeric representation of the read permission?

A

4

64
Q

What is the numeric representation of the write permission?

A

2

65
Q

What is the numeric representation of the execute permission?

A

1

66
Q
A