📁 Section 1: Navigation & File Management
Command | Description | Example |
---|
pwd | Show current directory | pwd /home/megahost |
ls -lah | List files with sizes and permissions | ls -lah /var/www |
cd | Change directory | cd /etc/nginx |
mkdir -p | Create nested directories | mkdir -p /var/www/html/assets |
touch | Create empty file | touch README.md |
cp | Copy files or folders | cp config.conf /backup/ |
mv | Move or rename | mv old.conf new.conf |
rm -rf | Remove recursively | rm -rf /tmp/cache |
tree | Visualize directory structure | tree /var/www/html |
🧭 Purpose: Navigate directories, inspect contents, and manage files with confidence.
🛠️ Walkthrough
pwd
ls -lah /var/www
cd /etc/nginx
mkdir -p /var/www/html/assets
touch /var/www/html/index.html
cp /etc/nginx/nginx.conf /backup/nginx.conf
mv /backup/nginx.conf /backup/nginx.bak
rm -rf /tmp/cache
✅ Test Command
ls -lah /var/www/html
⚙️ Section 2: Process Control
Command | Description | Example |
---|
ps aux | List all running processes | ps aux | grep nginx |
top / htop | Live system monitor | htop |
kill | Terminate process by PID | kill 1234 |
killall | Terminate by name | killall apache2 |
nice / renice | Set process priority | renice -n -5 -p 1234 |
systemctl | Manage services | systemctl restart nginx |
🧭 Purpose: Monitor and manage running processes and services.
🛠️ Walkthrough
ps aux | grep nginx
top
killall nginx
systemctl restart nginx
systemctl status nginx
✅ Test Command
systemctl is-active nginx
Expected Output:
active
🔐 Section 3: Permissions & Ownership
Command | Description | Example |
---|
chmod | Change permissions | chmod 644 index.html |
chown | Change ownership | chown www-data:www-data /var/www/html |
stat | View file metadata | stat config.php |
umask | Default permission mask | umask 022 |
📦 Section 4: Package Management
Command | Description | Example |
---|
apt update | Refresh package list | apt update |
apt upgrade | Upgrade packages | apt upgrade -y |
apt install | Install package | apt install htop |
apt remove | Uninstall package | apt remove apache2 |
dpkg -l | List installed packages | dpkg -l | grep nginx |
🌐 Section 5: Networking Tools
Command | Description | Example |
---|
ip a | Show IP addresses | ip a |
ping | Test connectivity | ping 8.8.8.8 |
curl | Fetch URLs | curl -I https://megahost.xyz |
netstat -tuln | Show listening ports | netstat -tuln |
ss -tuln | Modern netstat alternative | ss -tuln |
traceroute | Trace network path | traceroute google.com |
dig / nslookup | DNS lookup | dig megahost.zone |
💽 Section 6: Disk & RAID Monitoring
Command | Description | Example |
---|
df -h | Disk usage | df -h /dev/nvme0n1p1 |
du -sh | Folder size | du -sh /var/log |
lsblk | Block devices | lsblk -o NAME,SIZE,TYPE,MOUNTPOINT |
smartctl -a | SMART health | smartctl -a /dev/sda |
cat /proc/mdstat | RAID status | cat /proc/mdstat |
mdadm --detail | RAID array info | mdadm --detail /dev/md0 |
🧾 Section 7: System Info & Logs
Command | Description | Example |
---|
uname -a | Kernel info | uname -a |
uptime | System uptime | uptime |
hostnamectl | Hostname & OS info | hostnamectl |
dmesg | Boot messages | dmesg | tail |
journalctl | System logs | journalctl -xe |
tail -f | Live log view | tail -f /var/log/syslog |
who / w | Logged-in users | w |
🧰 Section 8: Other Useful Basics
Command | Description | Example |
---|
alias | Create shortcut | alias ll='ls -lah' |
history | Show command history | history | grep reboot |
crontab -e | Edit cron jobs | crontab -e |
date | Show system time | date |
env | Show environment variables | env | grep PATH |