• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

Edit the crontab without using crontab -e

June 14, 2013 by Sharad Chhetri Leave a Comment

Edit the crontab without using crontab -e

Target Readers: Linux Newbie

Crontab is like a task schedular in linux and unix operating system.I expect you are already little bit aware about crontab.
In this post I am sharing the tips to new linuxbie ,how to edit crontab without using “crontab -e” command.

As we know to edit the crontab there is a command

crontab -u username -e

This thing you can also do by directly using file editor (like vi,vim or nano etc.).
In Ubuntu and Debian,the crontab file is located at /var/spool/cron/crontabs/ and if any crontab for any user is there ,then file name would be with the name of username.
for eg . username is sharad hence filename will be root. ls -l /var/spool/cron/crontabs/sharad

In CentOS and Redhat, crontab files are located at /var/spool/cron and similarly as I described above, the crontab of user will be with the name of file.
for eg. username is sharad ,and you can see the filename with sharad in ls -l /var/spool/cron/sharad

Now we will edit the crontab directly using the vi editor.

Crontab for username = sharad

In Debian and Ubuntu: below given is an example.

vi /var/spool/cron/crontabs/sharad

10 * * * * touch /tmp/`date +%F-%s`

now save and exit from vi editor

In CentOS and Red Hat : Below given is an example


vi /var/spool/cron/sharad

30 * * * * touch /tmp/`date +%F-%s`

now save and exit from vi editor

For more understanding , watch the video.

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. vi : Edit file without opening it
  2. Change default editor of crontab in Ubuntu
  3. Could not find make anywhere!!! Please edit the config section to include the path to make. at ./install.pl line 2101
  4. Read the file inside compressed .gz files without extract
  5. How to increase Password Expire date without resetting the password
  6. Non interactive ,without typing password do ssh to Server : By sshpass
  7. How to change hostname in Ubuntu 12.04 and 12.10 without system restart
  8. Run the script using nohup without hitting enter key two times
  9. Set hostname and FQDN in Ubuntu without reboot
  10. Find mysql commands history without mysql server login

Filed Under: Linux, Tips And Tricks

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

master admin password openerp 7.x

rsync all files,hidden files,symlinks,hardlinks to remotes Linux Server

How to add/install Ubuntu fonts in CentOS/Red Hat Linux

set and unset line number in file with vi editor

How to put slider shortcode only in home page in WordPress

Set GRUB password after installation of CentOS/Red Hat

linux release renew dhcp assigned ip address

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy