Cron Jobs, Chmod & Server Utilities Explained (2026)
Cron and chmod with measured examples: how many times common cron schedules fire in 2027, why "0 0 13 * 5" ran 64 times instead of once, what each permission mode looks like in ls -l, and how umask decides the mode of new files.
Cron Expressions
A standard cron line has five fields: minute (0-59), hour (0-23), day of month (1-31), month (1-12) and day of week (0-7, where both 0 and 7 mean Sunday), followed by the command. * means every value, , lists values, - makes a range and / sets a step. We counted how often common schedules fire in 2027 with the croniter library:
| Expression | Meaning | Runs in 2027 |
|---|---|---|
0 9 * * 1-5 | 9:00 every weekday | 261 |
*/15 * * * * | every 15 minutes | 35,040 |
0 0 1 * * | midnight on the 1st | 12 |
0 0 13 * * | midnight on the 13th | 12 |
0 0 * * 5 | midnight every Friday | 53 |
0 0 13 * 5 | not "Friday the 13th" | 64 |
The last row is the classic trap. When both day of month and day of week are restricted, cron runs when either matches, so 0 0 13 * 5 fired 64 times in 2027, on every 13th and every Friday, while Friday the 13th happened only 1 time. To run only on Friday the 13th, schedule the 13th and test the weekday in the command: 0 0 13 * * [ "$(date +\%u)" = 5 ] && /path/job (in a crontab, a bare % means a newline, so it is escaped as \%).
- Cron runs in the server's time zone; check it before scheduling around business hours, and remember daylight-saving shifts can skip or repeat jobs set between 1:00 and 3:00.
- Cron starts jobs with a minimal environment: use absolute paths and redirect output, for example
>> /var/log/job.log 2>&1, or failures vanish silently. - Build and check expressions in plain English with the Cron Builder.
File Permissions and chmod
Each file has read (4), write (2) and execute (1) bits for its owner, its group and everyone else; one octal digit per class adds them up. Python's stat.filemode renders each mode the way ls -l shows it:
| Octal | ls -l shows | Typical use |
|---|---|---|
| 644 | -rw-r--r-- | Web pages, config files |
| 600 | -rw------- | Private keys, secrets |
| 755 | drwxr-xr-x | Directories, scripts |
| 700 | -rwx------ | Private scripts |
| 4755 | -rwsr-xr-x | Setuid program (runs as its owner) |
| 2755 | -rwxr-sr-x | Setgid (group inherited) |
| 1777 | drwxrwxrwt | Shared temp directory (sticky bit) |
| 777 | -rwxrwxrwx | Almost never right |
New files get their mode from the creating program minus the umask. We created a file and a directory under two umasks: with umask 022 they came out as 644 and 755; with umask 077 as 600 and 700. If uploads land with the wrong permissions, look at the umask before reaching for chmod. Convert between notations in the Chmod Calculator.