From 775ec4d66ce8cd9170e8b1b1f3fedb3f45532839 Mon Sep 17 00:00:00 2001 From: waldek Date: Thu, 24 Feb 2022 18:04:56 +0100 Subject: [PATCH] adds help and man doc --- essential/readme.md | 808 ++++++++++++++++++++++++-------------------- 1 file changed, 442 insertions(+), 366 deletions(-) diff --git a/essential/readme.md b/essential/readme.md index 7e5a8a3..903970c 100644 --- a/essential/readme.md +++ b/essential/readme.md @@ -1,19 +1,17 @@ -# Essential Linux +# Introduction to Linux -## Introduction to Linux - -### Where does Linux originate from? +## Where does Linux originate from? * The spiritual mother of Linux is [Unix](https://en.wikipedia.org/wiki/Unix). * [POSIX](https://en.wikipedia.org/wiki/POSIX) is not an OS in itself but a **standard**. * Which OS's are [POSIX compliant](https://en.wikipedia.org/wiki/POSIX#POSIX-oriented_operating_systems) -### Who is behind this project? +## Who is behind this project? * Who is [Richard Stallmann](https://en.wikipedia.org/wiki/Richard_Stallman)? * Who is [Linus Torvalds](https://en.wikipedia.org/wiki/Linus_Torvalds)? -### What is the deal with 'GNU-slash-Linux'? +## What is the deal with 'GNU-slash-Linux'? * [GNU/Linux](https://en.wikipedia.org/wiki/GNU/Linux_naming_controversy) controversy * What is a [kernel](https://en.wikipedia.org/wiki/Kernel_(operating_system)) @@ -24,20 +22,20 @@ ![Linux kernel](../assets/linux_kernel.png) -### Where can you *get* some Linux? +## Where can you *get* some Linux? * You probably already have a Linux computer running at [home](https://opensource.com/article/19/8/everyday-tech-runs-linux)! ![Timeline](../assets/distro_timeline.png) -### Debian +## Debian * [Reasons](https://www.debian.org/intro/why_debian) to choose Debian. * Why is Debian called [the universal operating system](https://www.reddit.com/r/debian/comments/22j0wf/so_why_debian_is_called_the_universal_operating/)? * [comparison](https://en.wikipedia.org/wiki/Comparison_of_instruction_set_architectures) of CPU architectures * [download](https://www.debian.org/distrib/netinst) Debian -## How to create a virtual machine +# How to create a virtual machine In order to run virtual machines, or VM's, we need a **host** program. One of the most popular ones out there is called `virtualbox`. @@ -74,7 +72,7 @@ This is something you can change whenever you need more processing power but the ![virtualbox setup](../assets/2022-02-18-123121_1920x1080_scrot.png) -## Breakdown of the Debian installation +# Breakdown of the Debian installation All right, enough talking, let's get started! I'll install a full blown and modern graphical Debian machine and I would like you to **not** do it yourself but take **notes** on each step so you'll be able to reference your notes later **when** I ask you to install a machine yourself. @@ -127,7 +125,7 @@ You *can* recover from this mistake with [supergrub2](https://www.supergrubdisk. ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_51_07.png) -### Exercise +# Exercise OK, now it's up to you! Please install a Debian machine with the default graphical environment. @@ -136,7 +134,7 @@ Which software is installed by default? How can you tweak the system settings such as language, keyboard, networking? Can you install extra software? -## Quick look at an idle system +# Quick look at an idle system You can inspect the system by running the *gnome task manager*. It lists all your running processes, sorted by CPU percentage, in the first tab which can give you a good idea of what's happening on your system. @@ -154,11 +152,11 @@ That's the magic of a good package manager! ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_54_41.png) -## Package managers +# Package managers What is a [package manager](https://en.wikipedia.org/wiki/Package_manager) -### Graphical installation +## Graphical installation Modern Linux has come a long way and it's now quite usable without any command line knowledge. We can install extra software from the graphical environment if we want. @@ -181,7 +179,7 @@ If your password does not work, you probably set a `root` password and you shoul ![Debian installation](../assets/VirtualBox_debian_18_02_2022_12_52_53.png) -### Command line installation +## Command line installation ```bash waldek@hellodebian:~$ htop @@ -226,7 +224,7 @@ But pressing **q** also exits the program. ![htop bug with gnome-terminal](../assets/VirtualBox_debian_18_02_2022_13_19_35.png) -### Adding a secondary desktop environment +## Adding a secondary desktop environment During the initial installation we where offered a choice of desktop environments to install. This menu was an actual program called `tasksel` we can run again to add different ones! @@ -242,7 +240,7 @@ waldek@hellodebian:~$ sudo tasksel ![tasksel](../assets/VirtualBox_debian_18_02_2022_13_22_47.png) ![tasksel](../assets/VirtualBox_debian_18_02_2022_13_23_57.png) -## Changing the runlevel +# Changing the runlevel The **first** process started by the kernel can be discover by `htop` and is `/usr/sbin/init`. This is rather vague but we can find out a *bit* more about this program via `ls` which we'll get into more detail later. @@ -301,7 +299,7 @@ Created symlink /etc/systemd/system/default.target → /lib/systemd/system/graph waldek@hellodebian:~$ sudo reboot now ``` -## Exercise +# Exercise Please create a second virtual machine and install a **minimal** Debian. Minimal means **no graphical environment**. @@ -312,7 +310,7 @@ The only one we saw up until now is `htop` but maybe try out `bmon`, `elinks` an Once these are installed have a look at the running services and programs via `htop` and compare it to both your graphical installation **and** your graphical install but running in `multi-user.target`. -## Guest additions +# Guest additions Let's make our user experience a bit nicer. Virtual machines can *integrate* with the host machine more fluently when you install the guest additions in the VM. @@ -413,7 +411,7 @@ You can also enable copy/paste and drag and drop between your host and VM now. ![full screen](../assets/VirtualBox_debian_18_02_2022_15_08_01.png) -## Introduction to the command line +# Introduction to the command line We'll be using a few new *words* to reference the command line such as *shell*, *bash* and *terminal* through out the course. They all pretty much mean the same thing but with some small, and not so important, differences between them. @@ -518,7 +516,7 @@ But what about `which`? It's also an executable but not compiled, it's a *POSIX shell script*. So not all programs *are* created equally? -### Compiled vs interpreted +## Compiled vs interpreted Executing a file, or program, means you take this file and tell the computer it needs to execute the actions that are stored in the file. Compiled programs contain actual [instructions](https://en.wikipedia.org/wiki/Instruction_set_architecture#Instructions) the computer understands out of the box. @@ -607,7 +605,7 @@ When you think about it it does make sense because at the end of the day the com So when you execute a script each line of code is converted to machine instructions on the spot. This makes scripts easier to write but slower at execution. -## More about paths +# More about paths The prompt in our terminal tells us who we are, on which machine, and **where** we are located. This where is symbolized with the `~` character. @@ -664,344 +662,11 @@ waldek@hellodebian:/usr/bin$ ls alsamixer glib-compile-schemas ntfscluster systemd-sysusers alsatplg gmake ntfscmp systemd-tmpfiles alsaucm gnome-calculator ntfsdecrypt systemd-tty-ask-password-agent - amidi gnome-calendar ntfsfallocate systemd-umount - amixer gnome-characters ntfsfix tabs - apg gnome-clocks ntfsinfo tac - apgbfm gnome-contacts ntfsls tail - aplay gnome-control-center ntfsmove tar - aplaymidi gnome-disk-image-mounter ntfsrecover tasksel - appres gnome-disks ntfssecaudit taskset - appstreamcli gnome-documents ntfstruncate tbl - apropos gnome-extensions ntfsusermap tbl-dctrl - apt gnome-extensions-app ntfswipe tee - apt-add-repository gnome-font-viewer numfmt telnet - apt-cache gnome-help numlockx telnet.netkit - apt-cdrom gnome-keyring nvlc tempfile - apt-config gnome-keyring-3 obamenu test - apt-extracttemplates gnome-keyring-daemon obconf thunar - apt-ftparchive gnome-logs obexctl Thunar - apt-get gnome-maps objcopy thunar-settings - apt-key gnome-music objdump thunar-volman - apt-listchanges gnome-screenshot obsession-exit thunar-volman-settings - apt-mark gnome-session obsession-logout tic - apt-sortpkgs gnome-session-classic obxprop time-admin - ar gnome-session-custom-session oclock timedatectl - arch gnome-session-inhibit od timeout - arecord gnome-session-quit odp2pdf tjbench - arecordmidi gnome-shell odp2ppt tkjpeg - as gnome-shell-extension-prefs ods2pdf tload - aseqdump gnome-shell-extension-tool odt2bib toc2cddb - aseqnet gnome-shell-perf-tool odt2doc toc2cue - aspell gnome-software odt2docbook toe - aspell-import gnome-sound-recorder odt2html top - atobm gnome-system-monitor odt2lt totem - atril gnome-terminal odt2pdf totem-video-thumbnailer - atril-previewer gnome-terminal.wrapper odt2rtf touch - atril-thumbnailer gnome-text-editor odt2sdw tput - awk gnome-thumbnail-font odt2sxw tr - axfer gnome-todo odt2txt traceproto - b2sum gnome-tweaks odt2txt.unoconv traceproto.db - baobab gnome-weather odt2xhtml traceroute - base32 gnome-www-browser odt2xml traceroute6 - base64 gold ooxml2doc traceroute6.db - basename gpasswd ooxml2odt traceroute.db - basenc gpg ooxml2pdf traceroute-nanog - bash gpg-agent open tracker - bashbug gpgcompose openbox transmission-gtk - bccmd gpgconf openbox-lxde transset - bdftopcf gpg-connect-agent openbox-session troff - bdftruncate gpgparsemail openssl true - bf_compact gpgsm openvt truncate - bf_compact-bdb gpgsplit operon trust - bf_copy gpgtar orca tryaffix - bf_copy-bdb gpgv orca-dm-wrapper tset - bf_tar gpg-wks-server os-prober tsort - bf_tar-bdb gpg-zip p11-kit tty - bitmap gpic p7zip tzselect - bluemoon gpicview pacat ucf - bluetoothctl gprof pacmd ucfq - bluetooth-sendto grep pactl ucfr - bmtoa grep-aptavail padsp ucs2any - bogofilter grep-available pager udevadm - bogofilter-bdb grep-dctrl pa-info udisksctl - bogolexer grep-debtags pamon ul - bogolexer-bdb grep-status paperconf umax_pp - bogotune gresource paplay umount - bogotune-bdb groff parcellite uname - bogoupgrade grog parec unattended-upgrade - bogoupgrade-bdb grops parecord unattended-upgrades - bogoutil grotty parole uncompress - bogoutil-bdb groups partx unexpand - boltctl grub-editenv passwd unicode_start - bootctl grub-file paste unicode_stop - broadwayd grub-fstest pasuspender uniq - btattach grub-glue-efi patch unity-scope-loader - btmgmt grub-kbdcomp pathchk unlink - btmon grub-menulst2cfg pavucontrol unlzma - buildhash grub-mkfont pax11publish unmkinitramfs - bunzip2 grub-mkimage pcmanfm unoconv - busctl grub-mklayout pdb3 unopkg - busybox grub-mknetdir pdb3.9 unshare - bwrap grub-mkpasswd-pbkdf2 peekfd unxz - bzcat grub-mkrelpath perf unzip - bzcmp grub-mkrescue perl unzipsfx - bzdiff grub-mkstandalone perl5.32.1 update-alternatives - bzegrep grub-mount perl5.32-x86_64-linux-gnu update-desktop-database - bzexe grub-ntldr-img perlbug update-menus - bzfgrep grub-render-label perldoc update-mime-database - bzgrep grub-script-check perli11ndoc upower - bzip2 grub-syslinux2cfg perlivp uptime - bzip2recover gsettings perlthanks usb-devices - bzless gsf pgrep usbhid-dump - bzmore gsf-office-thumbnailer pic usbreset - c++ gsf-vba-dump pico userinfo - c89 gstreamer-codec-install piconv usermount - c89-gcc gtbl pidof userpasswd - c99 gtf pidwait users - c99-gcc gtk-builder-tool pinentry users-admin - cancel gtk-encode-symbolic-svg pinentry-gnome3 utmpdump - captoinfo gtk-launch pinentry-x11 VBoxClient - caribou-preferences gtk-query-settings ping VBoxClient-all - cat gtk-update-icon-cache ping4 VBoxControl - catchsegv gucharmap ping6 VBoxDRMClient - catman gunzip pinky vdir - cc gzexe pipewire vi - cd-create-profile gzip pipewire-media-session view - cd-fix-profile h2ph pipewire-pulse viewres - cd-iccdump h2xs pkaction vim.tiny - cd-it8 hciattach pkcheck vlc - cdrdao hciconfig pkcon vlc-wrapper - c++filt hcitool pkexec vmstat - chacl hd pkg-config vmwarectrl - chage head pkill w - chardet HEAD pkmon w3m - chardetect helpztags pkttyagent w3mman - charmap hex2hcd pl2pm wall - chattr hexdump pldd watch - chcon host plog watchgnupg - cheese hostid plymouth wc - chfn hostname pmap wdctl - chgrp hostnamectl pod2html wget - chmod htop pod2man whatis - choom i386 pod2text whereis - chown ibus pod2usage which - chrome-gnome-shell ibus-daemon podchecker whiptail - chrt ibus-setup poff who - chsh iceauth pon whoami - chvt ico POST widget - ciptool icombine ppt2odp word-list-compress - cjpeg iconv pr wpa_passphrase - ckbcomp id precat write - cksum iecset preconv write.ul - clear ijoin preunzip wrjpgcom - clear_console im-config prezip www-browser - cmp im-launch prezip-bin X - codepage infocmp print X11 - col infotocap printenv x11perf - colcrt install printf x11perfcomp - colormgr install-menu prlimit x86_64 - colrm install-printerdriver prove x86_64-linux-gnu-addr2line - column instmodsh proxy x86_64-linux-gnu-ar - comm intel-virtual-output prtstat x86_64-linux-gnu-as - compose ionice ps x86_64-linux-gnu-c++filt - consolehelper ip psfaddtable x86_64-linux-gnu-cpp - consolehelper-gtk ipcmk psfgettable x86_64-linux-gnu-cpp-10 - corelist ipcrm psfstriptable x86_64-linux-gnu-dwp - cp ipcs psfxtable x86_64-linux-gnu-elfedit - cpan ipod-read-sysinfo-extended pslog x86_64-linux-gnu-g++ - cpan5.32-x86_64-linux-gnu ipod-time-sync pstree x86_64-linux-gnu-g++-10 - cpio iptables-xml pstree.x11 x86_64-linux-gnu-gcc - cpp ischroot ptar x86_64-linux-gnu-gcc-10 - cpp-10 isdv4-serial-debugger ptardiff x86_64-linux-gnu-gcc-ar - c_rehash isdv4-serial-inputattach ptargrep x86_64-linux-gnu-gcc-ar-10 - crontab ispell ptked x86_64-linux-gnu-gcc-nm - csplit ispell-wrapper ptksh x86_64-linux-gnu-gcc-nm-10 - ctstat join ptx x86_64-linux-gnu-gcc-ranlib - cupstestppd join-dctrl pulseaudio x86_64-linux-gnu-gcc-ranlib-10 - cut journalctl pw-cat x86_64-linux-gnu-gcov - cvlc jpegexiforient pw-cli x86_64-linux-gnu-gcov-10 - cvt jpegtran pwd x86_64-linux-gnu-gcov-dump - cvtsudoers json_pp pw-dot x86_64-linux-gnu-gcov-dump-10 - dash kbdinfo pw-dump x86_64-linux-gnu-gcov-tool - date kbd_mode pwdx x86_64-linux-gnu-gcov-tool-10 - dbus-cleanup-sockets kbxutil pw-metadata x86_64-linux-gnu-gold - dbus-daemon kernel-install pw-mididump x86_64-linux-gnu-gprof - dbus-launch kill pw-midiplay x86_64-linux-gnu-ld - dbus-monitor killall pw-midirecord x86_64-linux-gnu-ld.bfd - dbus-run-session kmod pw-mon x86_64-linux-gnu-ld.gold - dbus-send l2ping pw-play x86_64-linux-gnu-lto-dump-10 - dbus-update-activation-environment l2test pw-profiler x86_64-linux-gnu-nm - dbus-uuidgen laptop-detect pw-record x86_64-linux-gnu-objcopy - dbxtool last pw-reserve x86_64-linux-gnu-objdump - dconf lastb pw-top x86_64-linux-gnu-pkg-config - dd lastlog py3clean x86_64-linux-gnu-ranlib - deallocvt lcf py3compile x86_64-linux-gnu-readelf - debconf ld py3versions x86_64-linux-gnu-size - debconf-apt-progress ld.bfd pydoc3 x86_64-linux-gnu-strings - debconf-communicate ldd pydoc3.9 x86_64-linux-gnu-strip - debconf-copydb ld.gold pygettext3 x86_64-pc-linux-gnu-pkg-config - debconf-escape less pygettext3.9 xarchiver - debconf-set-selections lessecho python3 xargs - debconf-show lessfile python3.9 xauth - debianbts lesskey querybts xbiff - deb-systemd-helper lesspipe quodlibet xbrlapi - deb-systemd-invoke lexgrog qvlc xcalc - defmt-c lft ranger xclipboard - defmt-sh lft.db ranlib xclock - delpart libnetcfg rbash xcmsdb - delv libreoffice rcp xconsole - desktop-file-edit libwacom-list-local-devices rctest xcursorgen - desktop-file-install light-locker rdjpgcom xcutsel - desktop-file-validate light-locker-command rdma xdg-autostart - df link readelf xdg-dbus-proxy - dfu-tool linux32 readlink xdg-desktop-icon - dh_bash-completion linux64 realpath xdg-desktop-menu - dh_dkms linux-boot-prober rendercheck xdg-email - dh_installxmlcatalogs linux-check-removal renice xdg-icon-resource - dh_perl_openssl linux-update-symlinks reportbug xdg-mime - diff linux-version report-hw xdg-open - diff3 listres reset xdg-screensaver - dig ln resizecons xdg-settings - dir lnstat resizepart xdg-user-dir - dircolors loadkeys resolvectl xdg-user-dirs-gtk-update - dirmngr loadunimap rev xdg-user-dirs-update - dirmngr-client localc rfcomm xditview - dirname locale rgrep xdpyinfo - discover-config localectl rhythmbox xdriinfo - djpeg localedef rhythmbox-client xedit - dmesg lodraw rifle Xephyr - dm-tool loffice ristretto xev - dnsdomainname lofromtemplate rlogin xeyes - dnstap-read logger rm xfburn - doc2odt login rmdir xfce4-about - doc2pdf loginctl rnano xfce4-accessibility-settings - domainname logname routef xfce4-appearance-settings - dotlockfile loimpress routel xfce4-appfinder - dpkg lomath rpcgen xfce4-clipman - dpkg-architecture look rsh xfce4-clipman-history - dpkg-buildflags loweb rstart xfce4-clipman-settings - dpkg-buildpackage lowntfs-3g rstartd xfce4-color-settings - dpkg-checkbuilddeps lowriter rtstat xfce4-dict - dpkg-deb lp runcon xfce4-display-settings - dpkg-distaddfile lpoptions run-mailcap xfce4-find-cursor - dpkg-divert lp_solve run-parts xfce4-keyboard-settings - dpkg-genbuildinfo lpstat run-with-aspell xfce4-mime-helper - dpkg-genchanges ls rview xfce4-mime-settings - dpkg-gencontrol lsattr rvlc xfce4-mouse-settings - dpkg-gensymbols lsblk rygel xfce4-notifyd-config - dpkg-maintscript-helper lsb_release sane-find-scanner xfce4-panel - dpkg-mergechangelogs lscpu savelog xfce4-popup-applicationsmenu - dpkg-name lsinitramfs scanimage xfce4-popup-clipman - dpkg-parsechangelog lsipc scp xfce4-popup-clipman-actions - dpkg-query lslocks scp-dbus-service xfce4-popup-directorymenu - dpkg-realpath lslogins screendump xfce4-popup-places - dpkg-scanpackages lsmem script xfce4-popup-whiskermenu - dpkg-scansources lsmod scriptlive xfce4-popup-windowmenu - dpkg-shlibdeps lsns scriptreplay xfce4-power-manager - dpkg-source lsof scrot xfce4-power-manager-settings - dpkg-split lspci sdiff xfce4-screenshooter - dpkg-statoverride lspgpot sdptool xfce4-sensors - dpkg-trigger lsusb sdw2odt xfce4-session - dpkg-vendor lto-dump-10 seahorse xfce4-session-logout - du luit sed xfce4-session-settings - dumpkeys lwp-download see xfce4-settings-editor - dwp lwp-dump select-default-iwrap xfce4-settings-manager - echo lwp-mirror select-editor xfce4-taskmanager - edit lwp-request sensible-browser xfce4-terminal - editor lxappearance sensible-editor xfce4-terminal.wrapper - editres lxclipboard sensible-pager xfconf-query - egrep lxde-logout sensors xfd - eject lxhotkey sensors-conf-convert xfdesktop - elfedit lxinput seq xfdesktop-settings - enc2xs lxlauncher sessreg xfhelp4 - encguess lxlock setarch xflock4 - enchant-2 lxmusic setfacl xfontsel - enchant-lsmod-2 lxpanel setfont xfrun4 - env lxpanelctl setkeycodes xfsettingsd - envsubst lxpolkit setleds xfwm4 - eog lxrandr setlogcons xfwm4-settings - eqn lxsession setmetamode xfwm4-tweaks-settings - evince lxsession-db setpci xfwm4-workspace-settings - evince-previewer lxsession-default setpriv xgamma - evince-thumbnailer lxsession-default-apps setsid xgc - evolution lxsession-default-terminal setterm xhost - ex lxsession-edit setupcon xiccd - exfalso lxsession-logout setvtrgb xinit - exifautotran lxsession-xdg-autostart setxkbmap xkbbell - exo-desktop-item-edit lxsettings-daemon sftp xkbcomp - exo-open lxtask sg xkbevd - expand lxterminal sh xkbprint - expiry lynx sha1sum xkbset - expr lzcat sha224sum xkbset-gui - factor lzcmp sha256sum xkbvleds - faillog lzdiff sha384sum xkbwatch - faked-sysv lzegrep sha512sum xkeystone - faked-tcp lzfgrep shares-admin xkill - fakeroot lzgrep shasum xload - fakeroot-sysv lzless shotwell xlogo - fakeroot-tcp lzma showconsolefont xls2ods - fallocate lzmainfo showkey xlsatoms - false lzmore showrgb xlsclients - fc-cache make shred xlsfonts - fc-cat make-first-existing-target shuf xmag - fc-conflist mako-render simple-scan xman - fc-list malcontent-client size xmessage - fc-match malcontent-control skill xmms2d - fc-pattern man slabtop xmms2-launcher - fc-query mandb sleep xmodmap - fc-scan manpath slogin xmore - fc-validate man-recode smproxy Xorg - fgconsole mapscrn snice xprop - fgrep mawk soelim xrandr - file mcookie soffice xrdb - file-roller md5sum software-properties-gtk xrefresh - fincore md5sum.textutils sort xsane - find mdig sort-dctrl xscreensaver - findaffix memusage sotruss xscreensaver-command - findmnt memusagestat spa-acp-tool xscreensaver-demo - firefox mesa-overlay-control.py spa-inspect xscreensaver-getimage - firefox-esr mesg spa-monitor xscreensaver-getimage-file - flock mid3cp spa-resample xscreensaver-getimage-video - fmt mid3iconv spd-conf xscreensaver-systemd - fold mid3v2 spd-say xscreensaver-text - fonttosfnt migrate-pubring-from-classic-gpg spdsend x-session-manager - free mimeopen speaker-test xset - funzip mimetype speech-dispatcher xsetmode - fuser mkdir splain xsetpointer - fusermount mkfifo split xsetroot - fusermount3 mkfontdir splitfont xsetwacom - fwupdagent mkfontscale sprof xsm - fwupdate mk_modmap ss xstdcmap - fwupdmgr mknod ssh xsubpp - fwupdtool mktemp ssh-add x-terminal-emulator - fwupdtpmevlog mmcli ssh-agent xvidtune - g++ moggsplit ssh-argv0 xvinfo - g++-10 monitor-sensor ssh-copy-id Xwayland - gamma4scanimage more ssh-keygen xwd - gapplication mount ssh-keyscan x-window-manager - gatttool mountpoint startlxde xwininfo - gcalccmd mousepad start-pulseaudio-x11 xwud - gcc mpris-proxy startx x-www-browser - gcc-10 mt startxfce4 xxd - gcc-ar mt-gnu stat xz - gcc-ar-10 mtrace stdbuf xzcat - gcc-nm munchlist streamzip xzcmp - gcc-nm-10 mutagen-inspect strings xzdiff - gcc-ranlib mutagen-pony strip xzegrep - gcc-ranlib-10 mv stty xzfgrep - gcm-import namei su xzgrep - gcm-inspect nano sudo xzless - gcm-picker nautilus sudoedit xzmore - gcm-viewer nautilus-autorun-software sudoreplay yelp - gcov nawk sum yes - gcov-10 nc sushi ypdomainname - gcov-dump nc.traditional su-to-root zcat - gcov-dump-10 neqn svlc zcmp - gcov-tool netcat switcherooctl zdiff - gcov-tool-10 networkctl sxw2odt zdump - gcr-viewer newgrp synaptic-pkexec zegrep - gdbus ngettext sync zenity - gdialog nice system-config-printer zfgrep + +# ------------------------------------ +# --- cropped the list for clarity --- +# ------------------------------------ + gdk-pixbuf-csource nisdomainname system-config-printer-applet zforce gdk-pixbuf-pixdata nl systemctl zgrep gdk-pixbuf-thumbnailer nm systemd zipdetails @@ -1046,7 +711,7 @@ SYNOPSIS unset, until, wait, while. ``` -### Absolute and relative paths +## Absolute and relative paths > All roads lead to Rome. @@ -1103,19 +768,29 @@ waldek@hellodebian:~$ The `..` means go **back** one directory so in our example we go back **two** directories, which brings us to the `/` of our system and from there we go **up** to `home` and then `waldek`. -### Exercise +## `root` and `/` and `/root` are not the same thing + +The word *root* has multiple meanings and can be a bit confusing at the start. +Every Linux machine will have a `root` user **and** a `/` of the system. +The `root` user is an account essential to the proper working of a Linux system, whereas `/` is a location, the *root* of the filesystem. +The `/root` is also a location but is the **home** of the user `root`, located at the `/` of the filesystem. +If this sounds confusing read the above paragraph slowly until you see the differences. +I do want to note that the name of the user `root` *can* change but it's ID will always be `0`. +We'll go into detail about users and ID's later down the line. + +# Exercise Explore your system a bit using `cd` and `ls`. You'll probably encounter some weird messages along the way. Keep note of them so we can discuss it together. -### `root` and `/` and `/root` are not the same thing - -## A pit stop to review what we've learned so far +# A pit stop to review what we've learned so far Below is a list of programs and command we've seen so far. +We've seen that some take arguments, some don't. +This list will grow as we go so I advise you to take some notes of your own. -|command|desciption| +|command|description| |---|---| |systemctl|manipulate running services| |apt|the Debian package manager| @@ -1129,3 +804,404 @@ Below is a list of programs and command we've seen so far. |cd|change directory| |ls|list content of a directory| +# Arguments and flags + +The `ls` program is one of the most used commands. +It's like a very basic *file explorer* in a graphical environment and just like it's graphical counter part you can use it to display it's data in different ways. +Think of the *details* versus *thumbnail* views in your favorite explorer. +But how do you do this? +We can **add flags or options** to the program to modify it's behavior. +Have a look at the output below. + +``` +waldek@hellodebian:~$ ls +Desktop Documents Downloads Music Pictures Public Templates Videos +waldek@hellodebian:~$ ls -l +total 32 +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Desktop +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Documents +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Downloads +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Music +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Pictures +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Public +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Templates +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Videos +waldek@hellodebian:~$ ls -a +. .bashrc Desktop .gnupg .profile Templates .vboxclient-seamless.pid +.. .cache .dmrc .local Public .vboxclient-clipboard.pid Videos +.bash_history .config Documents Music .python_history .vboxclient-display-svga-x11.pid .Xauthority +.bash_logout .dbus Downloads Pictures .ssh .vboxclient-draganddrop.pid .xsession-errors +``` + +The `-l` and `-a` additions are what we call *flags* or *options*. +Aren't they just extra *arguments*? +There is no real rule to the naming of this concept but [this](https://unix.stackexchange.com/questions/285575/whats-the-difference-between-a-flag-an-option-and-an-argument) is a rather interesting take. + +We can combine arguments if we want, and some programs even allow *concatenation* of arguments. +Have a look below to understand what I mean by that. + +``` +waldek@hellodebian:~$ ls -a -l +total 112 +drwxr-xr-x 16 waldek waldek 4096 Feb 21 18:12 . +drwxr-xr-x 3 root root 4096 Feb 18 12:49 .. +-rw------- 1 waldek waldek 2772 Feb 22 10:45 .bash_history +-rw-r--r-- 1 waldek waldek 220 Feb 18 12:49 .bash_logout +-rw-r--r-- 1 waldek waldek 3526 Feb 18 12:49 .bashrc +drwx------ 16 waldek waldek 4096 Feb 18 14:24 .cache +drwx------ 20 waldek waldek 4096 Feb 18 14:23 .config +drwx------ 3 waldek waldek 4096 Feb 18 12:52 .dbus +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Desktop +-rw-r--r-- 1 waldek waldek 35 Feb 18 13:33 .dmrc +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Documents +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Downloads +drwx------ 2 waldek waldek 4096 Feb 18 15:07 .gnupg +drwxr-xr-x 3 waldek waldek 4096 Feb 18 12:50 .local +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Music +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Pictures +-rw-r--r-- 1 waldek waldek 807 Feb 18 12:49 .profile +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Public +-rw------- 1 waldek waldek 11 Feb 21 18:12 .python_history +drwx------ 2 waldek waldek 4096 Feb 21 12:45 .ssh +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Templates +-rw-r----- 1 waldek waldek 5 Feb 18 15:06 .vboxclient-clipboard.pid +-rw-r----- 1 waldek waldek 5 Feb 18 15:06 .vboxclient-display-svga-x11.pid +-rw-r----- 1 waldek waldek 5 Feb 18 15:06 .vboxclient-draganddrop.pid +-rw-r----- 1 waldek waldek 5 Feb 18 15:06 .vboxclient-seamless.pid +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Videos +-rw------- 1 waldek waldek 56 Feb 18 13:33 .Xauthority +-rw------- 1 waldek waldek 2701 Feb 18 13:33 .xsession-errors +waldek@hellodebian:~$ ls -la +total 112 +drwxr-xr-x 16 waldek waldek 4096 Feb 21 18:12 . +drwxr-xr-x 3 root root 4096 Feb 18 12:49 .. +-rw------- 1 waldek waldek 2772 Feb 22 10:45 .bash_history +-rw-r--r-- 1 waldek waldek 220 Feb 18 12:49 .bash_logout +-rw-r--r-- 1 waldek waldek 3526 Feb 18 12:49 .bashrc +drwx------ 16 waldek waldek 4096 Feb 18 14:24 .cache +drwx------ 20 waldek waldek 4096 Feb 18 14:23 .config +drwx------ 3 waldek waldek 4096 Feb 18 12:52 .dbus +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Desktop +-rw-r--r-- 1 waldek waldek 35 Feb 18 13:33 .dmrc +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Documents +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Downloads +drwx------ 2 waldek waldek 4096 Feb 18 15:07 .gnupg +drwxr-xr-x 3 waldek waldek 4096 Feb 18 12:50 .local +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Music +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Pictures +-rw-r--r-- 1 waldek waldek 807 Feb 18 12:49 .profile +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Public +-rw------- 1 waldek waldek 11 Feb 21 18:12 .python_history +drwx------ 2 waldek waldek 4096 Feb 21 12:45 .ssh +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Templates +-rw-r----- 1 waldek waldek 5 Feb 18 15:06 .vboxclient-clipboard.pid +-rw-r----- 1 waldek waldek 5 Feb 18 15:06 .vboxclient-display-svga-x11.pid +-rw-r----- 1 waldek waldek 5 Feb 18 15:06 .vboxclient-draganddrop.pid +-rw-r----- 1 waldek waldek 5 Feb 18 15:06 .vboxclient-seamless.pid +drwxr-xr-x 2 waldek waldek 4096 Feb 18 12:50 Videos +-rw------- 1 waldek waldek 56 Feb 18 13:33 .Xauthority +-rw------- 1 waldek waldek 2701 Feb 18 13:33 .xsession-errors +waldek@hellodebian:~$ +``` + +# Getting help + +## Options + +OK, so we have *a lot* of programs we can use on the command line, plus we can change how they work by adding obscure characters. +How on earth can we *discover* what a program can and can't do? +Introducing the **most important flag**: `--help`. + +Most programs come with builtin help to explain you how to use the program. +Often, but not always, this help can be displayed on the terminal by adding the `--help` flag. +Let's investigate this. + +``` +waldek@hellodebian:~$ ls --help +Usage: ls [OPTION]... [FILE]... +List information about the FILEs (the current directory by default). +Sort entries alphabetically if none of -cftuvSUX nor --sort is specified. + +Mandatory arguments to long options are mandatory for short options too. + -a, --all do not ignore entries starting with . + -A, --almost-all do not list implied . and .. + --author with -l, print the author of each file + -b, --escape print C-style escapes for nongraphic characters + --block-size=SIZE with -l, scale sizes by SIZE when printing them; + e.g., '--block-size=M'; see SIZE format below + -B, --ignore-backups do not list implied entries ending with ~ + -c with -lt: sort by, and show, ctime (time of last + modification of file status information); + with -l: show ctime and sort by name; + otherwise: sort by ctime, newest first + -C list entries by columns + --color[=WHEN] colorize the output; WHEN can be 'always' (default + if omitted), 'auto', or 'never'; more info below + -d, --directory list directories themselves, not their contents + -D, --dired generate output designed for Emacs' dired mode + -f do not sort, enable -aU, disable -ls --color + -F, --classify append indicator (one of */=>@|) to entries + --file-type likewise, except do not append '*' + --format=WORD across -x, commas -m, horizontal -x, long -l, + single-column -1, verbose -l, vertical -C + --full-time like -l --time-style=full-iso + -g like -l, but do not list owner + --group-directories-first + group directories before files; + can be augmented with a --sort option, but any + use of --sort=none (-U) disables grouping + -G, --no-group in a long listing, don't print group names + -h, --human-readable with -l and -s, print sizes like 1K 234M 2G etc. + --si likewise, but use powers of 1000 not 1024 + -H, --dereference-command-line + follow symbolic links listed on the command line + --dereference-command-line-symlink-to-dir + follow each command line symbolic link + that points to a directory + --hide=PATTERN do not list implied entries matching shell PATTERN + (overridden by -a or -A) + --hyperlink[=WHEN] hyperlink file names; WHEN can be 'always' + (default if omitted), 'auto', or 'never' + --indicator-style=WORD append indicator with style WORD to entry names: + none (default), slash (-p), + file-type (--file-type), classify (-F) + -i, --inode print the index number of each file + -I, --ignore=PATTERN do not list implied entries matching shell PATTERN + -k, --kibibytes default to 1024-byte blocks for disk usage; + used only with -s and per directory totals + -l use a long listing format + -L, --dereference when showing file information for a symbolic + link, show information for the file the link + references rather than for the link itself + -m fill width with a comma separated list of entries + -n, --numeric-uid-gid like -l, but list numeric user and group IDs + -N, --literal print entry names without quoting + -o like -l, but do not list group information + -p, --indicator-style=slash + append / indicator to directories + -q, --hide-control-chars print ? instead of nongraphic characters + --show-control-chars show nongraphic characters as-is (the default, + unless program is 'ls' and output is a terminal) + -Q, --quote-name enclose entry names in double quotes + --quoting-style=WORD use quoting style WORD for entry names: + literal, locale, shell, shell-always, + shell-escape, shell-escape-always, c, escape + (overrides QUOTING_STYLE environment variable) + -r, --reverse reverse order while sorting + -R, --recursive list subdirectories recursively + -s, --size print the allocated size of each file, in blocks + -S sort by file size, largest first + --sort=WORD sort by WORD instead of name: none (-U), size (-S), + time (-t), version (-v), extension (-X) + --time=WORD change the default of using modification times; + access time (-u): atime, access, use; + change time (-c): ctime, status; + birth time: birth, creation; + with -l, WORD determines which time to show; + with --sort=time, sort by WORD (newest first) + --time-style=TIME_STYLE time/date format with -l; see TIME_STYLE below + -t sort by time, newest first; see --time + -T, --tabsize=COLS assume tab stops at each COLS instead of 8 + -u with -lt: sort by, and show, access time; + with -l: show access time and sort by name; + otherwise: sort by access time, newest first + -U do not sort; list entries in directory order + -v natural sort of (version) numbers within text + -w, --width=COLS set output width to COLS. 0 means no limit + -x list entries by lines instead of by columns + -X sort alphabetically by entry extension + -Z, --context print any security context of each file + -1 list one file per line. Avoid '\n' with -q or -b + --help display this help and exit + --version output version information and exit + +The SIZE argument is an integer and optional unit (example: 10K is 10*1024). +Units are K,M,G,T,P,E,Z,Y (powers of 1024) or KB,MB,... (powers of 1000). +Binary prefixes can be used, too: KiB=K, MiB=M, and so on. + +The TIME_STYLE argument can be full-iso, long-iso, iso, locale, or +FORMAT. +FORMAT is interpreted like in date(1). If FORMAT is FORMAT1FORMAT2, +then FORMAT1 applies to non-recent files and FORMAT2 to recent files. +TIME_STYLE prefixed with 'posix-' takes effect only outside the POSIX locale. +Also the TIME_STYLE environment variable sets the default style to use. + +Using color to distinguish file types is disabled both by default and +with --color=never. With --color=auto, ls emits color codes only when +standard output is connected to a terminal. The LS_COLORS environment +variable can change the settings. Use the dircolors command to set it. + +Exit status: + 0 if OK, + 1 if minor problems (e.g., cannot access subdirectory), + 2 if serious trouble (e.g., cannot access command-line argument). + +GNU coreutils online help: +Full documentation +or available locally via: info '(coreutils) ls invocation' +waldek@hellodebian:~$ +``` + +The output above teaches us that the options `-la` change the output so it becomes: + +* `-a, --all do not ignore entries starting with .` +* `-l use a long listing format` + +To *not ignore entries starting with .* we can use two different flags, `-a` or `--all`. +The former is called short arguments and the latter long ones. +The long ones are more *verbose* so it's often easier to understand what a line *does* just by reading it. +Note that `ls` only has one way of showing the help by adding `--help` whereas the help for `htop` can be shown with both `-h` or `--help`. +This inconsistency is sadly a byproduct of the decentralized nature of Linux. +To add to this mess some programs use *single dash long form* (`-help`) but those programs are rather rare. + +## Manuals + +The `--help` flag is tremendously useful as it gives you an overview of how you can modify a programs behaviour, kind of like settings, but it doesn't always explain you what a program is *for*. +The is where the manuals come into play. +I see the `--help` flag as a *cheat sheet* to quickly discover options and the man pages as a reference. +We can read the manual by calling the `man` program with an argument. +This argument is the *name* of the program you want to read the manual for. +Same idea as with `which`. + +``` +waldek@hellodebian:~$ man ls +``` + +You're now in a program called `less`, which is a [pager](https://en.wikipedia.org/wiki/Terminal_pager). +You can scroll the manual with the arrows of `vi` based navigation (which we'll get into later). +If you hit `h` you'll see the builtin documentation of `less` and press `q` to quit (twice if you're in the help section). +This brings you back to your prompt. +It's worth reading the [wikipedia entry](https://en.wikipedia.org/wiki/Man_page) of the `man` command to understand it's history and operation. + +The output below illustrates the *tree* of a terminal that's reading a manual. +In a `bash` shell you invoke `man ls` which in turn runs the `pager` program to display the content. +If you're intrigued by this `pstree` program go and read the manual! + +``` +waldek@hellodebian:~$ pstree 10845 -a +bash + └─man ls + └─pager +waldek@hellodebian:~$ +``` + +Not every command has a manual. +For example, `cd` does not have one. +This is kind of logical because `cd` is a builtin. +To learn more about builtin commands you can use the `help` program. +On it's own it gives you all the builtin command you can invoke and with an argument it outputs the help about that specific command. + +``` +waldek@hellodebian:~$ help +GNU bash, version 5.1.4(1)-release (x86_64-pc-linux-gnu) +These shell commands are defined internally. Type `help' to see this list. +Type `help name' to find out more about the function `name'. +Use `info bash' to find out more about the shell in general. +Use `man -k' or `info' to find out more about commands not in this list. + +A star (*) next to a name means that the command is disabled. + + job_spec [&] history [-c] [-d offset] [n] or history -anrw [filename] or history -ps> + (( expression )) if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ else> + . filename [arguments] jobs [-lnprs] [jobspec ...] or jobs -x command [args] + : kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [> + [ arg... ] let arg [arg ...] + [[ expression ]] local [option] name[=value] ... + alias [-p] [name[=value] ... ] logout [n] + bg [job_spec ...] mapfile [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C c> + bind [-lpsvPSVX] [-m keymap] [-f filename] [-q name] [-u name] [-r keyse> popd [-n] [+N | -N] + break [n] printf [-v var] format [arguments] + builtin [shell-builtin [arg ...]] pushd [-n] [+N | -N | dir] + caller [expr] pwd [-LP] + case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac read [-ers] [-a array] [-d delim] [-i text] [-n nchars] [-N nchars] [-p> + cd [-L|[-P [-e]] [-@]] [dir] readarray [-d delim] [-n count] [-O origin] [-s count] [-t] [-u fd] [-C> + command [-pVv] command [arg ...] readonly [-aAf] [name[=value] ...] or readonly -p + compgen [-abcdefgjksuv] [-o option] [-A action] [-G globpat] [-W wordlis> return [n] + complete [-abcdefgjksuv] [-pr] [-DEI] [-o option] [-A action] [-G globpa> select NAME [in WORDS ... ;] do COMMANDS; done + compopt [-o|+o option] [-DEI] [name ...] set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...] + continue [n] shift [n] + coproc [NAME] command [redirections] shopt [-pqsu] [-o] [optname ...] + declare [-aAfFgiIlnrtux] [-p] [name[=value] ...] source filename [arguments] + dirs [-clpv] [+N] [-N] suspend [-f] + disown [-h] [-ar] [jobspec ... | pid ...] test [expr] + echo [-neE] [arg ...] time [-p] pipeline + enable [-a] [-dnps] [-f filename] [name ...] times + eval [arg ...] trap [-lp] [[arg] signal_spec ...] + exec [-cl] [-a name] [command [argument ...]] [redirection ...] true + exit [n] type [-afptP] name [name ...] + export [-fn] [name[=value] ...] or export -p typeset [-aAfFgiIlnrtux] [-p] name[=value] ... + false ulimit [-SHabcdefiklmnpqrstuvxPT] [limit] + fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep] [command] umask [-p] [-S] [mode] + fg [job_spec] unalias [-a] name [name ...] + for NAME [in WORDS ... ] ; do COMMANDS; done unset [-f] [-v] [-n] [name ...] + for (( exp1; exp2; exp3 )); do COMMANDS; done until COMMANDS; do COMMANDS; done + function name { COMMANDS ; } or name () { COMMANDS ; } variables - Names and meanings of some shell variables + getopts optstring name [arg ...] wait [-fn] [-p var] [id ...] + hash [-lr] [-p pathname] [-dt] [name ...] while COMMANDS; do COMMANDS; done + help [-dms] [pattern ...] { COMMANDS ; } +waldek@hellodebian:~$ help cd +cd: cd [-L|[-P [-e]] [-@]] [dir] + Change the shell working directory. + + Change the current directory to DIR. The default DIR is the value of the + HOME shell variable. + + The variable CDPATH defines the search path for the directory containing + DIR. Alternative directory names in CDPATH are separated by a colon (:). + A null directory name is the same as the current directory. If DIR begins + with a slash (/), then CDPATH is not used. + + If the directory is not found, and the shell option `cdable_vars' is set, + the word is assumed to be a variable name. If that variable has a value, + its value is used for DIR. + + Options: + -L force symbolic links to be followed: resolve symbolic + links in DIR after processing instances of `..' + -P use the physical directory structure without following + symbolic links: resolve symbolic links in DIR before + processing instances of `..' + -e if the -P option is supplied, and the current working + directory cannot be determined successfully, exit with + a non-zero status + -@ on systems that support it, present a file with extended + attributes as a directory containing the file attributes + + The default is to follow symbolic links, as if `-L' were specified. + `..' is processed by removing the immediately previous pathname component + back to a slash or the beginning of DIR. + + Exit Status: + Returns 0 if the directory is changed, and if $PWD is set successfully when + -P is used; non-zero otherwise. +waldek@hellodebian:~$ +``` + +Last but not least there are a few extra programs to give you quick and condensed information about a program, `whatis` and `apropos`. + +``` +waldek@hellodebian:~$ whatis bash +bash (1) - GNU Bourne-Again SHell +waldek@hellodebian:~$ apropos bash +bash (1) - GNU Bourne-Again SHell +bash-builtins (7) - bash built-in commands, see bash(1) +bashbug (1) - report a bug in bash +builtins (7) - bash built-in commands, see bash(1) +dh_bash-completion (1) - install bash completions for package +rbash (1) - restricted bash, see bash(1) +waldek@hellodebian:~$ +``` + +# Exercise + +**Read** some manual pages on the commands we've seen until now. +**Apply** some options you read about in the manual to experiment with said programs. + +# Creating and modifying + +## Directories + +## Files + +### `nano` + +### `vi` and `vim`