LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 04-14-2005, 04:40 AM   #1
Basta
LQ Newbie
 
Registered: Jun 2004
Posts: 15

Rep: Reputation: 0
How do I get dd command quiet


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.
 
Old 04-14-2005, 04:50 AM   #2
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 53
Re: How do I get dd command quiet

Quote:
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

for more info on I/O redirections read here:
http://www.tldp.org/LDP/abs/html/io-redirection.html

Last edited by perfect_circle; 04-14-2005 at 04:51 AM.
 
Old 04-14-2005, 04:57 AM   #3
Basta
LQ Newbie
 
Registered: Jun 2004
Posts: 15

Original Poster
Rep: Reputation: 0
Thanx, perfect_cicrle. That does the trick.
 
Old 04-14-2005, 04:59 AM   #4
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 53
If you like to keep the tradition use it like this, it has the same result

dd if=/dev/urandom of=tesfile count=1 bs=1k > /dev/null 2>&1

(redirect stdout to /dev/null and redirect stderr (file descriptor of stderr is 2) to stdout (file descriptor of stdout is 1) )
 
Old 11-30-2015, 03:57 AM   #5
TimSmall
LQ Newbie
 
Registered: Nov 2015
Posts: 2

Rep: Reputation: Disabled
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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
It's soooo quiet....! perry LinuxQuestions.org Member Success Stories 5 02-29-2008 10:05 AM
quiet sound? t_boyd Linux - General 2 12-10-2004 03:53 PM
XMMS is very quiet dinkydarko Fedora 5 11-26-2004 12:45 PM
Very quiet sound DiscoBiscuit Linux - General 3 06-01-2004 04:42 PM
Quiet Makefile AMMullan Programming 6 03-10-2004 07:32 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration