Các lệnh nên nhớ với VPS
PHPmyadmin
cat /usr/local/directadmin/conf/mysql.conf
Dung lượng
Kiểm tra file có dung lượng lớn hơn 500M
find / -type f -size +500M -exec ls -lh {} \; | awk ‘{ print $9 “: ” $5 }’
Tìm kiếm những file lớn hơn 1GB
find / -type f -size +1G -exec ls -lh {} \; | awk ‘{ print $9 “: ” $5 }’
Tìm kiếm theo độ sâu thư mục
find /home/ -mindepth 2 -maxdepth 5 -type f -size +1G -exec ls -lh {} \; | awk ‘{ print $9 “: ” $5 }’
Kiểm tra dung lượng VPS:
df -h
du -sh *
Lệnh này tính toán size cả thư mục ẩn.
du -hs $(ls -A) “`
Log lỗi
/var/log/httpd/domains/
tail -f /var/log/httpd/domains/tênwebsite.log
CSF
xem ip có bị chặn kh: csf -g my_ip
xóa csf -dr xx.xx.xx.xx
vi /etc/csf/csf.blocklists
Đổi IP VPS
cd /usr/local/directadmin/scripts/
./ipswap.sh old_ip new_ip
Dump mysql
mysql -u db_user -ppass db_name < đường dẫn chứa file mysql
Cấp quyền cấm ghi vào file
Mở quyền:
chattr -i /home/*/domains/*/public_html/.htaccess
Cấm quyền
chattr +i /home/*/domains/*/public_html/.htaccess
Xem port VPS
cat /etc/ssh/sshd_config
cat /etc/os-release
Tạo login onetime Directadmin
/usr/local/directadmin/directadmin –create-login-url user=admin
Cấu hình directadmin config
vi /usr/local/directadmin/conf/directadmin.conf
Cài DirectAdmin license
/usr/local/directadmin/scripts/getLicense.sh ‘license’
Số file
find . | wc -l
IP nhiều awk ‘{print $1}’ access_log | sort | uniq -c | sort -nr | head -n 10









