Linux Midterm Notes

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/127

encourage image

There's no tags or description

Looks like no tags are added yet.

128 Terms

1
New cards

In what year was UNIX created, at what lab, and by whom?

1969; AT&T Bell Labs; Ken Thompson and Dennis Ritchie.

2
New cards

Is the term UNIX trademarked, and who certifies compliance?

Yes, UNIX is a trademarked specification certified by The Open Group consortium.

3
New cards

What are the two major historical branches of UNIX?

System V (SysV) and BSD (Berkeley Software Distribution).

4
New cards

In what year was MINIX created, by whom, and what was its original design purpose?

1987; Andrew Tanenbaum; created for educational operating systems instruction (16-bit microkernel architecture).

5
New cards

In what year was Linux created, by whom, and what architecture did it originally target?

1991; Linus Torvalds; 32-bit architecture targeting the Intel 80386 processor.

6
New cards

What organization did Richard Stallman found, and what project provided the userland tools for Linux?

Free Software Foundation (FSF); the GNU Project (GNU's Not Unix).

7
New cards

What package management format and frontend tools are used by Red Hat/CentOS/Rocky/Fedora?

RPM package format; frontend tools are dnf and yum.

8
New cards

What package management format and frontend tools are used by Debian/Ubuntu?

.deb package format; frontend tools are apt and dpkg.

9
New cards

What package management format and tool is used by openSUSE?

RPM package format; frontend tool is zypper.

10
New cards

What are the three components of standard Linux command line grammar?

command [options/switches] [arguments]

11
New cards

How do short options differ from long options in syntax?

Short options begin with a single hyphen (-) and are single letters; long options begin with double hyphens (--) and use full words.

12
New cards

Can multiple short options without arguments be combined under a single hyphen?

Yes (e.g., ls -l -a can be written as ls -la or ls -al).

13
New cards

In command line grammar, what part of speech is a command analogous to?

A verb (an action).

14
New cards

In command line grammar, what part of speech is an option/switch analogous to?

An adverb or adjective (modifies how the action is performed).

15
New cards

In command line grammar, what part of speech is an argument analogous to?

A noun or direct object (the target acted upon, such as a file or directory).

16
New cards

If a short option takes an argument (such as -w 40), is a space required between the option and its argument?

No, a space is optional; both -w 40 and -w40 are valid.

17
New cards

How do you pass arguments to long options?

Using an equals sign or a space (e.g., --width=40 or --width 40).

18
New cards

What does the Bash command 'history 5' display?

Displays the last 5 commands executed from the history buffer.

19
New cards

What does the Bash shortcut '!!' do?

Re-executes the immediately preceding command line.

20
New cards

What does the Bash shortcut '!n' do (where n is a number)?

Re-executes command line number n from the history list.

21
New cards

What does the Bash shortcut '!-n' do (where n is a number)?

Re-executes the command n lines back from the bottom of history.

22
New cards

What does the Bash shortcut '!cat' do?

Re-executes the most recent command starting with the string 'cat'.

23
New cards

What Bash editing shortcut jumps the cursor directly to the beginning of the line?

Ctrl + A

24
New cards

What Bash editing shortcut jumps the cursor directly to the end of the line?

Ctrl + E

25
New cards

What Bash editing shortcut deletes/cuts text from the cursor position to the start of the line?

Ctrl + U

26
New cards

What Bash editing shortcut deletes/cuts text from the cursor position to the end of the line?

Ctrl + K

27
New cards

What Bash keyboard shortcut aborts, cancels, or sends SIGINT to the current foreground process?

Ctrl + C

28
New cards

What Bash keyboard shortcut clears the terminal screen buffer?

Ctrl + L (equivalent to typing 'clear').

29
New cards

What Bash editing shortcut moves forward one character?

Ctrl + F (or Right Arrow).

30
New cards

What Bash editing shortcut moves backward one character?

Ctrl + B (or Left Arrow).

31
New cards

In which directory hierarchy are system manual pages stored?

/usr/share/man

32
New cards

What category of documentation is contained in Section 1 of the man pages?

User shell commands and executable programs (e.g., ls, pwd, cat, date).

33
New cards

What category of documentation is contained in Section 5 of the man pages?

File formats and configuration file specifications (e.g., /etc/passwd, /etc/shadow).

34
New cards

What category of documentation is contained in Section 8 of the man pages?

System administration and root-only maintenance commands (e.g., useradd, fdisk).

35
New cards

What is the difference between running 'man passwd' and 'man 5 passwd'?

'man passwd' defaults to Section 1 (the user command to change passwords); 'man 5 passwd' opens Section 5 (the syntax of the /etc/passwd config file).

36
New cards

How do you initiate a forward text search inside a man page?

Type / followed by the search pattern, then press Enter.

37
New cards

How do you initiate a backward text search inside a man page?

Type ? followed by the search pattern, then press Enter.

38
New cards

While searching in a man page, what keystroke moves to the next occurrence in the same direction?

n (lowercase n).

39
New cards

While searching in a man page, what keystroke moves to the previous occurrence (opposite direction)?

N (uppercase N).

40
New cards

What keystrokes jump directly to the top and bottom of a man page?

1G (or g) jumps to the top; G jumps to the bottom.

41
New cards

What keystroke exits a man page viewer and returns to the shell?

q

42
New cards

What command searches the short descriptions inside man pages for a keyword (equivalent to 'man -k')?

apropos

43
New cards

What command displays a one-line summary from man page header descriptions (equivalent to 'man -f')?

whatis

44
New cards

What command provides built-in documentation for Bash internal commands (like cd, history, pwd)?

help (e.g., help cd)

45
New cards

What is the top-level parent directory of the entire Linux filesystem tree?

/ (the root directory).

46
New cards

What is stored inside the /boot directory?

Linux kernel images (vmlinuz), initial RAM disk (initramfs), and GRUB bootloader configuration files.

47
New cards

What is stored inside the /dev directory?

Device nodes/special files used by the OS to communicate with physical/virtual hardware (e.g., /dev/sda, /dev/null, /dev/zero).

48
New cards

What is stored inside the /etc directory?

Host-specific, static, system-wide text configuration files that persist across system reboots.

49
New cards

What type of data is stored in /var?

Variable data dynamically written during operations (logs in /var/log, spool files, databases, mail).

50
New cards

What is stored inside the /run directory, and what happens to it on reboot?

Volatile runtime process state data (PID files, sockets); stored in RAM (tmpfs) and completely wiped upon reboot.

51
New cards

What is stored inside the /usr directory?

Installed user-space programs, libraries, shared data, and system documentation (/usr/share).

52
New cards

Where are /bin and /sbin located on modern RHEL/CentOS systems?

They are symbolic links pointing to /usr/bin and /usr/sbin.

53
New cards

What distinguishes commands in /sbin from those in /bin?

/bin contains general user commands; /sbin contains system administration commands intended for the superuser (root).

54
New cards

What are the defining characteristics of an absolute pathname?

It begins with / (root) or ~ (tilde); it resolves unambiguously from anywhere in the filesystem.

55
New cards

What are the defining characteristics of a relative pathname?

It never begins with / or ~; its resolution depends entirely on the current working directory (pwd).

56
New cards

What does a single dot (.) represent in Linux path syntax?

The current working directory (pwd).

57
New cards

What does double dots (..) represent in Linux path syntax?

The immediate parent directory of the current directory.

58
New cards

What does 'cd -' do in Bash?

Changes the working directory to the previous working directory ($OLDPWD).

59
New cards

What does 'cd' or 'cd ~' without arguments do in Bash?

Changes the working directory to the current user's home directory ($HOME).

60
New cards

If 'cp' is given 3 or more arguments (e.g., cp file1 file2 /target/), what must the final argument be?

An existing directory.

61
New cards

What switch must be passed to 'cp' to copy an entire directory tree recursively?

-r or -R (recursive).

62
New cards

What does the 'cp -p' switch do?

Preserves file attributes (timestamps, ownership, and permission mode bits).

63
New cards

What happens if you run 'mv file1 file2' when file2 does not exist?

It renames file1 to file2.

64
New cards

What happens if you run 'mv file1 file2' when file2 is an existing directory?

It moves file1 into the directory file2/ without renaming it.

65
New cards

Does the 'mv' command require a recursive switch (-r) to move a directory?

No, mv moves or renames directories without any special switches.

66
New cards

What does 'mkdir -p /a/b/c' do?

Creates the leaf directory /c along with any missing parent directories (/a, /b) without returning an error.

67
New cards

Under what condition will the 'rmdir' command fail?

When the specified directory contains any files or subdirectories (it is not empty).

68
New cards

What command deletes a non-empty directory and all nested contents without any interactive prompting?

rm -rf

69
New cards

What does the wildcard asterisk (*) match in Bash file globbing?

Zero or more characters (any characters except a leading dot for hidden files).

70
New cards

What does the wildcard question mark (?) match in Bash file globbing?

Exactly one single character.

71
New cards

Does 'ls *' display hidden files? Why or why not?

No; in Linux hidden files begin with a dot (.), and wildcards do not match a leading dot unless explicitly specified (e.g., .*).

72
New cards

What does the file globbing pattern 'ls [abc]*' match?

Any visible file whose filename begins with lowercase a, b, or c.

73
New cards

What does the file globbing pattern 'ls [!abc]' or 'ls [^abc]' match?

Any visible file whose filename does NOT begin with a, b, or c.

74
New cards

What does the file globbing pattern 'ls [a-z]*' match?

Any visible file whose name begins with any lowercase letter from a through z.

75
New cards

What does the file globbing pattern '???' match?

Any visible filename that consists of exactly three characters.

76
New cards

What globbing pattern matches files with exactly 7 characters where the middle character is a lowercase vowel?

???[aeiou]???

77
New cards

What globbing pattern matches visible filenames that contain the character 'p' anywhere in the name?

p

78
New cards

What globbing pattern matches visible filenames that end with the letter 'z'?

*z

79
New cards

How do you match hidden files ending with the letter 'p'?

.*p

80
New cards

What are the two syntaxes for command substitution in Bash?

Modern syntax: $(command) | Legacy syntax: command (backticks).

81
New cards

What does Tilde Expansion '~' evaluate to?

The absolute path of the current user's home directory ($HOME).

82
New cards

What does '~username' evaluate to in Bash?

The absolute path of the specified user's home directory (e.g., /home/username).

83
New cards

What files are generated by running 'touch file{1..4}'?

file1, file2, file3, file4 (via Brace Expansion).

84
New cards

What files are generated by running 'touch file{a,b}{1,2}.txt'?

filea1.txt, filea2.txt, fileb1.txt, fileb2.txt.

85
New cards

How do hard links and symbolic (soft) links compare regarding inode allocation?

A hard link shares the exact same inode number as the target; a symbolic link receives its own unique inode containing the target's path string.

86
New cards

Can hard links span across different physical partitions or filesystems?

No; hard links are restricted to a single filesystem because inode tables are per-filesystem.

87
New cards

Can symbolic (soft) links point across different physical partitions or filesystems?

Yes, symbolic links store a path string and can freely span filesystems.

88
New cards

Can a regular user create a hard link pointing to a directory?

No; hard links to directories are disallowed to prevent circular directory loops.

89
New cards

Can a symbolic link point to a directory?

Yes (e.g., ln -s /tmp /home/user/mytemp).

90
New cards

What is a 'dangling link' in Linux?

A symbolic link whose target file or directory has been deleted or moved.

91
New cards

What happens to data on disk when the original name of a hard-linked file is removed with 'rm'?

The data remains fully accessible via the remaining hard link as long as the inode link count is 1 or higher.

92
New cards

What command is used to remove a symbolic link?

rm (deletes the link itself, never the original target).

93
New cards

What command creates a symbolic link named 'myconfig' pointing to '/etc/hosts'?

ln -s /etc/hosts myconfig.

94
New cards

What are the three standard POSIX I/O streams and their integer file descriptors?

0: stdin (Standard Input); 1: stdout (Standard Output); 2: stderr (Standard Error).

95
New cards

What is the default device source for stdin, and default destination for stdout and stderr?

stdin defaults to the keyboard; stdout and stderr default to the terminal screen.

96
New cards

What is the difference between '>' and '>>' redirection operators?

'>' redirects stdout and overwrites the destination file; '>>' redirects stdout and appends to the end of the file.

97
New cards

What command line syntax redirects only Standard Error (stderr) to a file named 'errors.log'?

command 2> errors.log.

98
New cards

What is '/dev/null' and why is it used in redirection?

The null device / bit bucket; any data redirected into it (e.g., 2> /dev/null) is discarded permanently.

99
New cards

What are the two valid syntaxes to redirect both stdout and stderr into the same file?

command &> file OR command > file 2>&1.

100
New cards

What syntax redirects stdout to 'out.txt' and stderr to 'err.txt' simultaneously?

command > out.txt 2> err.txt.