This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||
linux:installation [2017/02/13 09:35] mstraub [Init Daemons] |
linux:installation [2019/10/02 11:02] mstraub [Shared Libraries] |
||
---|---|---|---|
Line 68: | Line 68: | ||
</code> | </code> | ||
+ | ===== Hostname ===== | ||
+ | |||
+ | The host name is persisted in ''/etc/hostname'' and can be shown with ''hostname'' or (using the systemd-way) with ''hostnamectl''. | ||
+ | |||
+ | To change the host name | ||
+ | - use ''sudo hostname <NAME>'' to set the host name now (would not survive a reboot) | ||
+ | - edit ''/etc/hostname'' to set it permanently | ||
+ | - edit ''/etc/hosts'' to properly map the new host name to localhost | ||
+ | |||
+ | Instead of the first two steps you can also use | ||
+ | <code bash> | ||
+ | hostnamectl set-hostname <NAME> | ||
+ | </code> | ||
===== Date & Timezone ===== | ===== Date & Timezone ===== | ||
Line 76: | Line 89: | ||
== hwclock == | == hwclock == | ||
- | The hardware clock can be read and set (by root only) with the ''hwclock'' command. The parameters ''--utc'' and ''--localtime'' tell if the hardware clock is / should be set to UTC or local time. | + | The hardware clock can be read and set (by root only) with the ''hwclock'' command. The parameters ''%%--utc%%'' and ''%%--localtime%%'' tell if the hardware clock is / should be set to UTC or local time. |
**Note, however, that hwclock always prints and expects (when setting) date in local time.** | **Note, however, that hwclock always prints and expects (when setting) date in local time.** | ||
Line 291: | Line 304: | ||
===== Mounting ===== | ===== Mounting ===== | ||
- | The ''mount'' command and various files can be used to inquire the currently mounted devices and swap spaces. | + | The ''findmnt'' command and various files can be used to inquire the currently mounted devices and swap spaces. |
<code bash> | <code bash> | ||
- | mount # show currently mounted devices | + | lsblk # list block devices (i.e. no network or virtual devices) |
+ | findmnt # show all currently mounted devices | ||
+ | findmnt -t ext4,cifs # show mounted devices with a certain file system type | ||
+ | mount # show all currently mounted devices (deprecated!) | ||
cat /etc/mtab # .. | cat /etc/mtab # .. | ||
cat /proc/mounts # .. | cat /proc/mounts # .. | ||
Line 501: | Line 517: | ||
Modern event-based replacement for ''init'', used by most distributions in 2015. | Modern event-based replacement for ''init'', used by most distributions in 2015. | ||
- | Init scripts are represented as "service units" in the form of ''.service'' files, which can be found in ''/lib/systemd/system'' (preinstalled) and ''/etc/systemd/system'' (to be edited by the admin). | + | Init scripts are represented as [[https://www.freedesktop.org/software/systemd/man/systemd.service.html|service units]] in the form of ''.service'' files, which can be found in ''/lib/systemd/system'' (preinstalled) and ''/etc/systemd/system'' (to be edited by the admin). |
+ | Example of a ''.service'' file with the the three sections: | ||
+ | <code> | ||
+ | [Unit] | ||
+ | Description=Foo | ||
+ | [Service] | ||
+ | ExecStart=/usr/sbin/foo-daemon | ||
+ | |||
+ | [Install] | ||
+ | WantedBy=multi-user.target | ||
+ | </code> | ||
+ | |||
+ | Starting and stopping services works as follows: | ||
+ | <code bash> | ||
+ | systemctl start myservice | ||
+ | systemctl stop myservice | ||
+ | systemctl status myservice | ||
+ | </code> | ||
+ | |||
+ | Logs of a service can be accessed via ''journalctl'': | ||
+ | <code bash> | ||
+ | journalctl -u myservice | ||
+ | </code> | ||
====== Package Management ====== | ====== Package Management ====== | ||