Skip to content
Wiki is under a full-reconstruction. Please be patient and look for updates!

Linux questions and answers

Use this page as a quick reference for common Ubuntu self-hosting tasks.

If you run a script like ./myscript.sh and want it to start automatically after reboot, create a systemd unit.

/etc/systemd/system/myscript.service
[Unit]
Description=Virtual Distributed Ethernet
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/YOUR_SCRIPT
Restart=on-failure
[Install]
WantedBy=multi-user.target

Reload systemd, enable the service, and start it:

Reload and enable service
sudo systemctl daemon-reload
sudo systemctl enable myscript.service
sudo systemctl start myscript.service
sudo systemctl status myscript.service

Open your crontab:

Terminal window
crontab -e

Add this line at the bottom:

Terminal window
0 4 * * * /sbin/shutdown -r +5

This announces reboot at 04:00 and reboots at 04:05.

Cron format:

m h dom mon dow command

Check Docker disk usage:

Terminal window
docker system df

Prune commands:

  • docker container prune
  • docker image prune
  • docker network prune
  • docker volume prune
  • docker system prune

Remove all unused images (not only dangling):

Terminal window
docker image prune -a

Remove most unused Docker objects:

Terminal window
docker system prune --all

Check filesystem usage:

Terminal window
df -h

Install and run ncdu for interactive analysis:

Install ncdu
sudo apt install -y ncdu
Scan root filesystem
sudo ncdu /

Common cleanup targets:

  1. Old logs in /var/log:

    Terminal window
    sudo journalctl --vacuum-time=2d
  2. Unused Docker objects in /var/lib/docker:

    Terminal window
    sudo docker image prune
    sudo docker container prune
    sudo docker network prune
    sudo docker volume prune
    sudo docker system prune -a
  3. Unused packages:

    Terminal window
    sudo apt autoremove
Terminal window
wget -qO - "https://raw.githubusercontent.com/vernette/ipregion/refs/heads/master/ipregion.sh" | bash
Terminal window
sudo apt update && sudo apt install -y curl && curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash && sudo apt install -y speedtest && speedtest
Terminal window
bash <(curl -Ls IP.Check.Place) -l en

Environment info and tests with Russian ISPs

Section titled “Environment info and tests with Russian ISPs”
Terminal window
wget -qO- speedtest.artydev.ru | bash
Terminal window
wget -qO- bench.sh | bash
  1. Check supported CPU level

    Terminal window
    wget https://dl.xanmod.org/check_x86-64_psabi.sh
    chmod +x check_x86-64_psabi.sh
    ./check_x86-64_psabi.sh
  2. Register Xanmod signing key

    Terminal window
    wget -qO - https://dl.xanmod.org/archive.key | sudo gpg --dearmor -vo /etc/apt/keyrings/xanmod-archive-keyring.gpg
  3. Add Xanmod repository

    Terminal window
    echo 'deb [signed-by=/etc/apt/keyrings/xanmod-archive-keyring.gpg] http://deb.xanmod.org releases main' | sudo tee /etc/apt/sources.list.d/xanmod-release.list
  4. Install kernel package

    Terminal window
    sudo apt update && sudo apt install linux-xanmod-x64v3
  5. Apply BBR tuning if your stack needs it, then reboot.

Add stricter ICMP rate limits in /etc/sysctl.conf:

Terminal window
cat <<'EOT' | sudo tee -a /etc/sysctl.conf
net.ipv4.icmp_msgs_burst=1
net.ipv4.icmp_msgs_per_sec=1
net.ipv4.icmp_ratelimit=1
net.ipv6.icmp.ratelimit=1
EOT
sudo sysctl -p

Use this only after testing, because aggressive ICMP limits can complicate troubleshooting and network diagnostics.