انتقل إلى المحتوى

الأدلة الخوادم مبتدئ1 دقائق قراءة

Linux Commands Every Website Owner Should Know

A practical Linux command cheat sheet for managing a VPS or hosting over SSH: files, permissions, processes, logs, networking, packages and services.

بواسطة فريق تحرير ZSOLNET آخر تحديث

هذه الصفحة غير متاحة بالعربية بعد، لذا تُعرض بالإنجليزية.

أهم النقاط

  • A few dozen commands cover most day-to-day server work.
  • Use man or --help to see every option for a command.
  • Be careful with rm, chmod and anything run with sudo.

Moving around and files

CommandWhat it does
pwdShow the current folder
ls -lahList files with sizes, permissions and hidden files
cd /var/wwwChange folder (cd .. goes up, cd ~ goes home)
cp -r src destCopy files or folders
mv old newMove or rename
rm file / rm -r folderDelete (permanently)
mkdir -p a/b/cCreate folders
nano fileEdit a file in the terminal
cat, less, tail -fView a file, page through it, follow it live

Searching

grep -rn "DB_NAME" /var/www          # find text in files
find /var/www -name "*.php" -mtime -2 # files changed in the last 2 days

Permissions and ownership

chmod 644 file.php      # owner read/write, others read
chmod 755 folder        # owner full, others read/enter
chown -R www-data:www-data /var/www/site

Use the chmod calculator to convert between numbers and letters.

Processes and resources

top          # or htop: live CPU and memory use
free -h      # memory
df -h        # disk space
ps aux | grep php
kill PID     # stop a process

Services and logs

sudo systemctl status nginx
sudo systemctl restart nginx
sudo journalctl -u nginx --since today
sudo tail -n 50 /var/log/nginx/error.log

Packages

sudo apt update && sudo apt upgrade
sudo apt install package-name

Networking

curl -I https://example.com   # response headers
dig example.com A +short      # DNS lookup
ss -tulpn                     # listening ports
ping -c 4 example.com

الأسئلة الشائعة

How do I connect to my server to run these?

With SSH from a terminal: ssh username@your-server-ip. See our tutorial on connecting to a VPS with SSH.

Can I undo rm?

No — Linux has no recycle bin on the command line. Double-check paths, and keep backups.

شارك X LinkedIn Facebook

الدخول إلى حسابك

أدِر نطاقاتك واستضافتك وفواتيرك من مكان واحد.

اتصال آمن مباشرة مع منطقة العملاء في ZSOLNET.

ليس لديك حساب؟