Linux Flashcards

1
Q

How do PAM (Pluggable Authentication Modules) function in a Linux system?

A

PAM is a framework that allows system administrators to define authentication policies without having to recompile programs that handle authentication.

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

Display server protocols

A

Display server protocols work as an protocol between window manager and the kernel. It funnels all input from user to the right programs and all the graphical output from the programs to the kernel.

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

What are kernel space and user space in Linux, and what is their significance?

A

Kernel space is where the kernel (core of the operating system), kernel extensions, and most device drivers execute. It has unrestricted access to the system’s hardware and its memory is directly addressable, meaning the kernel can read and write to any physical address in memory. In contrast, user space is where applications perform tasks. These applications have restricted access and can’t directly interact with hardware or memory, instead, they use system calls to request services from the kernel. This separation ensures system stability and security, as faulty or malicious user-space processes cannot interfere with other processes or the kernel itself.

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

How does the Linux kernel handle process scheduling?

A

The Linux kernel allocates a time slice to each process. It hands the control of the CPU to a program for a pre-determined time slice. After the time is up, it takes back control, saves the state of the program to memory (a process called a context switch), and selects a new program to hand the CPU to.

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

What are the different types of devices in Linux?

A

The different types of devices in Linux include Block devices, Character devices, Pipe devices, and Socket devices.

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

How do sysfs, devtmpfs, and udev work together in device management?

A

The kernel handles devtmpfs, which creates device files at boot and notifies udevd about them. Udev resides in user space and after it gets a message (uevent) from the kernel, it initializes those devices based on the uevent and the rules defined in /lib/udev/rules.d and /etc/udev/rules.d.

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

What are procfs and sysfs in Linux?

A

procfs and sysfs are virtual filesystems that exist only in memory. procfs provides a view into the state of the running processes, while sysfs provides information about devices.

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

What is a superblock in a filesystem?

A

A superblock is a data structure in a filesystem that contains metadata about the filesystem, such as its size, block size, empty and filled blocks, etc.

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

What are inodes and how do hard links and symbolic links relate to them?

A

Inodes store metadata about files. Hard links point to the same inode, effectively creating another name for the same file. Symbolic links, on the other hand, have their own inode and point to a file name, not an inode.

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

What is the role of ‘init’ in a Linux system?

A

‘init’ is the first process that starts in user space. It is the parent of all other processes and is responsible for starting all other processes on the system.

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

How does systemd manage dependencies between services?

A

systemd manages dependencies through directives in service unit files, such as Requires, Wants, Requisite, and Conflicts. These directives define the relationship and dependencies between units.

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

What is the purpose of cgroups in systemd?

A

cgroups (control groups) is a kernel feature that limits, accounts for, and isolates the resource usage (CPU, memory, disk I/O, etc.) of process groups.

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

What is the function of initramfs in the Linux boot process?

A

initramfs is a temporary filesystem used by the kernel during boot to load necessary drivers before the real root filesystem can be mounted.

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

What are page faults and how do they impact system performance?

A

A page fault occurs when a program tries to access a portion of memory that is not currently available in the system’s RAM. Minor page faults are relatively quick to fix, but major page faults require accessing the disk drive and can significantly impact system performance.

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

What is the purpose of the /etc/nsswitch.conf file?

A

It stands for ‘Name Service Switch’ and is used to determine the sources from which to obtain name-service information in a range of categories, and in what order. It configures the system behavior in a networked environment by specifying the order of services to be used for different types of lookups, like passwd, group, hosts, etc. Common service types include files, dns, nis, nisplus, ldap, winbind, myhostname, and db.

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

What is the purpose of the ARP table?

A

The ARP table is used to identify which MAC address matches which IPv4 address. For IPv6, this function is served by the NDP table.

17
Q

What is RPC?

A

RPC stands for Remote Procedure Call. It allows a program to cause a procedure (subroutine) to execute in another address space, commonly on another physical machine.

18
Q

What are Unix domain sockets?

A

Unix domain sockets are used for inter-process communication (IPC) and can be more efficient than using network sockets because they avoid the overhead of the IP protocol stack.

19
Q

What is a common method for handling multiple connections in web servers?

A

A common method is for the main program to use a listening socket on a port and, when it receives a connection, fork itself and attach the new connection to that fork.

20
Q

What is the purpose of the mktemp command?

A

mktemp is used to create a temporary file or directory with a unique name. It is safer than creating a file with a fixed name in the /tmp directory.

21
Q

How does the xargs command work?

A

xargs reads items from standard input and executes a command once for each item. It is useful when dealing with a large number of arguments that might exceed the limit imposed by the shell.

22
Q

What is SSHFS and when might it be useful?

A

SSHFS (SSH Filesystem) is a filesystem client that allows mounting of a remote filesystem through SSH. It can be useful for easy-to-set-up and simple file sharing between Linux hosts.

23
Q

What is the difference between login shells and non-login shells in terms of initialization files?

A

Login shells usually start when a user logs in to the system and read the .bash_profile file, while non-login shells are started afterward and read the .bashrc file.

24
Q

What is D-bus and what is it used for?

A

D-bus is an Inter-Process Communication (IPC) system that allows programs to communicate with each other. It is often used by desktop environments and system services for signaling events, such as device changes, network status changes, etc.

25
Q

What is the difference between static and shared libraries?

A

Static libraries are compiled directly into the binary file, resulting in a larger binary size, while shared libraries are shared across programs, resulting in a smaller binary size but requiring the shared library to be installed on the system where the binary is run.

26
Q

How does the ld.so dynamic linker/loader find shared libraries?

A

ld.so is responsible for finding correct libraries to use with binary files. ld.so first looks into the ‘rpath’ that is hardcoded into binaries. Secondly, it looks at caches that are configured in /etc/ld.so.conf and located in /etc/ld.so.cache. Thirdly, it looks at the LD_LIBRARY_PATH environment variable, which should be used only as a last resort or in an independent environment.

27
Q

What is the purpose of the make command in software development?

A

make is used to automate the compilation process. It has the ability to check which files were changed since the last compilation and only do the necessary updates.

28
Q

What is the purpose of the pkg-config command?

A

pkg-config is a program that helps to manage library compile and linker flags on your system. It provides the necessary flags for compiling and linking a program to a library.

29
Q

What is the difference between a Type 1 and a Type 2 hypervisor?

A

A Type 1 hypervisor runs directly on the host’s hardware to control the hardware and to manage guest operating systems. A Type 2 hypervisor runs on a conventional operating system (OS) just as other computer programs do.