---
obj: os
wiki: https://en.wikipedia.org/wiki/Linux
website: https://www.kernel.org
---

# Linux
Linux is a kernel and computing platform.
It support virtually every [filesystem](filesystems/Filesystems.md). Linux has many distributions, such as [Arch Linux](Arch%20Linux.md) or [Alpine Linux](Alpine%20Linux.md), [Proxmox](Proxmox.md), etc.
The default init system is [Systemd](systemd/Systemd.md). See [mkinitcpio](mkinitcpio.md) for other boot time configuration.
Linux has GUIs but is generally used with the [Shell](../applications/cli/Shell.md). The kernel development can be tracked [here](https://kernel.org)

## Filesystem Structure
A typical Linux system has, among others, the following directories:

| Path             | Description                                                                                                                                                                                                                                                            |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `/`              | This is the root directory. This is where the whole tree starts.                                                                                                                                                                                                       |
| `/bin`           | This directory contains executable programs which are needed in single user mode and to bring the system up or repair it.                                                                                                                                              |
| `/boot`          | Contains static files for the boot loader. This directory holds only the files which are needed during the boot process. The operating system kernel (initrd for example) must be located in either `/` or `/boot`.                                                    |
| `/dev`           | Special or device files, which refer to physical devices.                                                                                                                                                                                                              |
| `/etc`           | Contains configuration files which are local to the machine.                                                                                                                                                                                                           |
| `/home`          | On machines with home directories for users, these are usually beneath this directory, directly or not.                                                                                                                                                                |
| `/lib`           | This directory should hold those shared libraries that are necessary to boot the system and to run the commands in the root filesystem.                                                                                                                                |
| `/lib/modules`   | Loadable kernel modules (optional)                                                                                                                                                                                                                                     |
| _`/lost+found`_  | This comes from [Ext4](filesystems/Ext4.md). This directory contains items lost in the filesystem.                                                                                                                                                                     |
| `/media`         | This directory contains mount points for removable media such as CD and DVD disks or USB sticks.                                                                                                                                                                       |
| `/mnt`           | This directory is a mount point for a temporarily mounted filesystem.                                                                                                                                                                                                  |
| `/proc`          | This is a mount point for the _proc_ filesystem, which provides information about running processes and the kernel.                                                                                                                                                    |
| `/root`          | This directory is usually the home directory for the root user (optional).                                                                                                                                                                                             |
| `/run`           | This directory contains information which describes the system since it was booted. Once this purpose was served by `/var/run` and programs may continue to use it.                                                                                                    |
| `/sbin`          | Like `/bin`, this directory holds commands needed to boot the system, but which are usually not executed by normal users.                                                                                                                                              |
| `/sys`           | This is a mount point for the _sysfs_ filesystem, which provides information about the kernel like _/proc_, but better structured, following the formalism of kobject infrastructure.                                                                                  |
| `/tmp`           | This directory contains temporary files which may be deleted with no notice, such as by a regular job or at system boot up.                                                                                                                                            |
| `/usr`           | This directory is usually mounted from a separate partition. It should hold only shareable, read-only data, so that it can be mounted by various machines running Linux.                                                                                               |
| `/usr/bin`       | This is the primary directory for executable programs. Most programs executed by normal users which are not needed for booting or for repairing the system and which are not installed locally should be placed in this directory.                                     |
| `/usr/etc`       | Site-wide configuration files to be shared between several machines may be stored in this directory. However, commands should always reference those files using the `/etc` directory. Links from files in `/etc` should point to the appropriate files in `/usr/etc`. |
| `/usr/include`   | Include files for the C compiler.                                                                                                                                                                                                                                      |
| `/usr/lib`       | Object libraries, including dynamic libraries, plus some executables which usually are not invoked directly. More complicated programs may have whole subdirectories there.                                                                                            |
| `/usr/share`     | This directory contains subdirectories with specific application data, that can be shared among different architectures of the same OS.                                                                                                                                |
| `/usr/share/doc` | Documentation about installed programs (optional).                                                                                                                                                                                                                     |
| `/usr/share/man` | [Manual pages](../applications/cli/system/man.md) go here in subdirectories according to the man page sections.                                                                                                                                                        |
| `/var`           | This directory contains files which may change in size, such as spool and [log](../dev/Log.md) files.                                                                                                                                                                  |
| `/var/cache`     | Data cached for programs.                                                                                                                                                                                                                                              |
| `/var/log`       | Miscellaneous [log](../dev/Log.md) files.                                                                                                                                                                                                                              |
## Kernel Commandline
The kernel, the programs running in the initrd and in the host system may be configured at boot via kernel command line arguments.

The current cmdline can be seen at `/proc/cmdline`.
For setting the cmdline use `/etc/kernel/cmdline` if you use UKIs.

**Common Kernel Cmdline Arguments:**

| Argument                                                                                               | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------------------------------------------------------------------------------------------ |   |
| `quiet`                                                                                                | Parameter understood by both the kernel and the system and service manager to control console log verbosity.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `splash`                                                                                               | Show a plymouth splash screen while booting.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `init=`                                                                                                | This sets the initial command to be executed by the kernel. If this is not set, or cannot be found, the kernel will try `/sbin/init`, then `/etc/init`, then `/bin/init`, then `/bin/sh` and panic if all of this fails.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `ro` and `rw`                                                                                          | The `ro` option tells the kernel to mount the root filesystem as 'read-only'. The `rw` option tells the kernel to mount the root filesystem read/write. This is the default.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `resume=...`                                                                                           | This tells the kernel the location of the suspend-to-disk data that you want the machine to resume from after hibernation. Usually, it is the same as your swap partition or file. Example: `resume=/dev/hda2`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `panic=N`                                                                                              | By default, the kernel will not reboot after a panic, but this option will cause a kernel reboot after `N` seconds (if `N` is greater than zero). This panic timeout can also be set by `echo N > /proc/sys/kernel/panic`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `plymouth.enable=`                                                                                     | May be used to disable the Plymouth boot splash. For details, see plymouth.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `vconsole.keymap=, vconsole.keymap_toggle=, vconsole.font=, vconsole.font_map=, vconsole.font_unimap=` | Parameters understood by the virtual console setup logic. For details, see `vconsole.conf`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `luks=, rd.luks=`                                                                                      | Defaults to "yes". If "no", disables the crypt mount generator entirely. `rd.luks=` is honored only in the initrd while `luks=` is honored by both the main system and in the initrd.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `luks.crypttab=, rd.luks.crypttab=`                                                                    | Defaults to "yes". If "no", causes the generator to ignore any devices configured in `/etc/crypttab` (`luks.uuid=` will still work however). `rd.luks.crypttab=` is honored only in initrd while `luks.crypttab=` is honored by both the main system and in the initrd.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `luks.uuid=, rd.luks.uuid=`                                                                            | Takes a LUKS superblock UUID as argument. This will activate the specified device as part of the boot process as if it was listed in `/etc/crypttab`. This option may be specified more than once in order to set up multiple devices. `rd.luks.uuid=` is honored only in the initrd, while `luks.uuid=` is honored by both the main system and in the initrd.                                                                                                                                                                                                                                                                                                                                                                                         |
| `luks.name=, rd.luks.name=`                                                                            | Takes a LUKS super block UUID followed by an `=` and a name. This implies `rd.luks.uuid=` or `luks.uuid=` and will additionally make the LUKS device given by the UUID appear under the provided name. `rd.luks.name=` is honored only in the initrd, while `luks.name=` is honored by both the main system and in the initrd.                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `luks.options=, rd.luks.options=`                                                                      | Takes a LUKS super block UUID followed by an `=` and a string of options separated by commas as argument. This will override the options for the given UUID. If only a list of options, without a UUID, is specified, they apply to any UUIDs not specified elsewhere, and without an entry in `/etc/crypttab`. `rd.luks.options=` is honored only by initial RAM disk (initrd) while `luks.options=` is honored by both the main system and in the initrd.                                                                                                                                                                                                                                                                                            |
| `fstab=, rd.fstab=`                                                                                    | Defaults to "yes". If "no", causes the generator to ignore any mounts or swap devices configured in `/etc/fstab`. `rd.fstab=` is honored only in the initrd, while `fstab=` is honored by both the main system and the initrd.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `root=`                                                                                                | Configures the operating system's root filesystem to mount when running in the initrd. This accepts a device node path (usually `/dev/disk/by-uuid/...` or similar), or the special values `gpt-auto`,  `fstab`, and `tmpfs`. Use `gpt-auto` to explicitly request automatic root file system discovery via `systemd-gpt-auto-generator`. Use `fstab` to explicitly request automatic root file system discovery via the initrd `/etc/fstab` rather than via kernel command line. Use `tmpfs` in order to mount a tmpfs file system as root file system of the OS. This is useful in combination with `mount.usr=` in order to combine a volatile root file system with a separate, immutable `/usr/` file system. Also see `systemd.volatile=` below. |
| `rootfstype=`                                                                                          | Takes the root filesystem type that will be passed to the mount command. `rootfstype=` is honored by the initrd.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `mount.usr=`                                                                                           | Takes the `/usr/` filesystem to be mounted by the initrd. If `mount.usrfstype=` or `mount.usrflags=` is set, then `mount.usr=` will default to the value set in `root=`. Otherwise, this parameter defaults to the `/usr/` entry found in `/etc/fstab` on the root filesystem.                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| `mount.usrfstype=`                                                                                     | Takes the `/usr` filesystem type that will be passed to the mount command.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `systemd.volatile=`                                                                                    | Controls whether the system shall boot up in volatile mode.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `systemd.swap=`                                                                                        | Takes a boolean argument or enables the option if specified without an argument. If disabled, causes the generator to ignore any swap devices configured in `/etc/fstab`. Defaults to enabled.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

## Misc
### Cause a kernel panic
To manually cause a kernel panic run:

```sh
echo c > /proc/sysrq-trigger
```
