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.
Strings will omit quite a large number of sectors.
'strings' has no idea what a sector is or does; it outputs sequences
of printable characters in its input stream. It suppresses characters
w/o a sensible printable representation, and prints candidates for
actual words.
'hexdump' will faithfully let you output any garbage in a presentable
view, e.g.: a column of hex-data and a column of ASCII data in your
incantation; whether or not that is what one wants to see is a totally
different story. As far as recognisable (human readable) strings goes,
'strings' would be my preferred weapon of choice because I wouldn't need
to worry whether a string has been broken over to the next line.
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
Nevertheless, if one wants 5000 sectors, they won't get 2560000 of data using strings. That may, or may not be problematic. I haven't as yet found a solution to the hexdump newline problem.
This is one the most awesome posts I've ever seen! It's like being confronted with the compositions of a manic; overwhelming and disturbing at the same time. I sat there gaping as I just go flushed away. I guess, reading this is just like 'dd'ing your own brain with /dev/random .
Above all, it was entertaining and most educating. Many thanks!!
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
Learn The DD Command has reached a landmark: 500,000 views. I didn't notice right away. As of this reply there are 505,000 views. When I first conceived of a dd post, all I wanted was a place to gather examples of practical dd usage. There was no central repository at that time, and the existing information was haphazardly strew across cyberspace.
I wanted to put the power of dd in the hands of common computer users, not just computer professionals. I'm a computer professional, and I saw the potential for dd in the hands of beginners. When my classmates in grade school were reading childrens' novels, I was reading how to program a mainframe computer. I never liked kids books, not even as a kid. I knew I'd make a living doing something with computers.
Since I became aware of its existence, I always liked linuxquestions.org. It's a great site. I can't think a better place to have the Learn The DD Command thread than a linuxquestions.org. If you happen to run across this reply, and you're not already a member, take the time to join. When I joined I didn't really need help learning Linux. It's just a great community.
There are more deeply technical Linux forums out there, but the idea of Linux is to have fun. If Linux wasn't fun, I'd find some other OS that was fun, and use that. But anyway, this dd thread has had the benefit of Jeremy's SEO skills. It's not just because it's a great thread that got it to over 500,000 views. Jeremy had a lot to do with it. Google lists threads from this site early in the hit list, because the site has an excellent reputation for useful and quality content; and because the site uses good SEO.
I thank Jeremy for helping this thread become popular. I really have no control other than trying to make the thread useful to people the world over. After that my job is done. And nothing is forever. This thread is not immortal. Nine billion years from now it may very well be space dust. A highly advanced race of multidimensional beings may reassemble linuxquestions.org from random debris drifting through space. They'll say to each other, "The kernel has advanced quite a bit during the last nine billion years."
AwesomeMachine,
Congratulations for the mark set. During the time I have been member of this forum, I learned a lot thanks to the help of all those great people which make this forum.
Thanks!
Distribution: openSuSE Tumbleweed-KDE, Mint 21, MX-21, Manjaro
Posts: 4,629
Rep:
Good morning Tinkster. As I understand it you propose to write "1"s bit-wise. Lots of bits to be produced by "echo". Would be better to ... here is an earlier attempt to come to grips with this : http://www.linuxquestions.org/questi...v-zero-619626/
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524
Original Poster
Rep:
Quote:
Originally Posted by jpantano88
Amazing post! Congrats on your latest benchmark!
Quick question: If I do
Code:
dd if=/dev/zero of=/dev/target
Then I can write all 0s to a drive.
But what if I then want to flip every bit on the same drive to a 1?
I'm testing solid state drives and I'm interested in their endurance.
Thanks for your help.
Hi jpan,
Welcome to LinuxQuestions.org. This should work for you:
dd if=/dev/zero bs=32k | sed 's/\x00/\xff/g' | dd of=/dev/target
0x100h = 1 0000 0000b - 1b = 0xffh = 1111 1111b = 255d. So, 0xffh is hex notation for bitwise 1111 1111. In the example above, dd reads 32k of zeroes (0x00h) from /dev/zero. Sed replaces every 32k of hex zeroes with 32k of hex ff.
This would not work without the \x symbols in the sed perl expression, because without them sed would replace ascii 00 (0x3030h) with ascii ff (0x6666h). Sed would not find ascii 00 in the dd bit stream, so dd would pipe through sed unchanged.
-Awesome
Last edited by AwesomeMachine; 06-21-2010 at 11:46 PM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.