Solved

dd if=/dev/null of=sparse-file-1 bs=1M seek=100352

Posted on 2011-02-18
5
1,394 Views
Last Modified: 2012-06-27
i can't not interpret this command, what will it do


dd if=/dev/null of=sparse-file-1 bs=1M seek=100352
0
Comment
Question by:aashee
  • 3
5 Comments
 
LVL 11

Expert Comment

by:rowansmith
ID: 34931086
It will create a empty file called "sparse-file-1" of size 1Mb

0
 
LVL 11

Expert Comment

by:rowansmith
ID: 34931096
rowan@daedalus:~/dd$ dd if=/dev/null of=sparse-file-1 bs=1M seek=100352
0+0 records in
0+0 records out
0 bytes (0 B) copied, 2.1698e-05 s, 0.0 kB/s
rowan@daedalus:~/dd$ ls -la
total 8
drwxr-xr-x  2 rowan users         4096 2011-02-19 11:50 .
drwxr-xr-x 14 rowan users         4096 2011-02-19 11:50 ..
-rw-r--r--  1 rowan users 105226698752 2011-02-19 11:50 sparse-file-1
0
 

Author Comment

by:aashee
ID: 34931132
Hi Rowan,
but doesn't it checks some condition and then it iwll create file .
like if=/dev/null ? what does mean by if=/dev/null
what does doea mean by of=sparse-file-1

bs=1M ?

seek=100352, what does it explain?
i want to have a deep understanding of this ?
0
 
LVL 31

Expert Comment

by:farzanj
ID: 34931133
if : means input file.  /dev/null is Unix/Linux file.  It is a special file that provides no data if you read from it and destroys all data when you write to it but returns success.

of: output file.  Path of file to be created
bs: Block size
seek: Skip 100352 byte blocks before copying from if to of
0
 
LVL 11

Accepted Solution

by:
rowansmith earned 500 total points
ID: 34931164
No, it does not check any condition.

What happens is it skips the first 100352 blocks of the output file and starts writing the contents of /dev/null at that point.  /dev/null is empty.  Your block size is 1Mbyte (given by bs=1M)

So 100352 * 1024 * 1024 = 105226698752 bytes of nothing.

It dosn't actua;ly take up that space but,because dev/null is empty.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now