Exploring Ubuntu From Fundamentals(1)

2017-12-22 by terryoy, in tricks

Recently I have installed docker on my mac. It's such a wonderful virtualized environment that I don't need to install a whole system image on VirtualBox to explore in Ubuntu.

The docker image of Ubuntu is somehow essential subset of packages which give you the system environment. It doesn't even have vi or the lsb_release command for you to read the distro version. So I want to take some notes while I'm exploring the fundamentals in Ubuntu.

1. System Info

# Check Ubuntu version
$ cat /etc/issue
$ cat /etc/issue.net
Ubuntu 16.04.3 LTS

# More information of Ubuntu
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.3 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.3 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

# System Services
$ service --status-all
 [ - ]  bootmisc.sh
 [ - ]  checkfs.sh
 [ - ]  checkroot-bootclean.sh
 [ - ]  checkroot.sh
 [ - ]  hostname.sh
 [ ? ]  hwclock.sh
 [ - ]  killprocs
 [ - ]  mountall-bootclean.sh
 [ - ]  mountall.sh
 [ - ]  mountdevsubfs.sh
 [ - ]  mountkernfs.sh
 [ - ]  mountnfs-bootclean.sh
 [ - ]  mountnfs.sh
 [ ? ]  ondemand
 [ - ]  procps
 [ - ]  rc.local
 [ - ]  sendsigs
 [ - ]  umountfs
 [ - ]  umountnfs.sh
 [ - ]  umountroot
 [ - ]  urandom

# Supported Shells
$ cat /etc/shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash

I have install vim and man-db to acquire the ability of text editing and manual reading. Now let's check what packages we have installed.

$ apt list --installed

# or if you just want the count
$ apt list --installed | grep installed | wc -l 

# or if you want to see a description of each pacakge
$ dpkg-query -l

Now I can see that the essential packages to run my system has only 116 packages and 62 of them are libs.

2. Reading Manuals

The most important documentation tool in Linux is man, another is info from package “texinfo”. And there are also something you can find in /usr/share/doc, although many packages just use it for change logs and copyright, but the readme part is sometimes helpful information.

The man command is in man-db package, and info is in info package.

2.1 Man pages

Man pages are grouped the documents of packages into 8(or 9) sections.

  • 1 Executable programs or shell commands
  • 2 System calls (functions provided by the kernel)
  • 3 Library calls (functions within program libraries)
  • 4 Special files (usually found in /dev)
  • 5 File formats and conventions eg /etc/passwd
  • 6 Games
  • 7 Miscellaneous (including macro packages and conventions), e.g. man(7), groff(7)
  • 8 System administration commands (usually only for root)
  • 9 Kernel routines [Non standard]

The numbers of sections you see here, are used to marked the pages when cross reference in man pages. For example, you can see “man(7)”, “mandb(8)”, etc. Sometimes there will be a same keyword in different sections. You can view all man pages of the same keyword, or specify which section you want to see, or search man pages by keyword.

# view man page for man
$ man man

# view all "intro" in every section
$ man -a intro

# view "intro" in section 3
$ man -s 3 intro

# list all man pages
$ man -k .

# list all man pages in section 5
$ man -s 5 -k .

# list all man pages in section 5 match keyword 'systemd'
$ man -s 5 -k systemd

2.2 Info pages

This kind of document is written in texinfo, supported in Emacs, generated by makeinfo;

The texinfo format has node structure, and can export to different format such as HTML, etc. The info command more navigation methods to the document.

Read here about the keyboard interface.

2.3 Dcoumentation paths

  • /usr/share/man, folder for man pages of pacakges. They're separated into different sections man(1-9) according the pacakge categories.
  • /usr/share/info, folder for info pages, which is meant for providing more detail information, and it's generally used in GNU projects, but man pages are in much greater favour.
  • /usr/share/doc, folder for holding other document or refernces. Most packages contains only changelog and copyright info, some provided a README file, and some package provides templates or configuration files.


Tags: linux