Skip to main content

CLIs

nmtui

Rclone​

debain doesnt support mega so donwload from website

rclone sync mega: ~/sync/mega

find:​

uptime
  • rclone
  • ncdu

Grep​

search for strings in current directory recusive also for sub directories

grep -r "your_string" .

show only filenames:

grep -rl "your_string" .

ignore dir like node_modules:

grep -r --exclude-dir=node_modules "your_string" .

Find and replace​

Find​

search files:

find . -type f -name "name*"

search directories:

find . -type d -name "name*"
find . -maxdepth 2 -type d -name "name*"
find . -type d -name "name*" | sort

Find and replace​

sed 's/foo/bar/g'

Ports​

ss -tulp
lsof -i :8080

Disk: Storage​

Disk usage​

df -h
du -ah . | sort -rh | head -20

Disk partitions​

lsblk
cfdisk

Clean disk​

ncdu

Processes​

htop
btop

HTTP Requests​

curl http://localhost:8080

File Transfer / Sync​

  • rsync
  • scp
  • ssh

Text editor​

vim

nvim

Select options​

fzf

Container​

podman

docker

kubectl

Logs​

journalctl -u nginx

Systemd​

Service control​

systemctl start nginx
systemctl stop nginx
systemctl restart nginx
systemctl reload nginx
systemctl status nginx

Enable at boot​

systemctl enable nginx
systemctl disable nginx
systemctl enable --now nginx

Listing​

systemctl list-units --type=service
systemctl --failed

System actions​

systemctl reboot
systemctl poweroff
systemctl suspend

Service Unit Files​

Typical locations:

/etc/systemd/system/
/usr/lib/systemd/system/
/lib/systemd/system/

Example service file:

[Unit]
Description=My App

[Service]
ExecStart=/usr/bin/myapp
Restart=always

[Install]
WantedBy=multi-user.target

User Services​

User-level services:

systemctl --user status
systemctl --user start myservice

Reload units​

systemctl daemon-reload

Boot analysis​

systemd-analyze
systemd-analyze blame

Mask / Unmask Services​

Prevent service from starting:

systemctl mask nginx
systemctl unmask nginx

Only running​

systemctl list-units --type=service --state=running

Failed services​

systemctl --failed

Service Information​

Show unit details​

systemctl show nginx

Show unit file​

systemctl cat nginx

Show dependencies​

systemctl list-dependencies nginx

System Power Commands​

systemctl reboot
systemctl poweroff
systemctl suspend
systemctl hibernate