Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to list files at 12h01. How can I set my crontab to do this?

pedro@Pedro-PC:~/PL/trab4$ crontab -l
# 01 12 * * * ls -l
share|improve this question
What problem are you having? – coneslayer Apr 15 '10 at 11:29
Redirect your output in the script to a known file location – mpez0 Apr 16 '10 at 16:29

Try putting the

ls -l

command into a small bash script .... name the file listfiles for an example

The put listfiles in somewhere like /usr/bin

make listfiles executable with

sudo chmod +x listfiles

then change your crontab to

01 12 * * * /usr/bin/listfiles
share|improve this answer
Is all worthless, if the output is on the virtual console and no screen attached, nor the output of ls -l redirected to somewhere... – Oliver Friedrich Apr 20 '10 at 10:02

You can also (which I prefer for smaller commands) do what you did at first, but with the full path to the ls binary. Crontab runs with a smaller $PATH than you do, which is why we give the full path to ls.


01 12 * * * /bin/ls /home/user/

You can get the path to your binary with

which ls
share|improve this answer
not working, don't happend nothing – user34104 Apr 15 '10 at 22:29
What happens when you try * * * * * /bin/ls / ? Assuming of course, that your ls is located at /bin/ls .. – SW. Apr 16 '10 at 14:34
Good hint to use full pathes for programms run by root, but still the output of ls will never be seen, nor be saved anywhere... – Oliver Friedrich Apr 20 '10 at 10:03

As I stated in your other question, errors and warnings from cron and at can be viewed in your local mail.

And your cronjob is wrong, it should be something like:

01 12 * * * ls -l [somedir] > [some file with results]

[somedir] is the directory you are trying to list.

[some file with results] is a path to the file that will store your result.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.