Di chuyển và xem file:
pwd # xem thư mục hiện tại
ls -la # liệt kê file chi tiết
cd /var/www # vào thư mục
cd .. # lên thư mục cha
cat file.txt # đọc file
tail -f /var/log/nginx/error.log # xem log realtime
Tạo, copy, xóa:
mkdir folder # tạo thư mục
cp file.txt bk.txt # copy file
mv old.txt new.txt # đổi tên/di chuyển
rm file.txt # xóa file
rm -rf folder/ # xóa thư mục (cẩn thận!)
Chỉnh sửa file:
nano /etc/hosts
# Ctrl+O lưu, Ctrl+X thoát, Ctrl+W tìm kiếm
Quản lý hệ thống:
top # xem CPU/RAM/process
free -m # xem RAM
df -h # xem disk
ss -tlnp # xem port đang mở
ip addr # xem IP
Cài phần mềm (Ubuntu):
apt update && apt upgrade -y
apt install -y nginx
apt remove nginx
Quản lý service:
systemctl start nginx
systemctl stop nginx
systemctl restart nginx
systemctl status nginx
systemctl enable nginx # tự khởi động
Quyền file:
chmod +x script.sh
chmod 755 /var/www
chown www-data:www-data /var/www/html Có thể bạn cần xem thêm
Bài viết đã được kiểm duyệt bởi VPS HC Team
Cập nhật lần cuối: 16/06/2026