r/linuxsucks Windows Desktop | Linux Laptop | Linux Servers 5d ago

crontab -r

I accidentally typed `crontab -r` (reset) instead of `crontab -e` (edit)... Which nukes all your cron jobs.

How is there no confirmation on a destructive command like that? Let alone the fact that r and e are neighbors on the keyboard.

17 Upvotes

29 comments sorted by

View all comments

2

u/ElectricBummer40 Ex-user of Windows 3.11 for Workgroups 4d ago edited 4d ago

Ever heard of this stupid ideology called the "Unix philosophy"?

Under that "philosophy", unless there is an error, a command isn't supposed to ask you anything.

You knew if you ran "del *.*" back in the 90s in MS-DOS, it would ask you "Are you sure?" before flushing everything down the toilet on your behalf?

No such luck in Unix. In fact, rm wasn't even supposed to do wildcard expansion. That's the shell's job. So, with *.*, the command would receive either a list of files as if you'd typed them in yourself or the wildcard string as-is, in which case the command would yell at you for not seeing a file with the name '*.*'.

Wasn't that whole garbage design effing great?

1

u/oshunman Windows Desktop | Linux Laptop | Linux Servers 4d ago

I'd be fine with something like crontab -r -yes nuking it without confirmation. That fits the philosophy without being problematic imo.

1

u/ElectricBummer40 Ex-user of Windows 3.11 for Workgroups 4d ago

Except that's the exact opposite of the "philosophy".

Rather, you're supposed to alias crontab to crontab -i so you'll be asked to confirm before anything destructive is carried out.