Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using cat /var/spool/cron/* to view all cron jobs created by all cpanel users.

Is it possible to edit its output just like editing via nano and hit save?

share|improve this question

If are you trying to do collision detection and prevention (as indicated in another question you've asked), then a simple way to accomplish what you ask would be

cat /var/spool/cron/* >/tmp/cat.out; $EDITOR /tmp/cat.out

which would concatenate all the multiple users' crontabs into a single file, save, and edit it. But I don't see much utility to this. Much more useful would be

ls /var/spool/cron/* | xargs -i $EDITOR {}

which would edit each users' crontab in sequence, save, and then open the next. It would be incumbent upon you (as root) to notice and correct the conflicts between each file.

A further refinement would be to create an annotated version of the first approach to identify the issues, and then to go back and edit the particular user crontabs individually for fixes.

for I in /var/spool/cron/*; \
do awk '!/^#/&&!/^[^[:blank:]]*=/{printf "%s:\t%s\n", F, $0}' F=$I $I; \
done |sort -k2 | less

will list all the content of all the crontab files except for comments and environment variable assignments, prefixed each with the particular contributing crontab file name, and sorted by crontab content. This will hopefully put all the simillarly schedules lines in all the crontabs together in sort order, so that you can easily pick out conflicting lines and which user contributed them. The resulting output is for reference only, not installation into cron.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.