Logo

~/saidqb cat ecosystem/infra/linux.md

Li

Linux

Server operating system

commit by saidqb

Requirements

Command dasar berlaku di distro Linux mana pun. Perintah apt spesifik Debian/Ubuntu — distro lain pakai dnf/yum (RHEL/CentOS) atau pacman (Arch).

  • Referensi: Ubuntu 24.04 LTS / Debian 12
cat /etc/os-release && uname -r

File & isi file

ls -la; cd /var/www; pwd
mkdir -p project/src
cp -r src dest; mv old.txt new.txt; rm -rf node_modules
find . -name "*.log"

cat file.txt; less file.txt
head -n 50 file.log
tail -f file.log             # ikuti log realtime
grep -r "error" ./logs

Permission & ownership

chmod 755 script.sh
chmod -R 775 storage/
chown -R www-data:www-data /var/www/app

Process & resource

ps aux | grep nginx
top                           # atau htop
kill -9 <PID>
systemctl status|restart|enable nginx

df -h                         # sisa disk
du -sh *                      # ukuran tiap folder
free -h                       # sisa RAM

Networking

curl -I https://example.com
wget https://example.com/file.zip
ss -tulpn                     # port yang sedang listen
scp file.txt user@host:/path/

Package manager (Debian/Ubuntu)

sudo apt update && sudo apt upgrade
sudo apt install nginx
sudo apt remove nginx

Environment, shell, cron

export APP_ENV=production
echo $PATH
which php
alias ll='ls -la'

crontab -e
0 2 * * * /usr/bin/php /var/www/artisan schedule:run   # tiap jam 2 pagi