Back to commands

Linux Survival Basics

Read-only, can be slow

List Enabled Apache Sites

You need the enabled site symlinks before changing a virtual host.

Command

find /etc/apache2/sites-enabled -maxdepth 1 -type l -printf '%f -> %l
' 2>/dev/null | sort

Before you run this

System impact: Read-only. Can create load on large logs, directories, filesystems, or process tables.

When not to use it: Do not assume a file in sites-available is active.

Expected output

Enabled site symlinks and their targets.

System impact

Read-only, can be slow. Nothing changes. The command reads current state and prints diagnostic evidence.

May require elevated permissions on protected paths or service-owned files.

Scope this to the smallest useful path or service on busy systems.

Recovery / rollback: no state is changed.

When to use it

Use on Debian/Ubuntu-family Apache hosts.

When not to use it

Do not assume a file in sites-available is active.

Common misread

Do not assume a file in sites-available is active.

Explanation-only example

Commands shown

These are the commands shown for inspection. Treat them as an example, not proof that your system will behave identically.

  1. find /etc/apache2/sites-enabled -maxdepth 1 -type l -printf '%f -> %l ' 2>/dev/null | sort
  2. find /etc/apache2/sites-enabled -maxdepth 1 -type l -printf '%f -> %l ' 2>/dev/null | sort

next steps

Related commands

Hosting Operations Can be slow

Show Enabled Apache Sites

The Apache config existed. The enabled symlink did not.

find /etc/apache2/sites-enabled -maxdepth 1 -type l -printf '%f -> %l\n' 2>/dev/null | sort
Linux Survival Basics Can be slow

Find Apache DocumentRoot and Directory Rules

Apache 403 often comes from the directory block, not the file.

grep -RInE 'DocumentRoot|<Directory|Require all|Options|AllowOverride' /etc/apache2/sites-enabled /etc/apache2/conf-enabled /etc/httpd/conf.d 2>/dev/null
Hosting Operations Can be slow

Find System Cron Files Fast

A job can be nowhere in your crontab and still run every night.

find /etc/cron.d /etc/cron.hourly /etc/cron.daily /etc/cron.weekly /etc/cron.monthly -maxdepth 1 -type f -print 2>/dev/null | sort
Linux Survival Basics Can be slow

Find the Files Eating Your Disk

The disk was full, but guessing at folders was the slow part.

find /var -type f -printf '%s %p\n' | sort -nr | head -20
Linux Survival Basics Can be slow

Find Nginx root alias and access rules

One deny or alias can explain the whole 403.

grep -RInE 'root|alias|deny|allow' /etc/nginx/sites-enabled /etc/nginx/conf.d 2>/dev/null

next diagnostic step

Where to go from this command

Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • LPIC-1 style command-line practice
  • LFCS style performance-task practice
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.