LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   '&' and '&' Symboles (https://www.linuxquestions.org/questions/linux-newbie-8/and-and-and-symboles-803500/)

ManuMayer 04-22-2010 07:34 AM

'&' and '&' Symboles
 
There is no better place then the Newb Channel for a question like that.

In my Crontab file, I have a command that ends with &> /dev/null

I understand that basically the /dev/null is there so it produce no output, however, I would like to understand exactly what the '&' and '>' means ?

Also, it's really hard to find a information for non Alphanumeric chars on Google. Is there a good Linux site where it would explain what these symbols does ?

thanks

EricTRA 04-22-2010 07:40 AM

Hello,

Have a look at this. /dev/null is your bitbucket/wastebasket/bin, whatever you want to call it. So basically redirecting (>) to /dev/null is saying you don't want to see it. You can Google for input/output redirection in Linux and it will take you to a lot more detailed information. Or you can read the Bash Beginners Guide.

Kind regards,

Eric

ManuMayer 04-22-2010 07:47 AM

So using $ command > dev/null
would be used I don't want to see the standard output

and

using $ command &> dev/null
would be used If I don't want to see the standard output and the error output ?

Is that correct ?

pixellany 04-22-2010 08:00 AM

http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html

I don't know the relevance of "$" in your examples---but it is not related to re-direction.

ManuMayer 04-22-2010 08:06 AM

Quote:

Originally Posted by pixellany (Post 3943947)
http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html

I don't know the relevance of "$" in your examples---but it is not related to re-direction.

I looked into your link and the last entry

Quote:

3.6 Sample: stderr and stdout 2 file

This will place every output of a program to a file. This is suitable sometimes for cron entries, if you want a command to pass in absolute silence.

rm -f $(find / -name core) &> /dev/null
say that everything is going to pass in absolute silence, which I guess means what I just said

Quote:

using $ command &> dev/null
would be used If I don't want to see the standard output and the error output ?
Thanks for helping me understand that feature of linux

MTK358 04-22-2010 08:40 AM

command1 | command2

sends the stdout of command1 to the stdin of command2

command < file

sends the contents of file to command's stdin

command > file

writes the stdout of command to file, overwriting it's original contents.

command 2> file

writes the stderr of command to file, overwriting it's original contents.

command &> file

writes the stdout and stderr of command to file, overwriting it's original contents.

command >> file

appends the stdout of command to file's original contents.

ManuMayer 04-22-2010 08:50 AM

Thanks a lot MTK358
If every tutorials were made like that, life would be much more easier ;)
that's exactly what I needed.

pixellany 04-22-2010 08:52 AM

The link I provided gave you all of that info---n'est-ce pas?


All times are GMT -5. The time now is 09:14 AM.