# Change the default target: systemctl set-default graphical.target # Switch target in real time: systemctl isolate multi-user.target # Create a custom service – /etc/systemd/system/myapp.service: [Unit] Description=My App After=network.target [Service] ExecStart=/usr/bin/myapp Restart=always [Install] WantedBy=multi-user.target
# Enable hook in /etc/mkinitcpio.conf: HOOKS=(base udev autodetect modconf block myhook filesystems keyboard fsck) # Rebuild initramfs after adding the hook: mkinitcpio -P # all presets mkinitcpio -p linux # 'linux' preset only
#!/bin/sh
run_latehook() {
# Solarized Dark inspired palette
local palette=\
"002b36 dc322f 859900 b58900 \
268bd2 d33682 2aa198 eee8d5 \
073642 cb4b16 586e75 657b83 \
839496 6c71c4 93a1a1 fdf6e3"
local i=0 seqs=''
for col in $palette; do
seqs="${seqs}\033]P$(printf '%X' $i)${col}"
i=$((i+1))
done
for tty in /dev/tty[0-6]; do
[ -w "$tty" ] || continue
printf "$seqs" > "$tty"
printf "\033[H\033[J" > "$tty"
[ -f /font.psf.gz ] &&
setfont -C "$tty" /font.psf.gz
done
}
#!/bin/bash
build() {
add_runscript
add_binary setfont
add_binary printf
# Find font
local fp=$(find \
/usr/share/kbd/consolefonts/ \
-name 'ter-v28b*' | head -1)
if [ -n "$fp" ]; then
add_file "$fp" /font.psf.gz
else
echo 'WARNING: font missing!'
fi
}
help() {
cat <<EOF
Sets Solarized Dark palette
and loads Terminus 28px font
on all VTs during boot.
EOF
}
startx or xinit--replace# Start plain X11: startx # reads ~/.xinitrc xinit /usr/bin/openbox -- :0 # ~/.xinitrc example: exec openbox-session
# Start a Wayland session (sway): sway # from a plain TTY dbus-launch --exit-with-session sway # Wayland environment variables: export XDG_SESSION_TYPE=wayland
# Replace the running WM with another one (X11): openbox --replace & # replace current WM with Openbox i3 --replace & # replace with i3 bspwm & # bspwm lacks --replace; force it: pkill -x openbox && bspwm # Check the current WM: wmctrl -m # requires: pacman -S wmctrl
Native DM for KDE/Qt. Supports X11 and Wayland. Easy theme configuration.
GNOME Display Manager. Deep integration with GNOME and systemd-logind.
Lightweight, DE-agnostic. Multiple greeters (GTK, Qt, WebKit).
TUI – minimalist terminal DM. No graphics, minimal dependencies.
Modern, IPC protocol. Configurable greeter (tuigreet, agreety).
Part of LXDE. Lightweight GTK3, simple interface.
# Install and enable SDDM: pacman -S sddm systemctl enable sddm.service systemctl start sddm.service # Switch DM (disable old one, enable new one): systemctl disable lightdm.service systemctl enable sddm.service
# Session files – where DM looks for sessions: ls /usr/share/xsessions/ # X11 sessions ls /usr/share/wayland-sessions/ # Wayland sessions # Custom session ~/.dmrc (for some DMs): [Desktop] Session=i3
# Create a user: useradd -m -G wheel,audio,video \ -s /bin/bash john passwd john # Modify a user: usermod -aG docker john # add to group usermod -s /bin/zsh john # change shell userdel -r john # remove with home
# Group management: groupadd devs groupmod -n developers devs groupdel developers # Inspection: groups john # user's groups id john # UID, GID, groups cat /etc/passwd # user list
chmod 755 script.sh # rwxr-xr-x (owner=rwx, group=rx, other=rx) chmod u+x,g-w file # symbolic: add x for owner, remove w for group chmod -R 644 directory/ # recursive: rw-r--r-- for all files chmod o-rwx secret.txt # revoke all permissions for 'others'
# chown – change ownership: chown john file.txt chown john:devs file.txt chown -R www-data:www-data /var/www # Group only: chgrp audio /dev/snd/*
# chattr – filesystem attributes: chattr +i file.txt # immutable (locked) chattr -i file.txt # remove immutable chattr +a log.txt # append-only lsattr file.txt # show attributes # Works on ext2/3/4, btrfs
| Bit | Value | Command | Effect |
|---|---|---|---|
| SUID | 4xxx | chmod u+s /usr/bin/prog | Runs as the file owner |
| SGID | 2xxx | chmod g+s /directory | New files inherit directory's group |
| Sticky | 1xxx | chmod +t /tmp | Only owner or root can delete the file |