Linux Debian

circle-info

Excellent References

  • Book - [REF-3]

Basic Concept

  • Application running in user space can access kernel resources by directly invoking Linux system calls or by invoking libc (or glibc)-provided API calls. In the latter case, libc (or glibc) invokes a Linux system call.

  • Drivers in user space can directly access hardware, can access a Linux system call, or can access libc (or glibc) APIs. libc (or glibc) is an example library running in user space; there are many more such user space libraries.

  • bash is a Unix shell, a user command line interface (CLI). It is the default shell on Debian OS.

Package Management

apt is debian package management.

Debian maintains a list of links to repository that apt- or apt-get can download from. The list(s) is stored in a file /etc/apt/sources.list, and in a directory containing the list files. These files are merged at runtime to form the complete list. Therefore, the content format of these files are exactly the same.

The benefits for allowing list of files in the sources.list.d folder are: ease of configuration and automation. For example, to disable a repository that is listed on a file, you can just remove the file instead of manipulating the main list (i.e. sources.list).

Also see:

/etc

/etc is where a Linux system's configuration files live.

  • apt Repository list -

  • File System Table - /etc/fstab;Note: Add entry in the fstab file to persist mount point across reboot.

  • Hosts - /etc/hosts

  • rc.local - /etc/rc.local; for setting start-up program;

  • Timezone - /etc/timezone;

Networking

  • The networking folder - /proc/net/

  • For example, the host IP can be found in the file fib_trie

How-to

Basic info

chevron-rightProcessor Architecturehashtag
chevron-rightOS Versionhashtag
chevron-rightWhich SHELLhashtag

Admin

chevron-rightUser Info (UID, GID, Group)hashtag
chevron-rightManage user (add, add to group, delete)hashtag
chevron-rightManage grouphashtag
chevron-rightchmod and chownhashtag
chevron-rightMountpoint - Persist across boothashtag

Add entry in the fstab file to persist mount point across reboot

Setup Environment

chevron-rightDate, Time, Timezonehashtag
chevron-rightAdd the executable path to your PATH variablehashtag

Typically, the application is installed at the executable path ~/.local/bin. To add this path to your PATH variable:

  • The shell profile script in stored in the user folder, ~

    • Bash.bash_profile, .profile, or .bash_login.

      Zsh .zshrc

      Tcsh .tcshrc, .cshrc or .login.

  • Add an export command to your profile script. The following example adds the path represented by ~/.local/bin to the current PATH variable.

  • Load the profile script described in the first step into your current session. The following example loads the profile script represented by PROFILE_SCRIPT

  • Echo the PATH

chevron-rightSetting Environment varshashtag

The Global environment variables of your system are stored in /etc/environment. Any changes here will get reflected throughout the system and will affect all users of the system. Also, you need to reboot or source, for any changes to take effect. Eg. source /etc/environment

User level Environment variables are mostly stored in .bashrc and .profile files in the user home directory. Changes only affect that particular user. Close and reopen the terminal for configuration changes to take effect. E.g., source .bashrc

Environment variables to configure the AWS CLIarrow-up-right

chevron-rightSetup SSH for putty and winscphashtag

Configure

chevron-rightProgram to run at boothashtag

Old school mechanism for starting python program, svc.py at boot:

  • add it to /etc/rc.local

  • make sure rc.local runs at boot time

  • must be setup as root.

setup commands:

Alternative: see "A super-simple way to run scripts on boot - crontabarrow-up-right"

Package Management

chevron-rightUpdate & Upgradehashtag
chevron-rightList of apt repositorieshashtag

For raspbian, see an example of the default content of /etc/apt/sources.list

For debian, see /etc/apt/sources.list.d/debian.list

Also see:

  • man sources.list for details

  • [REF-5] How to Add Apt Repository in Ubuntu & Debian

chevron-rightList of installed packageshashtag
chevron-rightInstall & Uninstall packagehashtag

Notes:

  • Do not consider recommended packages as a dependency for installing

  • during package search, gathers the list required packages, recommended packages, and suggested packages

  • The required packages are dependencies so their installation is mandatory

  • The recommended packages will be installed by default unless the --no-install-recommends is specified or turned off in the /etc/apt/apt.conf

  • The suggested packages is not installed by default

  • Also see https://www.howtoforge.com/linux-dpkg-command/arrow-up-right for additional dpkg features & how-to

chevron-rightSearch apt packages using Web-based toolhashtag

Services

chevron-rightList al the serviceshashtag
chevron-rightManage a servicehashtag
chevron-rightManager service at boothashtag
  • TODO: journalctl ;

Build-tool

Source: https://www.youtube.com/watch?v=9vsu67uMckoarrow-up-right

  • Buildroot

  • OpenWrt

  • Yocto

Books

References

Last updated