Back to commands

Linux Survival Basics

Read-only

Turn Cron Into a Readable Table

Raw crontab lines are hard to scan during an incident, especially with long commands.

Command

crontab -l | awk 'NF && $1 !~ /^#/ {printf "%-16s %s\n", $1" "$2" "$3" "$4" "$5, substr($0,index($0,$6))}'

Before you run this

System impact: Read-only. Low when scoped to the shown target.

When not to use it: Do not use it for /etc/cron.d files without adapting for the user field after the schedule.

Expected output

Aligned schedule expressions next to their command strings.

System impact

Read-only. Nothing changes. awk formats the five schedule fields separately from the command.

Recovery / rollback: no state is changed.

When to use it

Use when reviewing several cron jobs and you need a quick schedule-to-command map.

When not to use it

Do not use it for /etc/cron.d files without adapting for the user field after the schedule.

Environment warning

This table shows schedule and command text, not whether PATH, working directory, or permissions are correct under cron.

  1. crontab -l
  2. crontab -l | grep -v '^[[:space:]]*#' | grep -vE '>>|2>&1|MAILTO=|logger'

next steps

Related commands

Linux Survival Basics Can be slow

Show Big Files in Human Units

Byte counts are precise. Human units are faster under pressure.

find /var -type f -printf '%s %p\n' | sort -nr | head -10 | awk '{printf "%.1f MB %s\n", $1/1024/1024, $2}'
Linux Survival Basics Read-only

Show the Real User Cron Jobs

Cron problems often hide behind comments, blank lines, and copied folklore.

crontab -l | sed -n '/^[[:space:]]*#/d;/^[[:space:]]*$/d;p'
Linux Survival Basics Read-only

Map systemd Timers to Services

A timer is only half the scheduled job. The service is the payload.

systemctl list-timers --all --no-pager --plain | awk 'NR==1 || /\.timer/ {print $(NF-1), "->", $NF}'
Linux Survival Basics Can be slow

Find the Largest CI Logs

Huge logs often point to loops, noisy tests, or runaway debug output.

find logs/ -type f -printf '%s %p\n' | sort -nr | head -10
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

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.