Basics
Layers of Linux Distribution
Linux Kernel
It handles system hardware resources on behalf of the OS user.
Linux Desktop
A software designed to manage graphical interface features like windows, menus, application controls..etc Eg: GNOME, Unity, KDE Plasma, Xfce, Cinnamon ..etc
Linux Distribution
Specific system tools like software package managers , process managers..
Example
- Android
- RedHat Enterprise Linux
- CentOS
- Fedora
- Debian
- Ubuntu
- Kali Linux (Security)
- Mint
- Arch Linux
- LinHES
- Manjaro
- SUSE
- Open SUSE
- Scientific Linux (Science & Maths)
- Raspbian (Mini architectures) ..so on
Package managers
- Debian : DPKG/ APT / snap
- dpkg installs any .deb debian package. It will just list other dependencies .
- apt/ apt-get is package manager which uses dpkg internally, it installs particular package & it's dependencies too.
- snap is package manager to work across range of linux distributions, snapcraft store
- Red Hat Linux : RPM/ YUM (DNF)
- RPM like dpkg installs .rpm packages.
- YUM is a package manager
- DNF or Dandified YUM is the next-generation version of the YUM
- SUSE (Zypp)
- Arch Linux (Pacman)
How Linux Loads
BIOS (Basic Input Output System)/ UEFI (Unified Extensible Firmware Interface)
- BIOS is older, modern computers have UEFI
- Both are low-level software that resides in a chip on your computer’s motherboard.
- You can change boot order, system time & access hardware configuration
- It wakes up your computer’s hardware components, ensures they’re functioning properly.
BIOS/ UEFI looks for a Master Boot Record (MBR)/ GPT (GUID Partition Table) respectively, stored on the boot device and uses it to launch the boot loader
GRUB (Grand Unified Bootloader)
- Boot loader boots operating system
- Similar to windows safe mode, in advanced -> kernel/ recovery mode exists. Login with it if any issues in main operating system.
- Note:
- in /boot -> core linux files exists like vmlinuz-4.15.0
- Actual configuration /boot/grub/grub.cfg file shouldn't be changed directly. Instead use /etc/default/grub, /etc/grub.d for configuration.
- Later run 'update-grub' to reflect those changes in /bott/grub/grub.cfg
Linux Run levels
May vary based on distributions
0 - system halt
1 - single user (rescue) mode
3 - multi user mode without GUI
5 - multi user with GUI
6 - reboot
//check existing
systemctl get-default (output is graphical.target)
//change
systemctl enable multi-user.target
File System Hierarchy
Root Level Directories
- /bin : Binary files for (single user mode) system commands
- /sbin : Binary files for (multi-user) system commands //system bin
- /boot : Linux images and boot configuration files
- /dev : Pseudo files representing devices
- /etc : Configuration files
- /home : User files
- /lib : Software library dependencies
- /root : Root user files
- /usr : Additional binaries
- /var : Updating files: logs, application data, cache
Pseudo File Directories
(dynamic data created in these folders)
- /proc : Files representing running system processes
- /dev : Pseudo files representing devices
- /sys : Data on system and kernel resources
Linux Desktops
- GNOME
- Cinnamon/ Mate
- XFCE ..so on
Links
- https://distrowatch.com/
- Samba for windows interoperability with linux/ unix programs.
- syncthing //sync two way files between multiple computers
.profile , .bashrc & passwd
User Settings
//Following file has user environment profile (it also loads ~/.bashrc)
~/.profile
// Following file gets run when ever bash session is started
//It is used to load user terminal preferences, set environment variables, set custom alias commands
~/.bashrc
- Bash is case sensitive
- Use string quotes '' if command file has spaces, use escape \ char for any special chars
Global settings
//global profile setting
/etc/profile
//global .bashrc
/etc/bash.bashrc
//It has user's -> ID, GroupId, Home Directory & bash to be used
/etc/passwd
Note : In CentOS /etc/profile.d/custom.sh -> add variables