Question: Just to be clear I want to comment crontab entries, not a basic file. Usually, I do it like

> 
> crontab -e
> 
> 
> 

```
30 * * * * /u01/app/abccompny/scripts/GenerateAWRReport.pl
01,31 * * * * /u01/app/abccompny/scripts/table_growth_monitor.sh
30 0,4,8,12 /u01/shivam/script/getMongoData.sh 

```

and I add "#" in front of each line and just save it. Similarly after work is done I remove the "#". 

```
#30 * * * * /u01/app/abccompny/scripts/GenerateAWRReport.pl
#01,31 * * * * /u01/app/abccompny/scripts/table_growth_monitor.sh
#30 0,4,8,12 /u01/shivam/script/getMongoData.sh 

```

Is there an efficient way to do this using the script?

Answer: 
Export your current crontab into a file, delete the crontab, then use the previously created file.

```
$ crontab -l > cron_content
$ crontab -r
$ <this is where you do your stuff>
$ crontab cron_content

```
Old post, but i think there is a much faster and easier solution :

On Linux, everything is a file. Crontab stores crons of each user in /var/spool/cron/

* On Ubuntu 20.04 : **/var/spool/cron/crontabs/<user>**
* On RHEL7 : **/var/spool/cron/<user>**

So you can just :

```
# comment
sed -i 's/^/#/' /var/spool/cron/<user>

# uncomment
sed -i 's/^#//' /var/spool/cron/<user>

```