Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is there a way to get the dd command quiet. I'm using the dd command to generate a 1k file with random data. I tried to use > /dev/null redirection but is still gives output to the screen. This is what I get:
$ dd if=/dev/urandom of=tesfile count=1 bs=1k > /dev/null
1+0 records in
1+0 records out
Originally posted by Basta Is there a way to get the dd command quiet. I'm using the dd command to generate a 1k file with random data. I tried to use > /dev/null redirection but is still gives output to the screen. This is what I get:
$ dd if=/dev/urandom of=tesfile count=1 bs=1k > /dev/null
1+0 records in
1+0 records out
Your help is appreciated.
> only redirects stdout. Not stderr. Some programms use stderr to throw messeges, not only errors.
Try
dd if=/dev/urandom of=tesfile count=1 bs=1k &> /dev/null
to redirect both stdout and stderr to /dev/null
dd command quiet without throwing away error messages
I found this thread on Google, and was hoping for something to copy-and-paste into a script. Didn't find it, so came up with this in case anyone else finds it useful.
vs. the previous solutions, it doesn't throw away the stderr from dd if the return code from dd was non-zero (i.e. dd was unhappy).
error=$( dd if=/dev/fazero of=/dev/null count=1 2>&1 ) ; ddrc=$? ; if [ $ddrc != 0 ] ; then echo dd exited with return code $ddrc ; echo error was $error ; fi
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.