how to save crontab file or creat it by gedit?

hi
i’m beginner in linux!
i need to crontab, so i use


crontab -e

and type my code:


10 10 * * * idle3

but i cann’t save it!!! i try keyboard shortcuts and … but cann’t save anything! how i can save a crontab file or use gedit to creat crontab files (edit in gedit and enable it as crontab)?
tank you

Probably, if you use:


EDITOR=/usr/bin/gedit crontab -e

that would allow you to edit with “gedit”.

thank you :):slight_smile:

Regarding the default editor, which is vim:
Press the key ‘i’ to enter insert mode, you can then change the file similar like you would with any other editor.
Afterwards press ESC to leave insert mode again, and type “:wq” to save and quit.

Vim comes with help, type “:help” to see it.

Or see here for an interactive online tutorial:
http://www.openvim.com/tutorial.html :wink:

for a single user see

head -n 17 ~/.bashrc

for system_wide/global change see

head -n8 /etc/bash.bashrc.local

Note that .local needs to be created :wink:

Did you read the man page of crontab?

man 1 crontab

There you will see that the -l option will list your crontab. And thus something like

crontab -l >my-saved-crontab

will save it.

On 2014-06-28 15:56, mshj wrote:

> but i cann’t save it!!! i try keyboard shortcuts and … but cann’t
> save anything! how i can save a crontab file

LOL.

That’s because the default editor in Linux/Unix is ‘vi’, and it almost
baffles every new user that bumps into it. When I found it the first
time, I had to reboot to get out.

You can change the default editor. You can edit or create
“/root/.bashrc” with one of these lines:


Telcontar:~ # cat .bashrc
#export EDITOR=/usr/bin/mcedit
export EDITOR=/usr/bin/jstar
Telcontar:~ #

Those two are simple text editors. mceditor is probably easier, but not
installed by default: you need install ‘mc’ (which is a very useful
program, anyway).


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

On 2014-06-28 17:06, hcvv wrote:
> will save it.

He, he refers to “file save” from inside the editor you get when running
“crontab -e”, which is “vi” on default installs. Ok, maybe “vim”, but in
vi mode, so there is no help or hint about what to do. My, I still
remember the first time I bumped into it…


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

Yes, I interpreted it completely wrong. As regular vi user, it did not come to my mind that writing
the file (and probably quiting vi) was what he was looking after.

Btw I wonder how he got into insert mode to type the line? When you never used vi, all is magic…

Anyhow, the ans=swer should have been: type

:wq

this will show from the moment you type the : (meaning enter command) in the lower left corner of the terminal and wq will write the file and quit from vi.

Sorry what i meant was.

head -n8 /etc/bash.bashrc

and create *.local :*

On 2014-06-28 18:06, hcvv wrote:
> Btw I wonder how he got into insert mode to type the line? When you
> never used vi, all is magic…

The first time I tried, I somehow got into edit mode, probably after
hitting many keys. Then I could not get out.

I’m unsure if the first time I was using “putty”, so I closed putty, and
perhaps I tried it at home, then I had to reboot the machine, because I
had no idea how to get out, nor how to kill a process, and maybe I
didn’t know that I had several terminals.

I assure you, coming from the MsDOS world, or worse, Windows, and
“bumping” into “vi” is scary. Now I laugh, but not that day. If it was
via putty, it was a working place important server, and being a novice I
did not even know if closing the putty client was safe or allowed.

:slight_smile:


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

I used vi way before MS-DOS existed, but it is something you have to get used to (understatement).:stuck_out_tongue:

On 2014-06-29 12:06, hcvv wrote:
>
> robin_listas;2651279 Wrote:

> I used vi way before MS-DOS existed, but it is something you have to
> get used to (understatement).:stuck_out_tongue:

Indeed! LOL.

It is a very powerful editor, but I have not invested in learning to use
it. Just enough to change or add a line, if I don’t have anything else
to use. As there are systems with nothing else, it pays to know at least
a bit of it.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

On Sun, 29 Jun 2014 01:18:06 GMT, “Carlos E. R.”
<robin_listas@no-mx.forums.opensuse.org> wrote:

>On 2014-06-28 18:06, hcvv wrote:
>> Btw I wonder how he got into insert mode to type the line? When you
>> never used vi, all is magic…
>
>The first time I tried, I somehow got into edit mode, probably after
>hitting many keys. Then I could not get out.
>
>I’m unsure if the first time I was using “putty”, so I closed putty, and
>perhaps I tried it at home, then I had to reboot the machine, because I
>had no idea how to get out, nor how to kill a process, and maybe I
>didn’t know that I had several terminals.
>
>I assure you, coming from the MsDOS world, or worse, Windows, and
>“bumping” into “vi” is scary. Now I laugh, but not that day. If it was
>via putty, it was a working place important server, and being a novice I
>did not even know if closing the putty client was safe or allowed.
>
>:-)

Oh yea. For real frustration try using sed at 1200 baud. vi was a big
improvement over that. Today i would explicitly use gedit, kedit, kate or
similar whenever i can. Massively more friendly to a GUI user. I am no
longer all that comfortable in vi.

?-)

On 2014-07-01 03:56, josephkk wrote:
> On Sun, 29 Jun 2014 01:18:06 GMT, “Carlos E. R.” <> wrote:

>> I assure you, coming from the MsDOS world, or worse, Windows, and
>> “bumping” into “vi” is scary. Now I laugh, but not that day. If it was
>> via putty, it was a working place important server, and being a novice I
>> did not even know if closing the putty client was safe or allowed.
>>
>> :slight_smile:
>
> Oh yea. For real frustration try using sed at 1200 baud. vi was a big
> improvement over that. Today i would explicitly use gedit, kedit, kate or
> similar whenever i can. Massively more friendly to a GUI user. I am no
> longer all that comfortable in vi.

I had forgotten about “edlin” in MsDOS, which was a line editor, not a
screen editor. I once used it with keyboard and printer to edit
autoexec.bat, because the monitor had broken down. First I had to tell
the thing, typing blind, to use the printer as console output.

This “edlin” is in the “ed” class of editors, but less powerful. It was
the only editor MsDOS came with, out of the box. Perhaps on version 4 or
5 they added a reasonable alternative called “edit” or “editor”.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)