Linux Core Concepts Flashcards

1
Q

Linux Memory is divided into two space, what are those two spaces?

A

Kernel Space and User space

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

What is Kernel Space in Linux Memory?

A

Kernel space is the portion of memory in
which the Kernel executes and provides its
services. A process running in the Kernel
space has unrestricted access to the hardware. As
such, it is strictly reserved for running the
Kernel code, Kernel extensions, and most
device drivers.

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

What is user space in Linux Memory?

A

All user programs function by manipulating
data, but where does this data live? Most
commonly, it is stored in memory and on
disk.
User programs get access to data by making
special requests to the Kernel called system
calls. Examples include allocating memory by
using variables or opening a file.

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

What is dmesg?

A

Dmesg is a tool used to display messages
from an area of the kernel called the ring
buffer. When a Linux operating system boots
up, there are numerous messages generated
by the kernel that appear on the display
screen.

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

what is the lspci command?

A

The Ispci command stands for list PCI. This
command is used to display information
about all PCI devices that are configured in
the system.
Examples of PCI devices are ethernet cards,
raid controllers, video cards, and wireless
adapters that directly attach to PCI slots in
the motherboard of the computer.

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

what is the lsblk command?

A

The Isblk command lists information about block devices. Here
sda is the physical disk.
The sda1 to sda5 are partitions created for
this disk.

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

what is the meaning of major and minor number in the output of lsblk?

A

In the lsblk command output, you can also see
that there are major and minor numbers
associated with each device. The major
number which is on the left-hand side of the
colon identifies the type of device driver associated
with the device. In this case, the number 8
refers to a block sdisk device.
The minor number is used to differentiate
amongst devices that are similar and share
the same major number. Here the numbers O
to 5, help identify the different partitions for
the disk sda.

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

Give some examples of Major numbers for some very common device types?

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

Command to display information about the CPU architecture?

A

lscpu

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

commands to check linux memory?

A

lsmem –summary
free -m (where m is show in MB, use -k for KB)

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

Popular example of a bootloader?

A

GRUB2 - Grand Unified Boot Loader - version 2

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

Can you list the Linux Boot sequence?

A

Step 1: BIOS POST
Step 2: Boot Loader (GRUB2)
Step 3: Kernel Initialization
Step 4: INIT process (systemd)

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

what does BIOS POST stand for?

A

Power on self test - POST is a test to ensure that the hardware components attached to the host are functioning correctly

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

What is the next step after POST in linux boot sequence?

A

Boot Loader - GRUB2

  1. The next stage after POST is the boot loader. After
    a successful POST test, the BIOS loads and
    executes the boot code from the boot device,
    which is located in the first sector of the hard disk.
  2. In Linux, this is located in the /Boot File System.
    The boot loader provides the user with the boot
    screen often with multiple options to boot into such as
    Microsoft Windows OS or an Ubuntu 18.04 OS, in
    an example of a dual boot system.
  3. Once the selection is made at the boot screen, the
    boot loader loads the kernel into memory, supplies
    it with some perimeters, and hands over the
    control to the kernel.
  4. A popular example of the boot loader is the
    GRUB2, which stands for Grand Unified
    Bootloader version 2, and it is now the primary
    boot loader for most current Linux distributions.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

what is the next step after boot loader in Linux boot sequence?

A

Kernel Initialization

  1. After the selected kernel is loaded into the
    memory, it is usually decompressed. This is done
    as the kernels are generally in a compressed state
    to conserve space.
  2. The kernel is then loaded into the memory and
    starts executing. During this space, the kernel
    carries out tasks such as initializing hardware and
    memory management tasks among other things.
  3. Once it is completely operational, the kernel looks
    for an init process to run, which sets up the user
    space and the processes needed for the user
    environment.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What is the next step after Kernel Initialization in linux boot sequence?

A

INIT Process (systemd)

Once the kernel is is completely operational after the kernel initialization step, the kernel looks
for an init process to run, which sets up the user
space and the processes needed for the user
environment.

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

In most of the linux distros, the INIT function then calls which daemon

A

INIT function calls the systemd daemon

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

what does the systemd daemon do?

A

Systemd is responsible for
- mounting file systems,
- starting and managing system services.

Systemd is the universal standard
these days but not too long ago another
initialization process called System V init was
used.

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

what is runlevel in linux?

A

runlevel is where you set the different options, like do you want to boot to a GUI or just CLI directly, there are different runlevels in linux

20
Q

What are the different runlevels?

A

