Back to commands

Hosting Operations

Read-only, can be slow

Show Enabled Apache Sites

You need to see which Apache virtual host files are enabled.

Command

find /etc/apache2/sites-enabled -maxdepth 1 -type l -printf '%f -> %l\n' 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 remove or create symlinks from this output unless you intend to enable or disable a site.

Expected output

Enabled Apache site filenames and their symlink targets.

System impact

Read-only, can be slow. Nothing changes. The command lists enabled Apache site symlinks.

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 when Apache ignores a virtual host file you edited.

When not to use it

Do not remove or create symlinks from this output unless you intend to enable or disable a site.

next steps

Related commands

Linux Survival Basics Can be slow

List Enabled Apache Sites

Apache may not be using the vhost file you edited.

find /etc/apache2/sites-enabled -maxdepth 1 -type l -printf '%f -> %l ' 2>/dev/null | sort
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
Hosting Operations Can be slow

Exclude the Current Release from Cleanup

Release cleanup should prove what current points to before listing old directories.

current=$(readlink -f /home/deploy/current); find /home/deploy/releases -mindepth 1 -maxdepth 1 -type d ! -samefile "$current" -printf '%TY-%Tm-%Td %p\n' 2>/dev/null | sort
Hosting Operations Can be slow

Group Writable Files by Owning Group

Group-writable files are not automatically wrong, but the owning group decides the risk.

find /srv/www/example -type f -perm -0020 -printf '%g %M %p\n' 2>/dev/null | sort
Hosting Operations Can be slow

Find Directories Burning Inodes

Inode cleanup starts by finding the directory with too many files.

find /var/cache -xdev -type f -printf '%h\n' 2>/dev/null | sort | uniq -c | sort -nr | head
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.