crontab -l all users : a Bash script


#!/bin/bash

# List all usernames on the system
usernames=$(cat /etc/passwd | cut -d: -f1)

# For each user, print their username and crontab (if any)
for user in $usernames; do
    echo "Checking crontab for user: $user"
    crontab -u $user -l
    echo ""
done

In the world of Linux system administration, crontab is a vital tool used for scheduling tasks to run at fixed times or intervals. While it's straightforward to view the cron jobs of the current user with the crontab -l command, what if you need to get an overview of all cron jobs across all users on a system? That's where our handy Bash script comes in.