In system D runlevels are called targets.
The runlevel 5 is called the graphical target and
runlevel 3 is called the multi-user target. There are
other run levels and targets in use
but these are the two that are most commonly
used.

21
Q

What are the different runlevels in linux?

A

runlevel 0 -> poweroff.target
runlevel 1 -> rescue.target
runlevel 2 -> multi-user.target
runlevel 3 -> multi-user.target
runlevel 4 -> multi-user.target
runlevel 5 -> graphical.target
runlevel 6 -> reboot.target

22
Q

Are runlevels and systemd-targets both the same?

A

The term runlevels is used in the sysV init systems. These have been replaced by systemd targets in systemd based systems.

23
Q

How to view and change the systemd-targets?

A

systemctl get-default
Is -Itr /etc/systemd/system/default.target
systemctl set-default multi-user.target

24
Q

What are the different types of files in linux?

A

There are three types of files,
- regular,
- directory
- special files

Regular files - these are the most common type of files that contains some text, data or images.
Examples are configuration files, shell scripts
or code, JPG files, et cetera.

Directory - type of file as well that stores other files and
directories within. The simplest example of this is your home directory.

Special files can be subcategorized
into five other file types. Character files.
These files represent devices under the /dev
file system that allows the OS to communicate

25
Q

There are three file types in linux, regular, directory and special files, What are regular files in linux?

A

Regular files - these are the most common type of files that contains some text, data or images.
Examples are configuration files, shell scripts
or code, JPG files, et cetera.

26
Q

There are three file types in linux, regular, directory and special files, What are directory files in linux?

A

Directory - type of file as well that stores other files and
directories within. The simplest example of this is your home directory.

27
Q

There are three file types in linux, regular, directory and special files, What are special files in linux?

A

Special files can be subcategorized
into five other file types.

Character files - These files represent devices under the /dev file system that allows the OS to communicate with the IO devices serially.

Block files - These are files representing block devices
also located under /dev. We saw these when
we learned about the Isblk command. In
simple terms, a block device reads from and writes to the device in blocks or a chunk of data. Examples of a block device are hard disks and RAM.

Links - Links in Linux is a way to associate two or
more file names to the same set of file data.
There are two types of links.

28
Q

What are the subcategories or types of special files in linux?

A
  1. Character files
  2. Block files
  3. Links
  4. Socket files
  5. Named pipes
29
Q

There are three file types in linux, regular, directory and special files, and don’t sub category or type of a special file is called Links. What is Links

A

Links in Linux is a way to associate two or
more file names to the same set of file data.
There are two types of links.
- Hard links
- Symbolic Links

30
Q

What are the different types of Links in linux?

A

Hard Links & Symbolic Links

31
Q

What is a Hard link ?

A

The hard link associates two or more file
names that share the same block of data on
the physical disk. Although they behave as
independent files, deleting one link will delete the data.

32
Q

What is a symbolic link ?

A

The symbolic link or symlink can be loosely
compared to a shortcut in Windows.
They act as pointers to another file. Deleting
a symlink does not affect the data in the
actual file.

33
Q

What is a Socket file in special file types in linnux?

A

A socket is a special file that enables the communication between two processes.

34
Q

What are Named pipes in special file types in linux?

A

Named pipes. This is a special type of
file that allows connecting one process as an
input to another. The data flow in a pipe is
unidirectional from the first process to the
second.

35
Q

An image or diagram to show different file types in linux?

A
36
Q

How to determine the type of a file in linux?

A

Using “file” command or -l flag with ls command

37
Q

Use the -l option with ls command to see the type of the file. What are the different letters used for different file types in output of ls -l command ?

A
38
Q

Where is the root users home directory? And where are other user’s home directory?

A

/root for root user and for all other users, it is in /home/<username></username>

39
Q

If we want to install any 3rd party applications, where which directory would we put those in ?

A

/opt

40
Q

which directory is used to mount external filesystem temporarily?

A

/mnt

41
Q

which directory to are all the external media mounted? like when USB is plugged in?

A

/media

42
Q

Command that prints out details about all the mounted filesystem?

A

df - disk filesystem

eg. df -hP

43
Q

which directory contains the files for devices such as external hard disks and devices such as keyboard and mouses?

A

/dev

44
Q

Which direcroty are the basic programs and binaries located?

A

/bin
Like the cp, mv, mkdir, date etc.

45
Q

Where are most of the configuration files saved in ?

A

/etc

46
Q

Where which path store the shared libraries which can be imported into the programs?

A

/lib and /lib64

47
Q

Which is the directory to which the system writes data
such as logs and cached data.

A

/var file system