Skip to content

Latest commit

 

History

History
127 lines (83 loc) · 4.4 KB

linux.md

File metadata and controls

127 lines (83 loc) · 4.4 KB

Linux - Misc notes for various distros that I use

Table of contents

systemd

systemd-analyze

This tool can be used to display the startup time for various units. This information helps to pinpoint delays in the startup process.

From the manual page:

This command prints a tree of the time-critical chain of units (for each of the specified UNITs or for the default target otherwise). The time after the unit is active or started is printed after the "@" character. The time the unit takes to start is printed after the "+" character. Note that the output might be misleading as the initialization of services might depend on socket activation and because of the parallel execution of units.

Examples:

  • sudo systemd-analyze critical-chain

    • overall causes of boot delay
  • sudo systemd-analyze critical-chain rsyslog.service

    • display "critical-chain" for specific unit
  • sudo systemd-analyze critical-chain rsyslog.service docker.service

    • display "critical-chain" for specific units

unit files

override unit file

systemctl edit rsyslog.service

This creates a /etc/systemd/system/rsyslog.service.d/override.conf file with settings enterered via the interactive editor that is opened (likely determined via $EDITOR environment variable).

You can also create multiple "drop-in" files (aka, "drop-ins") manually to override specific settings.

revert unit file overrides

sudo systemctl revert

As noted by Stephen Kitt (StackExchange member):

This reverts the given unit to its vendor configuration, deleting all overrides. (It will also restore the unit's properties to their defaults, and unmask it if it was masked by the administrator.)

journalctl

Show kernel log messages with an ERROR priority

sudo journalctl -p err -k

Show log messages with an INFO priority since the last boot

sudo journalctl -p info -b

Show ALL log messages between a time range

sudo journalctl --since "2018-07-15 15:00:00" --until "2018-07-15 16:00:00"

The --since and --until options can be used together (as shown here) or separately as needed for the desired effect.

Force time (shown in local time by default) to be displayed in UTC

sudo journalctl --utc

List messages for a specific systemd unit (e.g., rsyslog)

sudo journalctl -u rsyslog.service

"Tail" messages for a specific systemd unit (e.g., rsyslog)

sudo journalctl -f -u rsyslog.service

Show messages from most recent boot

Specific service:

sudo journalctl -b -u nginx.service

Everything:

sudo journalctl -b

Ubuntu

Environment variables

  • /etc/environment
    • Common/central location for setting environment variables
    • Example: ES_HEAP_SIZE="512M"

References