Skip to the content
- systemd
- System
- Reload management parameters
systemctl daemon-reload
- Enable specific service
systemctl enable NAME.service
- Enable specific service and start it
systemctl enable --now NAME.service
- Disable specific service
systemctl disable NAME.service
- List
- Start when system boots
systemctl list-unit-files --state=enabled
- Currently Running
systemctl list-units --type=service --state=running
- Active (running or exited)
systemctl list-units –type=service –state=active
- Service
- States
- Start
systemctl start NAME.service
- Restart
systemctl restart NAME.service
- Stop
systemctl stop NAME.service
- Overview
systemctl status NAME.service
- Log
journalctl --follow --unit=NAME.service
- File transfers
- Multipath
- Top # disk size
du -m PATH | sort -nr | head -n LIMIT
- Random password generators
uuidgen | sha256sum
head --bytes=32 /dev/urandom | base64
tr -dc A-Za-z0-9 </dev/urandom | head -c 40
openssl rand -hex 32
openssl rand -base64 32
- List open ports
sudo netstat -tulpn | grep LISTEN
sudo ss -tulpn
- Transfers
rclone copy --stats=1s --verbose=1 SERVER1:/SERVER-SOURCE/PATH SERVER2:/SERVER-DESTINATION/PATH
- DNS
- Reverse own IP
host `curl https://wtfismyip.com/text`
dig -x `curl https://wtfismyip.com/text`
- Delete all files matching name
find PATH -name FILENAME -type f -delete
find PATH -name "FILENAMEWITHWILDCARD*" -type f -delete
find PATH -name FILENAME -print0 | xargs -0 rm
find PATH -name FILENAME -exec rm {} +
- Linux host
- Get:
- Set:
hostnamectl set-hostname HOSTNAME
- SSH
- Check client keys
for key in ~/.ssh/id_*; do ssh-keygen -l -f "${key}"; done | uniq
- Check server keys
ssh-keyscan HOST | ssh-keygen -lf -
- Generate an Ed25519 key
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "USERNAME"
- Copy key to server
ssh-copy-id -i ~/.ssh/id_ed25519.pub USER@SERVER
- Quick host
python3 -m http.server --directory ~/Desktop/ 8000