ورقة مرجعية لأوامر Linux — مرجع أساسي

ورقة مرجعية لأوامر Linux — مرجع أساسي

مرجع سريع ومنظَّم لأكثر أوامر Linux استخدامًا في إدارة السيرفر الخاص بك. احفظ هذه الصفحة في المفضلة.

التنقل والمجلدات

pwd                 # print current directory
ls -lah             # list all files (long, human sizes)
cd /var/www         # change directory
cd ..               # up one level
mkdir -p a/b/c      # create nested directories
rmdir dir           # remove empty directory

عمليات الملفات

cp file.txt bak.txt     # copy
cp -r dir1 dir2         # copy directory
mv old.txt new.txt      # move / rename
rm file.txt             # delete file
rm -r dir               # delete directory
touch file.txt          # create empty file
ln -s target linkname   # symbolic link

عرض الملفات وتحريرها

cat file.txt            # print contents
less file.txt           # scroll (q to quit)
head -n 20 file.txt     # first 20 lines
tail -n 20 file.txt     # last 20 lines
tail -f app.log         # follow a log live
nano file.txt           # simple editor

الصلاحيات والملكية

chmod 755 script.sh         # rwxr-xr-x
chmod +x script.sh          # make executable
chown user:group file       # change owner:group
chown -R www-data: /var/www # recursive
sudo command                # run as root

العمليات والنظام

ps aux                  # all processes
top                     # live process monitor
kill 1234               # terminate by PID
kill -9 1234            # force kill
killall nginx           # kill by name
uname -a                # kernel / OS info
whoami                  # current user
uptime                  # load & uptime

المساحة والذاكرة

df -h                   # disk space per filesystem
du -sh /var/www         # size of a directory
free -h                 # memory usage

البحث والنصوص

grep "error" app.log        # search text in a file
grep -ri "todo" .           # recursive, case-insensitive
find / -name "*.conf"       # find files by name
sort file.txt | uniq        # sort & de-duplicate
ps aux | grep php           # pipe + filter

الشبكات

ping example.com            # test connectivity
curl -I https://site.com    # fetch headers
wget https://site/file.zip  # download a file
ss -tlnp                    # listening ports
ssh user@server-ip          # remote login

إدارة الحزم

# Debian/Ubuntu
sudo apt update && sudo apt upgrade -y
sudo apt install nginx
sudo apt remove nginx

# RHEL/AlmaLinux/CentOS
sudo dnf install nginx
sudo dnf remove nginx

المستخدمون

sudo adduser alice          # create user
sudo usermod -aG sudo alice # add to sudo group
sudo passwd alice           # set password
sudo deluser alice          # remove user

الأرشفة والضغط

tar -czvf site.tar.gz /var/www   # create .tar.gz
tar -xzvf site.tar.gz            # extract .tar.gz
zip -r site.zip /var/www         # create .zip
unzip site.zip                   # extract .zip

لإدارة الخدمات التي تعمل في الخلفية (تشغيلها وإيقافها وتفعيل تشغيلها تلقائيًا عند الإقلاع)، راجع شرح “كيفية عرض خدمات Linux وإدارتها باستخدام systemctl” في هذا القسم.

هل كانت المقالة مفيدة ؟

15 أعضاء وجدوا هذه المقالة مفيدة

Powered by WHMCompleteSolution