Linux

If you are interested in learning how to install a particular Linux distribution, visit the Installation page.

This project is meant to help people understand how the internals of Linux operating system work. By studying the learning materials here you will hopefully come away with a better understanding of source code, programming, Linux, the history of Linux (e.g. History of the Linux kernel), operating systems, and probably other things that only thorough reflection upon the experience can glean.

## Portability

[edit | edit source]

Since Linux-based operating systems are free and largely open-source, they can be installed on an unlimited number of computers without the need for license keys. Linux can also be installed on external mass storage media such as USB-attached portable solid state drives, and existing installations can be cloned to a different computer or external drive.

## Caching

[edit | edit source]

Linux features a sophisticated and fine-tuneable disk caching system. Data read from and written to the disk is stored temporarily in the RAM to maximize performance and minimize lag, to an extent not reserved by running programs. Cached data is released should a running program need more memory.[1]

The `free -h` command indicates usage by running programs and for cache; the `-h` part does abbreviates the numbers for readability.

To increase performance on computers with much RAM capacity, some values in `/proc/sys/vm/` can be fine-tuned through a text editor or using the `echo [value] | sudo tee /proc/sys/vm/[entry]` command. Root access is required to change the values, example, `/proc/sys/vm/vfs_cache_pressure` (default: 100) can be decreased to keep file system meta data in the RAM cache for a longer time, and `/proc/sys/vm/dirty_writeback_centisecs` (default: 500, meaning 5 seconds) can be increased to keep saved data in RAM for longer before writing to the "persistent storage", i.e. the local disk. This reduces stress on the disk from repeated writes.

## Mounting file systems

[edit | edit source]

Keep in mind that implementations of commands may slightly vary across Linux distributions. The easiest way to mount a file system is with the `mount /dev/[device file] /media/[username]/[mountpoint]` command. The mountpoint needs to be created as a directory first. While it can be located elsewhere than `/media/[username]/`, it is the location file manager software expects folders to be. A list of data storage devices and partitions (i.e. "block devices") can be shown through the `lsblk` command. `lsblk -x size` sorts block devices by size. Mounting typically needs root access, meaning that if the command terminal is not running with root permission, `sudo` must be prepended to the command.

A file system can be mounted with write-protection if desired. This can be done through the `-o ro` option. Implementations may also support `-r` for this purpose. If the file system is already mounted, it should be remounted with the `-o remount` option. Multiple options can be separated through a comma, for example `-o ro,remount`.[2][3]

In order to be able to modify files' date and time stamps and to preserve date and time stamps of files copied (using `cp --preserve=timestamps` or `cp -p`) or moved from a different file system, the file system must be mounted with oneself as its owner. This is specified through the `-o uid=[number]` option parameter. The own user ID number can be found out through the `id [user name]` command. The user name can be displayed by `whoami`. These steps can be combined through the nested `id $(whoami)` command.[4][5][6]

The `findmnt -T` command shows which device a file or directory is located on.[7]

## Live CD

[edit | edit source]

A Live CD is a CD which contains a ready-to-use, fully operational copy (called an image) of a version of the Linux operating system. The CD is used to boot the computer in place of the hard drive. Due to the fact that this method does not touch the contents of the hard disk, it is a popular way to test out a new operating system. It will not make any permanent alterations to the system. Usually these Live CDs have installer programs so that if you like what the live CD contains, you can install it on your hard disk by clicking on a link. However, one must click through a fair amount of warning messages before anything is overwritten on the hard disk. See the List of live CDs at Wikipedia.

## Virtualization

[edit | edit source]

Using Virtualization technologies such as VirtualBox or KVM you can also run more than one OS's simultaneously on the same machine.

For example, you can install VirtualBox onto your Windows [8] or Mac system, and then install whatever OS you want into the VirtualBox environment (each install takes up disk space, and the number that you can run at the same time is limited by RAM - a good graphical linux can run just fine on 1G, and run a little bit slower on half that). There are other virtualization options: Xen, VMware, etc...

