Sometimes there is a specific task: to quickly view all cron jobs for all users on the server in one list.
This can be done simply by connecting to the server via SSH and running this script in the console:
for user in $(cut -f1 -d: /etc/passwd); do echo "Cron tasks for user: $user"; crontab -u $user -l 2>/dev/null; done
for user in $(cut -f1 -d: /etc/passwd); do echo "Cron tasks for user: $user"; crontab -u $user -l 2>/dev/null | grep -Ev '^\s*#'; done
It reads the list of all users from /etc/passwd
and, using crontab -u $user
, retrieves the cron list for each found user. From the resulting list, it removes all unnecessary lines using grep -Ev ‘^\s*#’