Debian Reference I
Total Page:16
File Type:pdf, Size:1020Kb
Debian Reference i Debian Reference Debian Reference ii Copyright © 2013-2021 Osamu Aoki This Debian Reference (version 2.81) (2021-08-25 14:16:08 UTC) is intended to provide a broad overview of the Debian system as a post-installation user’s guide. It covers many aspects of system administration through shell-command examples for non- developers. Debian Reference iii COLLABORATORS TITLE : Debian Reference ACTION NAME DATE SIGNATURE WRITTEN BY Osamu Aoki August 26, 2021 REVISION HISTORY NUMBER DATE DESCRIPTION NAME Debian Reference iv Contents 1 GNU/Linux tutorials 1 1.1 Console basics .................................................... 1 1.1.1 The shell prompt ............................................... 1 1.1.2 The shell prompt under GUI ......................................... 2 1.1.3 The root account ............................................... 2 1.1.4 The root shell prompt ............................................. 3 1.1.5 GUI system administration tools ....................................... 3 1.1.6 Virtual consoles ................................................ 3 1.1.7 How to leave the command prompt ..................................... 3 1.1.8 How to shutdown the system ......................................... 4 1.1.9 Recovering a sane console .......................................... 4 1.1.10 Additional package suggestions for the newbie ............................... 4 1.1.11 An extra user account ............................................. 5 1.1.12 sudo configuration .............................................. 5 1.1.13 Play time ................................................... 6 1.2 Unix-like filesystem .................................................. 6 1.2.1 Unix file basics ................................................ 6 1.2.2 Filesystem internals ............................................. 8 1.2.3 Filesystem permissions ............................................ 8 1.2.4 Control of permissions for newly created files: umask ........................... 10 1.2.5 Permissions for groups of users (group) ................................... 11 1.2.6 Timestamps .................................................. 12 1.2.7 Links ..................................................... 13 1.2.8 Named pipes (FIFOs) ............................................. 14 1.2.9 Sockets .................................................... 14 1.2.10 Device files .................................................. 14 1.2.11 Special device files .............................................. 15 1.2.12 procfs and sysfs ................................................ 15 1.2.13 tmpfs ..................................................... 16 1.3 Midnight Commander (MC) ............................................. 16 Debian Reference v 1.3.1 Customization of MC ............................................. 17 1.3.2 Starting MC .................................................. 17 1.3.3 File manager in MC ............................................. 17 1.3.4 Command-line tricks in MC ......................................... 17 1.3.5 The internal editor in MC .......................................... 18 1.3.6 The internal viewer in MC .......................................... 18 1.3.7 Auto-start features of MC .......................................... 19 1.3.8 FTP virtual filesystem of MC ........................................ 19 1.4 The basic Unix-like work environment ........................................ 19 1.4.1 The login shell ................................................ 19 1.4.2 Customizing bash ............................................... 20 1.4.3 Special key strokes .............................................. 20 1.4.4 Mouse operations ............................................... 21 1.4.5 The pager ................................................... 22 1.4.6 The text editor ................................................ 22 1.4.7 Setting a default text editor .......................................... 22 1.4.8 Using vim ................................................... 23 1.4.9 Recording the shell activities ......................................... 23 1.4.10 Basic Unix commands ............................................ 24 1.5 The simple shell command .............................................. 26 1.5.1 Command execution and environment variable ............................... 26 1.5.2 The ”$LANG” variable ............................................ 26 1.5.3 The ”$PATH” variable ............................................ 27 1.5.4 The ”$HOME” variable ............................................ 28 1.5.5 Command line options ............................................ 28 1.5.6 Shell glob ................................................... 28 1.5.7 Return value of the command ........................................ 29 1.5.8 Typical command sequences and shell redirection .............................. 30 1.5.9 Command alias ................................................ 31 1.6 Unix-like text processing ............................................... 32 1.6.1 Unix text tools ................................................ 32 1.6.2 Regular expressions ............................................. 33 1.6.3 Replacement expressions ........................................... 34 1.6.4 Global substitution with regular expressions ................................. 34 1.6.5 Extracting data from text file table ...................................... 35 1.6.6 Script snippets for piping commands ..................................... 37 Debian Reference vi 2 Debian package management 38 2.1 Debian package management prerequisites ...................................... 38 2.1.1 Package configuration ............................................ 38 2.1.2 Basic precautions ............................................... 39 2.1.3 Life with eternal upgrades .......................................... 40 2.1.4 Debian archive basics ............................................ 41 2.1.5 Debian is 100% free software ........................................ 44 2.1.6 Package dependencies ............................................ 45 2.1.7 The event flow of the package management ................................. 46 2.1.8 First response to package management troubles ............................... 47 2.2 Basic package management operations ........................................ 47 2.2.1 apt vs. apt-get / apt-cache vs. aptitude ............................. 47 2.2.2 Basic package management operations with the commandline ....................... 48 2.2.3 Interactive use of aptitude .......................................... 50 2.2.4 Key bindings of aptitude ........................................... 50 2.2.5 Package views under aptitude ........................................ 50 2.2.6 Search method options with aptitude ..................................... 52 2.2.7 The aptitude regex formula .......................................... 52 2.2.8 Dependency resolution of aptitude ...................................... 54 2.2.9 Package activity logs ............................................. 54 2.3 Examples of aptitude operations ........................................... 54 2.3.1 Listing packages with regex matching on package names .......................... 55 2.3.2 Browsing with the regex matching ...................................... 55 2.3.3 Purging removed packages for good ..................................... 55 2.3.4 Tidying auto/manual install status ...................................... 55 2.3.5 System wide upgrade ............................................. 56 2.4 Advanced package management operations ..................................... 57 2.4.1 Advanced package management operations with commandline ....................... 57 2.4.2 Verification of installed package files .................................... 59 2.4.3 Safeguarding for package problems ..................................... 59 2.4.4 Searching on the package meta data ..................................... 59 2.5 Debian package management internals ........................................ 59 2.5.1 Archive meta data .............................................. 59 2.5.2 Top level ”Release” file and authenticity ................................... 60 2.5.3 Archive level ”Release” files ......................................... 61 2.5.4 Fetching of the meta data for the package .................................. 62 2.5.5 The package state for APT .......................................... 62 2.5.6 The package state for aptitude ........................................ 62 2.5.7 Local copies of the fetched packages ..................................... 62 Debian Reference vii 2.5.8 Debian package file names .......................................... 62 2.5.9 The dpkg command .............................................. 63 2.5.10 The update-alternatives command ...................................... 64 2.5.11 The dpkg-statoverride command ....................................... 64 2.5.12 The dpkg-divert command .......................................... 65 2.6 Recovery from a broken system ........................................... 65 2.6.1 Incompatibility with old user configuration ................................. 65 2.6.2 Different packages with overlapped files .................................. 65 2.6.3 Fixing broken package script ......................................... 66 2.6.4 Rescue with the dpkg command ....................................... 66 2.6.5 Recovering package selection data .....................................