* VirtualBox download URL for all platforms: https://www.virtualbox.org/wiki/Downloads

## Screen recording

[edit | edit source]

The screen can be recorded using the `ffmpeg` command-line utility which is usually bundled. (ffmpeg on Wikipedia)

ffmpeg  -framerate 30 -f x11grab -i :0.0 ~/Videos/screencast-$(date +%Y-%m-%dT%H-%M-%S).mp4

This command automatically generates a time-stamped file name. If another format or output folder is desired, the command can be modified.

To create a memorable shortcut to this command, this line can be added to the file that is loaded automatically when opening the terminal, the `~/.bashrc` file:

screencast() { ffmpeg  -framerate 30 -f x11grab -i :0.0 ~/Videos/screencast-$(date +%Y-%m-%dT%H-%M-%S).mp4; }

A custom resolution can optionally be specified with the "video_size" option (for example `-video_size 1280x720`. By default, ffmpeg picks the full screen resolution.

If the quality is too low, the encoding bitrate can be raised using the `-b` option, for example `-b 5M` does specify 5 megabits per second.

## Content to study

[edit | edit source]

Portal:Linux

* Introduction
* Tiny Core Linux
* Compiling the Linux kernel
* linux-0.01.tar source code
* Reading the Linux Kernel Sources
* Types of GUI
* Basic commands
* Filesystems permissions
* Directories
* Text editing with vi and vim
* logging
* Scheduling (crontab)
* Wireless configuration
* Package managers: RPM, APT
* Bash programming

### External materials

[edit | edit source]

* Linux Technology Reference
* Introduction to Linux
* LFS Project

## Linux Certification Programs

[edit | edit source]

There are multiple certification programs available in the market such as LPI, CompTIA or Red Hat certifications.

### Linux Professional Institute

[edit | edit source]

The Linux Professional Institute is an institute which is committed to the development of a global standard in Linux certification. Individuals and organisations wishing to be certified in the use of Linux systems can enroll in courses which meet the requirements of both IT professionals and the organizations that seek to employ people with skills and experience in using, administering and programming on open source distributions. The LPI seeks to be distribution neutral and aims to provide the highest quality resources in order to educate and certify people in the use of Linux distributions.

### Levels

[edit | edit source]

The LPI provides 3 levels of certification: Essentials, Professionals, and Enterprise.

Essentials:

* Linux Essentials
* LPIC-1

Linux Professionals:

* LPIC-2

Enterprise:

* LPIC-3
* LPIC-3 Enterprise Mixed Environment
* LPIC-3 Enterprise Security
* LPIC-3 Enterprise Virtualization and High Availability

Open Technology:

* DevOps Tools Engineer
* BSD Specialist

Wikipedia LPI

## Additional resources

[edit | edit source]

### On this wiki

[edit | edit source]

* Linux server administration wikiversity course
* mdadm (Disk Management Utility)
* Linux adaptations for UMPC design

### Wikipedia

[edit | edit source]

* Filesystem Hierarchy Standard
* Advanced Packaging Tool
* Linux for PlayStation 3
* Magic SysRq key
* Linux for mobile devices
* LineageOS
* PureOS
* Linux-powered device
* Linux on embedded systems

## References

[edit | edit source]

1. ↑ https://www.linuxatemyram.com/
2. ↑ lsblk(8) - Linux manual page
3. ↑ Linux Mount Command – EDUCBA
4. ↑ mount(2) — Linux manual page
5. ↑ mount(8) — Linux manual page
6. ↑ How to find your uid(userid) and gid(groupid) in Linux via the command line - Ian Carnaghan
7. ↑ findmnt(8) — Linux manual page
8. ↑ https://www.virtualbox.org/wiki/Downloads

## External links

[edit | edit source]

* List of live CDs
* Debian on FreeRunner.
* Linux booting in 5 seconds