utils to manage a linux system
Created: 2026-11-03 mar 12:20
This article contains the most relevant commands and examples to administrate a linux system and networking
I mainly use ubuntu and apt
apt list installed packages
apt list --installed
cleanup packages
sudo apt update
sudo apt clean
sudo apt autoclean
sudo apt autoremove
pip cache purge
Clean disk space
journalctl --disk-usage
sudo journalctl --vacuum-size=200M # clean up old entries
sudo truncate -s 0 /var/log/syslog
Check syslog
# Check recent entries
tail -n 50 /var/log/syslog # or /var/log/messages on RHEL/CentOS
# Look for repeating patterns (replace with actual hostname/service)
grep -c "your-hostname" /var/log/syslog
grep -i "error\|warn\|debug\|fail" /var/log/syslog | tail -n 20
# Check file size & age
ls -lh /var/log/syslog*
stat /var/log/syslog
# Debian/Ubuntu (rsyslogd)
cat /etc/logrotate.d/rsyslogd
# Check if rotation is actually running
systemctl status logrotate.timer # or cron service
# Check if it's running & its status
systemctl status <service-name>
# Temporarily stop it to halt logging
sudo systemctl stop <service-name>
# Check kernel messages (if dmesg is spamming)
dmesg | tail -n 50
# Safe truncation (releases disk space immediately)
sudo truncate -s 0 /var/log/syslog
# Or rotate manually & compress
sudo logrotate -f /etc/logrotate.d/rsyslogd # force rotation
sudo systemctl restart rsyslogd # or syslog-ng, depending on your distro
sudo snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
sudo snap remove "$snapname" --revision="$revision"
done
pnpm has better options than npm because it reuses many installation libraries
sudo apt install npm
sudo npm install -g pnpm
to check what packages we installed
npm list -g
/usr/local/lib └── eslint@10.4.1
npm ls -g
/usr/local/lib └── eslint@10.4.1
I prefer pnpm which shares node_modules directories
pnpm config set store-dir ~/.pnpm-store
#cat "store-dir=~/.pnpm-store\nshamefully-hoist=true\nglobal-dir=~/.config/node_modules\ncache-dir=~/.cache/pnpm\ncolor=auto\nloglevel=info" > ~/.npmrc
pnpm config get store-dir
Remove package
dropbox stop
dropbox status # Should report "not running"
rm -rf ~/.dropbox-dist
rm -rf /var/lib/dropbox
rm -rf ~/.dropbox*
sudo apt-get remove nautilus-dropbox
sudo apt-get remove dropbox
rm /etc/apt/source.d/dropbox
Fix broken not working
sudo dpkg --force-all --configure -a
sudo dpkg --purge --force-depends libnettle6
sudo apt --fix-broken install
sudo apt-get -f install
sudo apt update & sudo apt upgrade
sys info
lsb_release -a
uname -a
Distributor ID: Ubuntu Description: Ubuntu 26.04 LTS Release: 26.04 Codename: resolute Linux manitro 7.0.0-29-generic #29-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 17 20:52:35 UTC 2026 x86_64 GNU/Linux
To monitor system performances ref.
Write a .conkyrc where we display system info. Elegant, transparent, discrete with a sci-fi look. I need to know CPU, GPU, NPU, RAM, VRAM, temperature, fans, disk space
sudo apt install conky-all lm-sensors
A running example
use_xft yesxftfont HandelGotD:size=9xftalpha 0.5update_interval 4.0total_run_times 0own_window yesown_window_type normalown_window_transparent yesown_window_hints undecorated,below,sticky,skip_taskbar,skip_pagerdouble_buffer yesminimum_size 200 5maximum_width 220draw_shades nodraw_outline nodraw_borders nodraw_graph_borders yesdefault_color greydefault_shade_color reddefault_outline_color greenalignment top_rightgap_x 12gap_y 48no_buffers yesuppercase nocpu_avg_samples 2override_utf8_locale yesTEXT${alignc 35}${font Trebuchet MS:size=26} $nodename ${font}Uptime $alignr $uptimeLoad $alignr $loadavgeth0 $alignr ${addr eth0}Inbound (${totaldown eth0}) $alignr ${downspeed eth0} kb/s${downspeedgraph eth0}Outbound (${totalup eth0}) $alignr ${upspeed eth0} kb/s${upspeedgraph eth0}CPU ${acpitemp}°C $alignr {cpu cpu0}%${cpubar cpu0}${cpubar cpu1}${cpubar cpu2}${cpubar cpu3}MEM $alignc $mem / $memmax $alignr $memperc%$membar/ $alignc ${fs_used /} / ${fs_size /} $alignr ${fs_free_perc /}%${fs_bar /}/home $alignc ${fs_used /home} / ${fs_size /home} $alignr ${fs_free_perc /home}%${fs_bar /home}Top Processes ${hr 2}NAME $alignr PID CPU${top name 1} $alignr ${top pid 1} ${top cpu 1}${top name 2} $alignr ${top pid 2} ${top cpu 2}${top name 3} $alignr ${top pid 3} ${top cpu 3}${top name 4} $alignr ${top pid 4} ${top cpu 4}${top name 5} $alignr ${top pid 5} ${top cpu 5}${top name 6} $alignr ${top pid 6} ${top cpu 6}${top name 7} $alignr ${top pid 7} ${top cpu 7}
Many packages suffer with locale different from en_US.UTF-8
locale # check for UTF-8
sudo apt update && sudo apt install locales
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
locale # verify settings
lsof -i :8888 | awk 'NR==1 || $9 ~ /PID/' | grep -v "^$" | awk '{print $1}' | xargs -r kill -9
pstree | head -5
systemd-+-ModemManager---3*[{ModemManager}]
|-NetworkManager---3*[{NetworkManager}]
|-accounts-daemon---3*[{accounts-daemon}]
|-avahi-daemon---avahi-daemon
|-bluetoothd
systemctl --type=service --state=running
| UNIT | LOAD | ACTIVE | SUB | DESCRIPTION | |||||||
| accounts-daemon.service | loaded | active | running | Accounts | Service | ||||||
| avahi-daemon.service | loaded | active | running | Avahi | mDNS/DNS-SD | Stack | |||||
| bluetooth.service | loaded | active | running | Bluetooth | service | ||||||
| bolt.service | loaded | active | running | Thunderbolt | system | service | |||||
| chrony.service | loaded | active | running | chrony, | an | NTP | client/server | ||||
| colord.service | loaded | active | running | Manage, | Install | and | Generate | Color | Profiles | ||
| containerd.service | loaded | active | running | containerd | container | runtime | |||||
| cron.service | loaded | active | running | Regular | background | program | processing | daemon | |||
| cups-browsed.service | loaded | active | running | Make | remote | CUPS | printers | available | locally | ||
| cups.service | loaded | active | running | CUPS | Scheduler | ||||||
| dbus.service | loaded | active | running | D-Bus | System | Message | Bus | ||||
| docker.service | loaded | active | running | Docker | Application | Container | Engine | ||||
| fwupd.service | loaded | active | running | Firmware | update | daemon | |||||
| gdm.service | loaded | active | running | GNOME | Display | Manager | |||||
| lemond.service | loaded | active | running | Lemonade | Server | ||||||
| lttng-sessiond.service | loaded | active | running | LTTng | session | daemon | |||||
| ModemManager.service | loaded | active | running | Modem | Manager | ||||||
| networkd-dispatcher.service | loaded | active | running | Dispatcher | daemon | for | systemd-networkd | ||||
| NetworkManager.service | loaded | active | running | Network | Manager | ||||||
| nvidia-persistenced.service | loaded | active | running | NVIDIA | Persistence | Daemon | |||||
| nvidia-powerd.service | loaded | active | running | nvidia-powerd | service | ||||||
| polkit.service | loaded | active | running | Authorization | Manager | ||||||
| postfix.service | loaded | active | running | Postfix | Transport | Agent | (main/default | instance) | |||
| power-profiles-daemon.service | loaded | active | running | Power | Profiles | daemon | |||||
| rsyslog.service | loaded | active | running | System | Logging | Service | |||||
| rtkit-daemon.service | loaded | active | running | RealtimeKit | Scheduling | Policy | Service | ||||
| snap.cups.cups-browsed.service | loaded | active | running | Service | for | snap | application | cups.cups-browsed | |||
| snap.cups.cupsd.service | loaded | active | running | Service | for | snap | application | cups.cupsd | |||
| snapd.service | loaded | active | running | Snap | Daemon | ||||||
| switcheroo-control.service | loaded | active | running | Switcheroo | Control | Proxy | service | ||||
| systemd-journald.service | loaded | active | running | Journal | Service | ||||||
| systemd-logind.service | loaded | active | running | User | Login | Management | |||||
| systemd-oomd.service | loaded | active | running | Userspace | Out-Of-Memory | (OOM) | Killer | ||||
| systemd-resolved.service | loaded | active | running | Network | Name | Resolution | |||||
| systemd-udevd.service | loaded | active | running | Rule-based | Manager | for | Device | Events | and | Files | |
| udisks2.service | loaded | active | running | Disk | Manager | ||||||
| unattended-upgrades.service | loaded | active | running | Unattended | Upgrades | Shutdown | |||||
| upower.service | loaded | active | running | Daemon | for | power | management | ||||
| user@1000.service | loaded | active | running | User | Manager | for | UID | 1000 | |||
| uuidd.service | loaded | active | running | Daemon | for | generating | UUIDs | ||||
| wpa_supplicant.service | loaded | active | running | WPA | supplicant | ||||||
| Legend: | LOAD | → | Reflects | whether | the | unit | definition | was | properly | loaded. | |
| ACTIVE | → | The | high-level | unit | activation | state, | i.e. | generalization | of | SUB. | |
| SUB | → | The | low-level | unit | activation | state, | values | depend | on | unit | type. |
| 41 | loaded | units | listed. |
sudo service lemond status
sudo systemctl disable lemond
printf 'Desktop: %s\nSession: %s\n' "$XDG_CURRENT_DESKTOP" "$GDMSESSION(tiling for example[[https://extensions.gnome.org/#sort=relevance][web browser addon][GeForce 940MX(rev a2<<EOF
Types: deb
URIs: https://download.docker.com/linux/ubuntu
Suites: $(. /etc/os-release && echo "${UBUNTU_CODENAME:-$VERSION_CODENAME}")
Components: stable
Architectures: $(dpkg --print-architecture)
Signed-By: /etc/apt/keyrings/docker.asc
EOF
sudo apt update
sudo apt install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl status docker
sudo systemctl start docker
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
sudo apt-get update
sudo apt-get install -y --no-install-recommends ca-certificates curl gnupg2
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg \
&& curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
ss -tlnp | grep 13305
LISTEN 0 4096 0.0.0.0:13305 0.0.0.0:* LISTEN 0 4096 [::]:13305 [::]:*
# View running processes
ps aux | head -10
#ps -ef --sort=-%cpu
#+BEGIN_SRC shell
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMANDroot 1 0.0 0.0 28020 12880 ? Ss Jun15 4:08 /usr/lib/systemd/systemd --switched-root --system --deserialize=52 splashroot 2 0.0 0.0 0 0 ? S Jun15 0:01 [kthreadd]root 3 0.0 0.0 0 0 ? S Jun15 0:00 [pool_workqueue_release]root 4 0.0 0.0 0 0 ? I< Jun15 0:00 [kworker/R-rcu_gp]root 5 0.0 0.0 0 0 ? I< Jun15 0:00 [kworker/R-sync_wq]root 6 0.0 0.0 0 0 ? I< Jun15 0:00 [kworker/R-kvfree_rcu_reclaim]root 7 0.0 0.0 0 0 ? I< Jun15 0:00 [kworker/R-slub_flushwq]root 8 0.0 0.0 0 0 ? I< Jun15 0:00 [kworker/R-netns]root 10 0.0 0.0 0 0 ? I< Jun15 0:00 [kworker/0:0H-kblockd]
kill -9 <PID>
pkill -f <process-name>
sudo systemctl stop <service>
= User Management =
# Add user
sudo adduser <username>
# Remove user
sudo deluser <username>
sudo userdel -r <username>
# View users
sudo cat /etc/passwd
= File System & Disk =
# Check disk space
df -h
# Check filesystem errors
sudo fsck -f /dev/<device>
# View inode usage
sudo du -sh /* | sort -hr
= Network Diagnostics =
# Test connectivity
ping -c 4 <hostname>
traceroute <hostname>
dig <hostname>
# Check open ports
sudo netstat -tulpn
sudo ss -tulpn
= System Logs =
# View logs
sudo journalctl -xe
sudo tail -f /var/log/syslog
sudo grep <error> /var/log/syslog | tail -100
= Package Management =
# Update packages
sudo apt update && sudo apt upgrade -y
# Search packages
apt search <keyword>
# Remove packages with dependencies
sudo apt remove <package>
We can configure the system behavior
#sudo apt install dconf-editor
xev -event keyboard
I want to map the menu key
KeyRelease event, serial 28, synthetic NO, window 0x1000001,root 0x352, subw 0x0, time 913179790, (-526,-209), root:(345,337),state 0x0, keycode 135 (keysym 0xff67, Menu), same_screen YES,XLookupString gives 0 bytes:XFilterEvent returns: False
Annoying close window prompt on applications with background operations
# extend ubuntu timeout to check if a window is still alive
gsettings set org.gnome.mutter check-alive-timeout 60000
echo -e "keycode 66 = Hyper_L\nkeycode 118 = Hyper_L\nkeycode 135 = Hyper_L\nkeycode 133 = Hyper_L" > ~/.xmodmap
xmodmap ~/.xmodmap
#xbindkeys
# gsettings reset-recursively org.gnome.desktop.input-sources
# gsettings reset-recursively org.gnome.desktop.wm.keybindings
gsettings list-recursively org.gnome.desktop.input-sources
gsettings set org.gnome.desktop.input-sources xkb-options "['caps:hyper', 'insert:hyper', 'menu:hyper', 'keycode_133:hyper']"
gsettings get org.gnome.desktop.input-sources xkb-options
# gsettings set org.gnome.desktop.wm.keybindings panel-main-menu "[]"
# gsettings set org.gnome.desktop.wm.keybindings show-desktop "[]"
# gsettings set org.gnome.desktop.wm.keybindings toggle-fullscreen "[]"
#xkeyboard-config
org.gnome.desktop.input-sources current uint32 0 org.gnome.desktop.input-sources mru-sources @a(ss) [] org.gnome.desktop.input-sources per-window false org.gnome.desktop.input-sources show-all-sources false org.gnome.desktop.input-sources sources @a(ss) [] org.gnome.desktop.input-sources xkb-model 'pc105+inet' org.gnome.desktop.input-sources xkb-options @as [] ['caps:hyper', 'insert:hyper', 'menu:hyper']
setxkbmap -option caps:hyper -option insert:hyper -option menu:hyper -option keycode_133:hyper
ifconfig
br-0efbd0189d0b: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet 172.18.0.1 netmask 255.255.0.0 broadcast 172.18.255.255inet6 fe80::8845:74ff:fe9b:2a34 prefixlen 64 scopeid 0x20<link>ether 8a:45:74:9b:2a:34 txqueuelen 0 (Ethernet)RX packets 0 bytes 0 (0.0 B)RX errors 0 dropped 0 overruns 0 frame 0TX packets 0 bytes 0 (0.0 B)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255inet6 fe80::18a8:d9ff:fe04:fcee prefixlen 64 scopeid 0x20<link>ether 1a:a8:d9:04:fc:ee txqueuelen 0 (Ethernet)RX packets 1378329 bytes 76106951 (76.1 MB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 2277146 bytes 17072057476 (17.0 GB)TX errors 0 dropped 754 overruns 0 carrier 0 collisions 0enp1s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500ether c8:5b:76:52:8b:5b txqueuelen 1000 (Ethernet)RX packets 0 bytes 0 (0.0 B)RX errors 0 dropped 0 overruns 0 frame 0TX packets 0 bytes 0 (0.0 B)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536inet 127.0.0.1 netmask 255.0.0.0inet6 ::1 prefixlen 128 scopeid 0x10<host>loop txqueuelen 1000 (Local Loopback)RX packets 17162 bytes 1796876 (1.7 MB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 17162 bytes 1796876 (1.7 MB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0veth1684e57: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet6 fe80::d81e:aeff:fe72:4d1d prefixlen 64 scopeid 0x20<link>ether da:1e:ae:72:4d:1d txqueuelen 0 (Ethernet)RX packets 11 bytes 598 (598.0 B)RX errors 0 dropped 0 overruns 0 frame 0TX packets 386 bytes 213031 (213.0 KB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0veth33a8a86: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet6 fe80::bc6b:6eff:fe53:2480 prefixlen 64 scopeid 0x20<link>ether be:6b:6e:53:24:80 txqueuelen 0 (Ethernet)RX packets 26452 bytes 2688148 (2.6 MB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 44586 bytes 144310169 (144.3 MB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0veth38c6122: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet6 fe80::980c:3fff:fe33:82d1 prefixlen 64 scopeid 0x20<link>ether 9a:0c:3f:33:82:d1 txqueuelen 0 (Ethernet)RX packets 3 bytes 126 (126.0 B)RX errors 0 dropped 0 overruns 0 frame 0TX packets 1672 bytes 919330 (919.3 KB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0vethc7d9473: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet6 fe80::cd2:abff:fe4f:7fb3 prefixlen 64 scopeid 0x20<link>ether 0e:d2:ab:4f:7f:b3 txqueuelen 0 (Ethernet)RX packets 736074 bytes 50653576 (50.6 MB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 1574469 bytes 7053971724 (7.0 GB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet 192.168.68.109 netmask 255.255.252.0 broadcast 192.168.71.255inet6 fe80::da25:ec0d:871:bd2e prefixlen 64 scopeid 0x20<link>ether cc:b0:da:aa:34:05 txqueuelen 1000 (Ethernet)RX packets 19503463 bytes 27835160694 (27.8 GB)RX errors 0 dropped 0 overruns 0 frame 0TX packets 2407943 bytes 228634476 (228.6 MB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
is_alive_ping(){
ping -c 1 $1 > /dev/null
[ $? -eq 0 ] && echo Node with IP: $i is up.
}
for i in 192.168.68.{1..255}
do
is_alive_ping $i & disown
done
Node with IP: 192.168.68.1 is up. Node with IP: 192.168.68.109 is up. Node with IP: 192.168.68.249 is up. Node with IP: 192.168.68.248 is up. Node with IP: 192.168.68.250 is up. Node with IP: 192.168.68.103 is up. Node with IP: 192.168.68.110 is up. Node with IP: 192.168.68.101 is up.
Scan local network
nmap -sP 192.168.68.0/24
Starting Nmap 7.98 ( https://nmap.org ) at 2026-11-02 17:57 +0100Nmap scan report for _gateway (192.168.68.1)Host is up (0.0083s latency).Nmap scan report for 192.168.68.100Host is up (0.033s latency).Nmap scan report for 192.168.68.103Host is up (0.036s latency).Nmap scan report for manestro.local (192.168.68.109)Host is up (0.00027s latency).Nmap scan report for 192.168.68.248Host is up (0.017s latency).Nmap scan report for 192.168.68.249Host is up (0.011s latency).Nmap scan report for 192.168.68.250Host is up (0.0087s latency).Nmap done: 256 IP addresses (7 hosts up) scanned in 4.82 seconds
ip addr show
ip link show
ip -4 addr show
ip -6 addr show
nslookup intertino.it
dig intertino.it
ping -c 4 intertino.it
traceroute intertino.it
ss -tlnp
netstat -tlnp
ip route show
route -n
Local port scanning
nmap -sT localhost
lsof -i :80
ss -tlnp | grep :80
| LISTEN | 0 | 5 | 127.0.0.1:8001 | 0.0.0.0:* |
| LISTEN | 0 | 512 | 127.0.0.1:8002 | 0.0.0.0:* |
| LISTEN | 0 | 4096 | 0.0.0.0:80 | 0.0.0.0:* |
| LISTEN | 0 | 4096 | [::]:80 | [::]:* |
npm install puppeteer
node -e "require('puppeteer').launch().then(async p => {
const browser = await p.newPage();
await browser.goto('http://localhost/13305/api/tags');
console.log(await browser.content());
});"
curl -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36" http://localhost:$PORT/api/tags
Socat is a relay for bidirectional data transfers between two independent data channels. Is meant as the advanced version of netcat. article, article, article.
#socat [options] <address> <address>
socat TCP4-LISTEN:81 TCP4:192.168.1.10:80
socat TCP4-LISTEN:81,fork,reuseaddr TCP4:TCP4:192.168.1.10:80
nc -l localhost 1234 #terminal1
socat STDIO TCP4:localhost:1234 #terminal2
Docker host/container connection
socat TCP-LISTEN:1234,reuseaddr,fork TCP:localhost:80
ip -s link show | head -n 5
| 1: | lo: | <LOOPBACK,UP,LOWER_UP> | mtu | 65536 | qdisc | noqueue | state | UNKNOWN | mode | DEFAULT | group | default | qlen | 1000 |
| link/loopback | 00:00:00:00:00:00 | brd | 00:00:00:00:00:00 | |||||||||||
| RX: | bytes | packets | errors | dropped | missed | mcast | ||||||||
| 207264279 | 818205 | 0 | 0 | 0 | 0 | |||||||||
| TX: | bytes | packets | errors | dropped | carrier | collsns |
ip -s link | head -n 5
| 1: | lo: | <LOOPBACK,UP,LOWER_UP> | mtu | 65536 | qdisc | noqueue | state | UNKNOWN | mode | DEFAULT | group | default | qlen | 1000 |
| link/loopback | 00:00:00:00:00:00 | brd | 00:00:00:00:00:00 | |||||||||||
| RX: | bytes | packets | errors | dropped | missed | mcast | ||||||||
| 207312002 | 818381 | 0 | 0 | 0 | 0 | |||||||||
| TX: | bytes | packets | errors | dropped | carrier | collsns |
#+end_src
Useful commands to use docker
A container was spamming the syslog
docker ps --filter id=3534a2d9ee8f | awk '{print $1, $NF}'
Build & Dev:
docker build -f Dockerfile.dockerfile -t myorg . - Build from Dockerfiledocker run -it --rm -v $PWD:/workspace myorg org mode :start - Launch org-modedocker exec -it myorg bash - Enter containerdocker build -f Dockerfile.dockerfile --build-arg DOCKER_FLAGS“-v $PWD:/workspace” -t myorg .= - Build with volume flagsRun & Manage:
docker run -it --rm -v $PWD:/workspace -w /workspace myorg org mode --no-user-info - Run org without user infodocker run --rm -v $PWD:/workspace myorg org mode :source_block_quote: "hello" - Process org blockdocker run --rm myorg org mode :clear_properties - Clear propertiesdocker run --rm myorg org mode :close_all - Close all buffersNetwork & Logs:
docker run --rm -v $PWD:/workspace myorg org mode :start_export "latex" - Export to LaTeXdocker logs myorg - View logsdocker ps -a - List all containersUseful for Org workflows:
docker cp myorg:/workspace/src/*.org $PWD/ - Copy files outdocker cp $PWD/*.org myorg:/workspace/src/ - Copy files indocker commit myorg myorg:latest - Save imagedocker stop myorg && docker rm myorg - Stop and removelinks: attachable networks
docker network inspect webserver_webserver-net
[{"Name": "webserver_webserver-net","Id": "95f40f2ec00116f8084f23f936e227ce10ab7ef22103bee3693efb013600b558","Created": "2026-05-26T18:17:17.270114938+02:00","Scope": "local","Driver": "bridge","EnableIPv4": true,"EnableIPv6": false,"IPAM": {"Driver": "default","Options": null,"Config": [{"Subnet": "172.18.0.0/16","Gateway": "172.18.0.1"}]},"Internal": false,"Attachable": false,"Ingress": false,"ConfigFrom": {"Network": ""},"ConfigOnly": false,"Options": {},...
We often need to install ping to check communication between containers
apt update
apt install iputils-ping
Docker stores containers, volumes, image, and filesystem layers
docker rm $(docker ps -aq)
docker rmi $(docker images -q)
docker image prune -a
docker volume prune
docker system prune
SWARM_NAME=malestro SWARM_NODE=malestro NET_NAME=webserver-net SERVICE_NAME=db SUBNET=“10.11.0.0/16” GATEWAY=" docker swarm init
#docker network create –scope=swarm $NET_NAME #docker network create –scope=swarm –driver overlay –attachable $NET_NAME docker network create –driver=overlay –attachable $NET_NAME #docker network create –scope=swarm –driver overlay –ingress –opt com.docker.network.driver.mtu=1200 $NET_NAME docker network create –driver overlay –ingress –subnet=$SUBNET –gateway=$GATEWAY –opt com.docker.network.driver.mtu=1200 traefik-ingress
docker network create –subnet $SUBNET –opt com.docker.network.bridge.name=docker_gwbridge –opt com.docker.network.bridge.enable_icc=false –opt com.docker.network.bridge.enable_ip_masquerade=true docker_gwbridge
#docker network create –subnet=172.20.0.1/16 -o com.docker.network.bridge.enable_icc=false -o com.docker.network.bridge.name=docker_gwbridge docker_gwbridge
#docker service update –network-rm traefik-net myservice #docker service create –publish 80:80 –network=$NET_NAME –name nginx nginx docker service update –network-add $NET_NAME db
docker node update –availability active $SWARM_NODE docker swarm init
Docker has many advantages in terms of portability but few topics makes it really hard to use. I wish I can learn how to face time demanding issues:
We can orchestrate the different containers
We start with a simple UI tool
| Feature | Docker UI | Kubernetes |
| --- | --- | --- |
| Primary Role | Container lifecycle management (start, stop, view logs, simple networking). | Orchestration, automated deployment, scaling, networking, and service management. |
| Scale | Single host or small environment. | Large, distributed clusters across many servers. |
| Configuration | Simple command-line or GUI-driven setup. | Complex declarative configuration files (YAML) defining desired state, services, deployments, etc. |
| Resilience | Basic restart capabilities. | Advanced self-healing, automatic failover, and high availability across nodes. |
| Networking | Basic container networking. | Advanced service networking, Ingress controllers, and complex service meshes. |
| Feature | Kubernetes (K8s) | OpenShift |
| --- | --- | --- |
| Nature | orchestration engine (the core API, controllers, and mechanisms). | A complete, integrated platform built on top of Kubernetes. |
| Focus | Providing the mechanism to manage containers (the how). | Providing an end-to-end platform for building, deploying, securing, and managing application. |
| Tooling | Requires users to integrate many separate tools (CI/CD, monitoring, service mesh). | Comes with integrated, opinionated tools for CI/CD pipelines, security scanning, logging, monitoring, and developer portals built-in. |
| Target Audience | Developers, DevOps engineers, infrastructure teams who want maximum flexibility. | Enterprise users, large organizations, and teams needing a standardized, secure, and fully supported platform. |
| If you want… | Use this Alternative | Key Advantage |
| --- | --- | --- |
| Maximum Control & Flexibility | Vanilla Kubernetes | Total ownership over the entire stack. |
| Centralized Management of Many Clusters | Rancher | A single pane of glass for multi-cluster operations. |
| Lightweight Deployment (Edge/IoT) | K3s | Minimal resource usage and fast startup time. |
| A Balance of Features (Mid-Tier) | MicroK8s | Simpler setup than vanilla K8s, good for quick starts. |
We install kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) kubectl" | sha256sum --check
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
Write down in org-mode useful commands and snippets for kubectl with mentions to configuration files
#+begin_src org
# Get help
kubectl help
# Get cluster info
kubectl cluster-info
# Get nodes
kubectl get nodes
# Get pods (all namespaces)
kubectl get pods --all-namespaces
# Get pods in current namespace
kubectl get pods
kubectl config commandsKUBECONFIG environment variable# View current context
kubectl config current-context
# List contexts
kubectl config get-contexts
# Switch context
kubectl config use-context <context-name>
# Set current namespace
kubectl config set-context --current --namespace=<namespace-name>
# Add cluster
kubectl config add-cluster <cluster-name> --server=<api-server-url>
# Add user
kubectl config add-user <user-name> --client-certificate=<cert-file> --client-key=<key-file>
# Create resource from file
kubectl apply -f <filename.yaml>
# Delete resource
kubectl delete -f <filename.yaml>
# Get resource description
kubectl describe <resource-type> <resource-name>
# Get resource details in YAML
kubectl get <resource-type> <resource-name> -o yaml
# Get logs
kubectl logs <pod-name>
# Execute command in pod
kubectl exec -it <pod-name> -- <command>
# Port forward
kubectl port-forward <pod-name> <local-port>:<remote-port>
# Create namespace
kubectl create namespace <namespace-name>
# Switch to namespace
kubectl config set-context --current --namespace=<namespace-name>
# Get all namespaces
kubectl get namespaces
# Get events
kubectl get events
# Get pod logs with timestamps
kubectl logs -l <label> --timestamps
# Watch pods
kubectl get pods -w
# Check resource usage
kubectl top nodes
kubectl top pods
# Save current context
kubectl config current-context > /tmp/current-context
# Switch to different context
kubectl config use-context <context-name>
# Switch to default context
kubectl config use-context docker-desktop
alias k=kubectl
alias kg='kubectl get'
alias kga='kubectl get all'
alias kd='kubectl describe'
alias kl='kubectl logs'
alias kpf='kubectl port-forward'
#+end_src
Here are useful kubectl commands and snippets in org-mode with configuration file references:
#+BEGIN_SRC org
kubectl config get-contextskubectl config use-context <context>kubectl config current-contextkubectl config set-credentials <user>kubectl get podskubectl describe pod <pod-name>kubectl logs <pod-name>kubectl exec -it <pod-name> -- /bin/shkubectl port-forward <pod-name> <local-port>:<remote-port>kubectl get deploymentskubectl scale deployment <deployment> --replicas=<count>kubectl set image deployment/<deployment> <container>=<image>kubectl get serviceskubectl expose deployment <deployment> --port=<port>
kubectl run <name> --image=<image> --port=<port>
kubectl apply -f <config-file.yaml>
kubectl delete -f <config-file.yaml>kubectl delete pod <pod-name>kubectl delete deployment <deployment-name>
kubectl create namespace <name>kubectl config set-context --current --namespace=<namespace>kubectl get namespaceskubectl get pod <pod> -o jsonpath’{.spec.containers[0].image}’=kubectl get pods -o wide --show-labelskubectl get pods -wkubectl get deployments -w# Deployment YAMLapiVersion: apps/v1kind: Deploymentmetadata:name: my-appspec:replicas: 3selector:matchLabels:app: my-apptemplate:metadata:labels:app: my-appspec:containers:- name: appimage: my-image:latestports:- containerPort: 80
kubectl cluster-infokubectl get nodeskubectl get pods --all-namespaceskubectl describe node <node>kubectl logs --previous <pod>kubectl get events#+END_SRC
The current choice is pipewire
sudo apt install pulseaudio-utils
sudo apt install pipewire pipewire-pulse wireplumber pipewire-alsa pipewire-jack -y
pactl info | grep "Server Name"
Server Name: PulseAudio (on PipeWire 1.6.2)
systemctl --user enable --now pipewire pipewire-pulse wireplumber
journalctl --user -u pipewire # Replace "pipewire" with the failing service name
Sep 05 00:36:29 manitro systemd[3162]: Stopping pipewire.service - PipeWire Multimedia Service... Sep 05 00:36:29 manitro systemd[3162]: Stopped pipewire.service - PipeWire Multimedia Service. Sep 05 00:36:29 manitro systemd[3162]: pipewire.service: Consumed 3min 31.719s CPU time over 2d 15h 50min 9.478s wall clock time, 21.7M memory peak, 4.6M memory swap peak. -- Boot 2f8cdd9bf9554f12ba750e8021731469 -- Sep 05 10:15:53 manitro systemd[3180]: Started pipewire.service - PipeWire Multimedia Service.
pw-top
I’m running LMMS configured with alsa and pipewire but I hear no sound, how can I debug it?
echo "=== LMMS Audio Debug Script ==="
echo ""
echo "Checking ALSA devices..."
alsaloop -P default -c 2 -t 2 -p
echo "Checking PulseAudio status..."
if pgrep -x pulseaudio> /dev/null; then
echo "PulseAudio is running"
elif pgrep -x pipewire > /dev/null; then
echo "PipeWire is running"
elif pgrep -x pavucontrol > /dev/null; then
echo "PavuControl is available"
fi
echo "Checking ALSA modules..."
cat /proc/asound/cards
echo "Checking PulseAudio modules..."
pactl info 2>/dev/null || echo "Pactl not available or PulseAudio not running"
echo "Checking PipeWire modules..."
pipewire-pulse-info 2>/dev/null || echo "PipeWire-Pulse not available"
echo "Checking user audio permissions..."
id
ls -la ~/.cache/pulse/ 2>/dev/null || echo "Pulse cache not found"
# Test with a686196b566e5e97b932e4168a028a1295b5b3d06e6d1c3e1e9b17f3d1c2e3f4
echo ""
echo "Test sound output..."
play -t alsa /dev/zero 2>/dev/null &
sleep 1
kill $! 2>/dev/null || true
echo "" echo "
=== LMMS Audio Debug Script ===Checking ALSA devices...Checking PulseAudio status...PipeWire is runningChecking ALSA modules...0 [NVidia ]: HDA-Intel - HDA NVidiaHDA NVidia at 0xbc000000 irq 1241 [Generic ]: HDA-Intel - HD-Audio GenericHD-Audio Generic at 0xbc8c8000 irq 1262 [Generic_1 ]: HDA-Intel - HD-Audio GenericHD-Audio Generic at 0xbc8c0000 irq 1273 [Fold ]: USB-Audio - nanoKEY FoldKORG INC. nanoKEY Fold at usb-0000:66:00.4-1, full speedChecking PulseAudio modules...Server String: /run/user/1000/pulse/nativeLibrary Protocol Version: 35Server Protocol Version: 35Is Local: yesClient Index: 523Tile Size: 65472User Name: sabeiroHost Name: manitroServer Name: PulseAudio (on PipeWire 1.6.2)Server Version: 15.0.0Default Sample Specification: float32le 2ch 48000HzDefault Channel Map: front-left,front-rightDefault Sink: alsa_output.pci-0000_64_00.6.analog-stereoDefault Source: alsa_input.pci-0000_64_00.6.analog-stereoCookie: 0b3e:429aChecking PipeWire modules...PipeWire-Pulse not availableChecking user audio permissions...uid=1000(sabeiro) gid=1000(sabeiro) groups=1000(sabeiro),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),100(users),111(lpadmin),114(lxd),973(docker),994(input)Pulse cache not foundTest sound output...